Chris@14: Chris@14: * Chris@14: * For the full copyright and license information, please view the LICENSE Chris@14: * file that was distributed with this source code. Chris@14: */ Chris@14: Chris@14: namespace SebastianBergmann\CodeCoverage\Report\Xml; Chris@14: Chris@14: class Method Chris@14: { Chris@14: /** Chris@14: * @var \DOMElement Chris@14: */ Chris@14: private $contextNode; Chris@14: Chris@14: public function __construct(\DOMElement $context, $name) Chris@14: { Chris@14: $this->contextNode = $context; Chris@14: Chris@14: $this->setName($name); Chris@14: } Chris@14: Chris@14: private function setName($name) Chris@14: { Chris@14: $this->contextNode->setAttribute('name', $name); Chris@14: } Chris@14: Chris@14: public function setSignature($signature) Chris@14: { Chris@14: $this->contextNode->setAttribute('signature', $signature); Chris@14: } Chris@14: Chris@14: public function setLines($start, $end = null) Chris@14: { Chris@14: $this->contextNode->setAttribute('start', $start); Chris@14: Chris@14: if ($end !== null) { Chris@14: $this->contextNode->setAttribute('end', $end); Chris@14: } Chris@14: } Chris@14: Chris@14: public function setTotals($executable, $executed, $coverage) Chris@14: { Chris@14: $this->contextNode->setAttribute('executable', $executable); Chris@14: $this->contextNode->setAttribute('executed', $executed); Chris@14: $this->contextNode->setAttribute('coverage', $coverage); Chris@14: } Chris@14: Chris@14: public function setCrap($crap) Chris@14: { Chris@14: $this->contextNode->setAttribute('crap', $crap); Chris@14: } Chris@14: }