ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ * @author Michel Hartmann * @copyright 2007-2010 Mayflower GmbH * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version SVN: $Id$ * @link http://www.phpunit.de/ * @since File available since 0.1.0 */ require_once 'File/Iterator/Factory.php'; /** * CbIssueXML * * This class is a wrapper around DOMDocument to provide additional features * like simple xpath queries. * It is used to merge issue XML files and execute plugins * against it to retrieve the issues from them. * * @category PHP_CodeBrowser * @package PHP_CodeBrowser * @author Elger Thiele * @author Michel Hartmann * @copyright 2007-2010 Mayflower GmbH * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version Release: 1.0.2 * @link http://www.phpunit.de/ * @since Class available since 0.1.0 */ class CbIssueXml extends DOMDocument { /** * * * @var DOMXPath */ protected $_xpath; /** * Do not preserve white spaces. * @see DOMDocument * * @var Boolean */ public $preserveWhiteSpace = false; /** * Provide nice output. * * @var Boolean */ public $formatOutput = true; /** * Default constructor * * @param String $version The version definitio for DomDocument * @param String $encoding The used encoding for DomDocument */ public function __construct($version = '1.0', $encoding = 'UTF-8') { parent::__construct($version, $encoding); $this->appendChild( $this->createElement('codebrowser') ); } /** * Parses directory for XML report files, generating a single DomDocument * inheritting all files and issues. * * @param String $directory The path to directory where xml files are stored * * @return CbIssueXml This object */ public function addDirectory($directory) { $factory = new File_Iterator_Factory; $iterator = $factory->getFileIterator($directory, 'xml'); foreach ($iterator as $current) { $realFileName = realpath($current); $xml = new DOMDocument('1.0', 'UTF-8'); $xml->validateOnParse = true; if (@$xml->load(realpath($current))) { $this->addXMLFile($xml); } else { error_log( "[Warning] Could not read file '$realFileName'. " . 'Make sure it contains valid xml.' ); } unset($xml); } if (!$this->documentElement->hasChildNodes()) { error_log("[Warning] No valid log files found in '$directory'"); } return $this; } /** * Add xml file to merge * * @param DOMDocument $domDocument The DOMDocument to merge. * * @return void */ public function addXMLFile(DOMDocument $domDocument) { foreach ($domDocument->childNodes as $node) { $this->documentElement->appendChild($this->importNode($node, true)); } } /** * Perform a XPath-Query on the document. * @see DOMXPath::query * * @param String $expression Xpath expression to query for. * @param DOMNode $contextNode Node to use as context (optional) * * @return DOMNodeList List of all matching nodes. */ public function query($expression, DOMNode $contextNode = null) { if (!isset($this->_xpath)) { $this->_xpath = new DOMXPath($this); } if ($contextNode) { $result = $this->_xpath->query($expression, $contextNode); } else { $result = $this->_xpath->query($expression); } return $result; } }