1<?php 2/* 3 * This file is part of the php-code-coverage package. 4 * 5 * (c) Sebastian Bergmann <sebastian@phpunit.de> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11namespace SebastianBergmann\CodeCoverage\Report\Xml; 12 13class Method 14{ 15 /** 16 * @var \DOMElement 17 */ 18 private $contextNode; 19 20 public function __construct(\DOMElement $context, $name) 21 { 22 $this->contextNode = $context; 23 24 $this->setName($name); 25 } 26 27 private function setName($name) 28 { 29 $this->contextNode->setAttribute('name', $name); 30 } 31 32 public function setSignature($signature) 33 { 34 $this->contextNode->setAttribute('signature', $signature); 35 } 36 37 public function setLines($start, $end = null) 38 { 39 $this->contextNode->setAttribute('start', $start); 40 41 if ($end !== null) { 42 $this->contextNode->setAttribute('end', $end); 43 } 44 } 45 46 public function setTotals($executable, $executed, $coverage) 47 { 48 $this->contextNode->setAttribute('executable', $executable); 49 $this->contextNode->setAttribute('executed', $executed); 50 $this->contextNode->setAttribute('coverage', $coverage); 51 } 52 53 public function setCrap($crap) 54 { 55 $this->contextNode->setAttribute('crap', $crap); 56 } 57} 58