ÿØÿà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 */ /** * CbErrorCPD * * @category PHP_CodeBrowser * @package PHP_CodeBrowser * @subpackage Plugins * @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 CbErrorCPD extends CbPluginsAbstract { public $pluginName = 'pmd-cpd'; /** * Mapper method for this plugin. * * @param SingleXMLElement $element The XML plugin node with its errors * * @return array */ public function mapIssues(DOMNode $element, $filename) { $parentNode = $element->parentNode; $files = $this->_issueXml->query( 'file[@path="'.$filename.'"]', $parentNode ); $lineCount = (int)$parentNode->getAttribute('lines'); $result = array(); foreach ($files as $file) { $result[] = new CbIssue( $file->getAttribute('path'), (int) $file->getAttribute('line'), (int) $file->getAttribute('line') + $lineCount, 'Duplication', htmlentities( $this->_CPDgetDescription($parentNode->childNodes, $file) ), 'notice' ); } return $result; } public function getFilesWithIssues() { $filenames = array(); $nodes = $this->_issueXml->query( '/*/'.$this->pluginName.'/*/file[@path]' ); foreach ($nodes as $node) { $filenames[] = $node->getAttribute('path'); } return array_unique($filenames); } /** * Get all DOMNodes that represent issues for a specific file. * * @param String $filename Name of the file to get nodes for. * @return DOMNodeList */ protected function _getIssueNodes($filename) { return $this->_issueXml->query( '/*/'.$this->pluginName.'/*/file[@path="'.$filename.'"]' ); } /** * We need another version of getDescription, as we need $allNodes * to find duplicates. */ protected function _CPDgetDescription(DOMNodeList $allNodes, DOMNode $currentNode) { $source = array(); foreach ($allNodes as $node) { if ($node instanceof DOMElement && !$node->isSameNode($currentNode)) { $source[] = sprintf( '%s (%d)', $node->getAttribute('path'), $node->getAttribute('line') ); } } return "Copy paste from:\n".implode("\n", $source); } /** * Make sure this is never called. * @codeCoverageIgnoreStart * This cannot be called because of other overridden methods in this class. */ protected function _getDescription(DOMElement $element) { throw new Exception('ErrorCPD does not support getDescription()!'); } //@codeCoverageIgnoreEnd }