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_Report extends PHP_CodeCoverage_Report_XML_File
16 public function __construct($name)
18 $this->dom = new DOMDocument;
19 $this->dom->loadXML('<?xml version="1.0" ?><phpunit xmlns="http://schema.phpunit.de/coverage/1.0"><file /></phpunit>');
21 $this->contextNode = $this->dom->getElementsByTagNameNS(
22 'http://schema.phpunit.de/coverage/1.0',
26 $this->setName($name);
29 private function setName($name)
31 $this->contextNode->setAttribute('name', $name);
34 public function asDom()
39 public function getFunctionObject($name)
41 $node = $this->contextNode->appendChild(
42 $this->dom->createElementNS(
43 'http://schema.phpunit.de/coverage/1.0',
48 return new PHP_CodeCoverage_Report_XML_File_Method($node, $name);
51 public function getClassObject($name)
53 return $this->getUnitObject('class', $name);
56 public function getTraitObject($name)
58 return $this->getUnitObject('trait', $name);
61 private function getUnitObject($tagName, $name)
63 $node = $this->contextNode->appendChild(
64 $this->dom->createElementNS(
65 'http://schema.phpunit.de/coverage/1.0',
70 return new PHP_CodeCoverage_Report_XML_File_Unit($node, $name);