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_Totals
34 private $functionsNode;
46 public function __construct(DOMElement $container)
48 $this->container = $container;
49 $dom = $container->ownerDocument;
51 $this->linesNode = $dom->createElementNS(
52 'http://schema.phpunit.de/coverage/1.0',
56 $this->methodsNode = $dom->createElementNS(
57 'http://schema.phpunit.de/coverage/1.0',
61 $this->functionsNode = $dom->createElementNS(
62 'http://schema.phpunit.de/coverage/1.0',
66 $this->classesNode = $dom->createElementNS(
67 'http://schema.phpunit.de/coverage/1.0',
71 $this->traitsNode = $dom->createElementNS(
72 'http://schema.phpunit.de/coverage/1.0',
76 $container->appendChild($this->linesNode);
77 $container->appendChild($this->methodsNode);
78 $container->appendChild($this->functionsNode);
79 $container->appendChild($this->classesNode);
80 $container->appendChild($this->traitsNode);
83 public function getContainer()
85 return $this->container;
88 public function setNumLines($loc, $cloc, $ncloc, $executable, $executed)
90 $this->linesNode->setAttribute('total', $loc);
91 $this->linesNode->setAttribute('comments', $cloc);
92 $this->linesNode->setAttribute('code', $ncloc);
93 $this->linesNode->setAttribute('executable', $executable);
94 $this->linesNode->setAttribute('executed', $executed);
95 $this->linesNode->setAttribute(
97 PHP_CodeCoverage_Util::percent($executed, $executable, true)
101 public function setNumClasses($count, $tested)
103 $this->classesNode->setAttribute('count', $count);
104 $this->classesNode->setAttribute('tested', $tested);
105 $this->classesNode->setAttribute(
107 PHP_CodeCoverage_Util::percent($tested, $count, true)
111 public function setNumTraits($count, $tested)
113 $this->traitsNode->setAttribute('count', $count);
114 $this->traitsNode->setAttribute('tested', $tested);
115 $this->traitsNode->setAttribute(
117 PHP_CodeCoverage_Util::percent($tested, $count, true)
121 public function setNumMethods($count, $tested)
123 $this->methodsNode->setAttribute('count', $count);
124 $this->methodsNode->setAttribute('tested', $tested);
125 $this->methodsNode->setAttribute(
127 PHP_CodeCoverage_Util::percent($tested, $count, true)
131 public function setNumFunctions($count, $tested)
133 $this->functionsNode->setAttribute('count', $count);
134 $this->functionsNode->setAttribute('tested', $tested);
135 $this->functionsNode->setAttribute(
137 PHP_CodeCoverage_Util::percent($tested, $count, true)