You are here

private function PHP_CodeCoverage_Report_XML::processFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/XML.php \PHP_CodeCoverage_Report_XML::processFile()
1 call to PHP_CodeCoverage_Report_XML::processFile()
PHP_CodeCoverage_Report_XML::processDirectory in vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/XML.php

File

vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/XML.php, line 94

Class

PHP_CodeCoverage_Report_XML
@since Class available since Release 2.0.0

Code

private function processFile(PHP_CodeCoverage_Report_Node_File $file, PHP_CodeCoverage_Report_XML_Directory $context) {
  $fileObject = $context
    ->addFile($file
    ->getName(), $file
    ->getId() . '.xml');
  $this
    ->setTotals($file, $fileObject
    ->getTotals());
  $fileReport = new PHP_CodeCoverage_Report_XML_File_Report($file
    ->getName());
  $this
    ->setTotals($file, $fileReport
    ->getTotals());
  foreach ($file
    ->getClassesAndTraits() as $unit) {
    $this
      ->processUnit($unit, $fileReport);
  }
  foreach ($file
    ->getFunctions() as $function) {
    $this
      ->processFunction($function, $fileReport);
  }
  foreach ($file
    ->getCoverageData() as $line => $tests) {
    if (!is_array($tests) || count($tests) == 0) {
      continue;
    }
    $coverage = $fileReport
      ->getLineCoverage($line);
    foreach ($tests as $test) {
      $coverage
        ->addTest($test);
    }
    $coverage
      ->finalize();
  }
  $this
    ->initTargetDirectory($this->target . dirname($file
    ->getId()) . '/');
  $fileDom = $fileReport
    ->asDom();
  $fileDom->formatOutput = true;
  $fileDom->preserveWhiteSpace = false;
  $fileDom
    ->save($this->target . $file
    ->getId() . '.xml');
}