~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to vendor/phpunit/php-code-coverage/src/CodeCoverage/Driver/HHVM.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/*
 
3
 * This file is part of the PHP_CodeCoverage package.
 
4
 *
 
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 
6
 *
 
7
 * For the full copyright and license information, please view the LICENSE
 
8
 * file that was distributed with this source code.
 
9
 */
 
10
 
 
11
/**
 
12
 * Driver for HHVM's code coverage functionality.
 
13
 *
 
14
 * @category   PHP
 
15
 * @package    CodeCoverage
 
16
 * @author     Sebastian Bergmann <sebastian@phpunit.de>
 
17
 * @copyright  Sebastian Bergmann <sebastian@phpunit.de>
 
18
 * @license    http://www.opensource.org/licenses/BSD-3-Clause  The BSD 3-Clause License
 
19
 * @link       http://github.com/sebastianbergmann/php-code-coverage
 
20
 * @since      Class available since Release 1.3.0
 
21
 * @codeCoverageIgnore
 
22
 */
 
23
class PHP_CodeCoverage_Driver_HHVM implements PHP_CodeCoverage_Driver
 
24
{
 
25
    /**
 
26
     * Constructor.
 
27
     */
 
28
    public function __construct()
 
29
    {
 
30
        if (!defined('HHVM_VERSION')) {
 
31
            throw new PHP_CodeCoverage_Exception('This driver requires HHVM');
 
32
        }
 
33
    }
 
34
 
 
35
    /**
 
36
     * Start collection of code coverage information.
 
37
     */
 
38
    public function start()
 
39
    {
 
40
        fb_enable_code_coverage();
 
41
    }
 
42
 
 
43
    /**
 
44
     * Stop collection of code coverage information.
 
45
     *
 
46
     * @return array
 
47
     */
 
48
    public function stop()
 
49
    {
 
50
        $codeCoverage = fb_get_code_coverage(true);
 
51
 
 
52
        fb_disable_code_coverage();
 
53
 
 
54
        return $codeCoverage;
 
55
    }
 
56
}