You are here

public function PHP_CodeCoverage_Driver_PHPDBG::stop in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/php-code-coverage/src/CodeCoverage/Driver/PHPDBG.php \PHP_CodeCoverage_Driver_PHPDBG::stop()

Stop collection of code coverage information.

Return value

array

Overrides PHP_CodeCoverage_Driver::stop

File

vendor/phpunit/php-code-coverage/src/CodeCoverage/Driver/PHPDBG.php, line 50

Class

PHP_CodeCoverage_Driver_PHPDBG
Driver for PHPDBG's code coverage functionality.

Code

public function stop() {
  static $fetchedLines = array();
  $dbgData = phpdbg_end_oplog();
  if ($fetchedLines == array()) {
    $sourceLines = phpdbg_get_executable();
  }
  else {
    $newFiles = array_diff(get_included_files(), array_keys($fetchedLines));
    if ($newFiles) {
      $sourceLines = phpdbg_get_executable(array(
        'files' => $newFiles,
      ));
    }
    else {
      $sourceLines = array();
    }
  }
  foreach ($sourceLines as $file => $lines) {
    foreach ($lines as $lineNo => $numExecuted) {
      $sourceLines[$file][$lineNo] = self::LINE_NOT_EXECUTED;
    }
  }
  $fetchedLines = array_merge($fetchedLines, $sourceLines);
  return $this
    ->detectExecutedLines($fetchedLines, $dbgData);
}