You are here

class PHP_CodeCoverage_Report_XML_File in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/File.php \PHP_CodeCoverage_Report_XML_File

@since Class available since Release 2.0.0

Hierarchy

Expanded class hierarchy of PHP_CodeCoverage_Report_XML_File

File

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

View source
class PHP_CodeCoverage_Report_XML_File {

  /**
   * @var DOMDocument
   */
  protected $dom;

  /**
   * @var DOMElement
   */
  protected $contextNode;
  public function __construct(DOMElement $context) {
    $this->dom = $context->ownerDocument;
    $this->contextNode = $context;
  }
  public function getTotals() {
    $totalsContainer = $this->contextNode->firstChild;
    if (!$totalsContainer) {
      $totalsContainer = $this->contextNode
        ->appendChild($this->dom
        ->createElementNS('http://schema.phpunit.de/coverage/1.0', 'totals'));
    }
    return new PHP_CodeCoverage_Report_XML_Totals($totalsContainer);
  }
  public function getLineCoverage($line) {
    $coverage = $this->contextNode
      ->getElementsByTagNameNS('http://schema.phpunit.de/coverage/1.0', 'coverage')
      ->item(0);
    if (!$coverage) {
      $coverage = $this->contextNode
        ->appendChild($this->dom
        ->createElementNS('http://schema.phpunit.de/coverage/1.0', 'coverage'));
    }
    $lineNode = $coverage
      ->appendChild($this->dom
      ->createElementNS('http://schema.phpunit.de/coverage/1.0', 'line'));
    return new PHP_CodeCoverage_Report_XML_File_Coverage($lineNode, $line);
  }

}

Members