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.
13
* @package CodeCoverage
14
* @author Arne Blankerts <arne@blankerts.de>
15
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
16
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
17
* @link http://github.com/sebastianbergmann/php-code-coverage
18
* @since Class available since Release 2.0.0
20
class PHP_CodeCoverage_Report_XML_Node
32
public function __construct(DOMElement $context)
34
$this->setContextNode($context);
37
protected function setContextNode(DOMElement $context)
39
$this->dom = $context->ownerDocument;
40
$this->contextNode = $context;
43
public function getDom()
48
protected function getContextNode()
50
return $this->contextNode;
53
public function getTotals()
55
$totalsContainer = $this->getContextNode()->firstChild;
57
if (!$totalsContainer) {
58
$totalsContainer = $this->getContextNode()->appendChild(
59
$this->dom->createElementNS(
60
'http://schema.phpunit.de/coverage/1.0', 'totals'
65
return new PHP_CodeCoverage_Report_XML_Totals($totalsContainer);
68
public function addDirectory($name)
70
$dirNode = $this->getDom()->createElementNS(
71
'http://schema.phpunit.de/coverage/1.0', 'directory'
74
$dirNode->setAttribute('name', $name);
75
$this->getContextNode()->appendChild($dirNode);
77
return new PHP_CodeCoverage_Report_XML_Directory($dirNode);
80
public function addFile($name, $href)
82
$fileNode = $this->getDom()->createElementNS(
83
'http://schema.phpunit.de/coverage/1.0', 'file'
86
$fileNode->setAttribute('name', $name);
87
$fileNode->setAttribute('href', $href);
88
$this->getContextNode()->appendChild($fileNode);
90
return new PHP_CodeCoverage_Report_XML_File($fileNode);