3 * This file is part of the PHP_CodeCoverage package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * @since Class available since Release 2.0.0
14 class PHP_CodeCoverage_Report_XML_File
24 protected $contextNode;
26 public function __construct(DOMElement $context)
28 $this->dom = $context->ownerDocument;
29 $this->contextNode = $context;
32 public function getTotals()
34 $totalsContainer = $this->contextNode->firstChild;
36 if (!$totalsContainer) {
37 $totalsContainer = $this->contextNode->appendChild(
38 $this->dom->createElementNS(
39 'http://schema.phpunit.de/coverage/1.0',
45 return new PHP_CodeCoverage_Report_XML_Totals($totalsContainer);
48 public function getLineCoverage($line)
50 $coverage = $this->contextNode->getElementsByTagNameNS(
51 'http://schema.phpunit.de/coverage/1.0',
56 $coverage = $this->contextNode->appendChild(
57 $this->dom->createElementNS(
58 'http://schema.phpunit.de/coverage/1.0',
64 $lineNode = $coverage->appendChild(
65 $this->dom->createElementNS(
66 'http://schema.phpunit.de/coverage/1.0',
71 return new PHP_CodeCoverage_Report_XML_File_Coverage($lineNode, $line);