Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: /** Chris@0: * @since Class available since Release 2.0.0 Chris@0: */ Chris@0: class PHP_CodeCoverage_Report_XML_Project extends PHP_CodeCoverage_Report_XML_Node Chris@0: { Chris@0: public function __construct($name) Chris@0: { Chris@0: $this->init(); Chris@0: $this->setProjectName($name); Chris@0: } Chris@0: Chris@0: private function init() Chris@0: { Chris@0: $dom = new DOMDocument; Chris@0: $dom->loadXML(''); Chris@0: Chris@0: $this->setContextNode( Chris@0: $dom->getElementsByTagNameNS( Chris@0: 'http://schema.phpunit.de/coverage/1.0', Chris@0: 'project' Chris@0: )->item(0) Chris@0: ); Chris@0: } Chris@0: Chris@0: private function setProjectName($name) Chris@0: { Chris@0: $this->getContextNode()->setAttribute('name', $name); Chris@0: } Chris@0: Chris@0: public function getTests() Chris@0: { Chris@0: $testsNode = $this->getContextNode()->getElementsByTagNameNS( Chris@0: 'http://schema.phpunit.de/coverage/1.0', Chris@0: 'tests' Chris@0: )->item(0); Chris@0: Chris@0: if (!$testsNode) { Chris@0: $testsNode = $this->getContextNode()->appendChild( Chris@0: $this->getDom()->createElementNS( Chris@0: 'http://schema.phpunit.de/coverage/1.0', Chris@0: 'tests' Chris@0: ) Chris@0: ); Chris@0: } Chris@0: Chris@0: return new PHP_CodeCoverage_Report_XML_Tests($testsNode); Chris@0: } Chris@0: Chris@0: public function asDom() Chris@0: { Chris@0: return $this->getDom(); Chris@0: } Chris@0: }