Skip to content

Commit

Permalink
Patch from Dirk Thomas to get the doc generator working with external…
Browse files Browse the repository at this point in the history
… standards

git-svn-id: http://svn.php.net/repository/pear/packages/PHP_CodeSniffer/trunk@248628 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
gsherwood committed Dec 20, 2007
1 parent c862026 commit a10bea6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions CodeSniffer/DocGenerators/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,16 @@ public function generate()
*/
protected function getStandardFiles()
{
$standardDir = realpath(dirname(__FILE__).'/../Standards/'.$this->_standard);
$sniffs = PHP_CodeSniffer::getSniffFiles($standardDir, $this->_standard);
if (is_dir($this->_standard) === true) {
// This is a custom standard.
$standardDir = $this->_standard;
$standard = basename($this->_standard);
} else {
$standardDir = realpath(dirname(__FILE__).'/../Standards/'.$this->_standard);
$standard = $this->_standard;
}

$sniffs = PHP_CodeSniffer::getSniffFiles($standardDir, $standard);

$standardFiles = array();
foreach ($sniffs as $sniff) {
Expand All @@ -147,7 +155,7 @@ protected function getStandardFiles()
}
}

$standardFile = str_replace('/Sniffs/', '/Docs/', $sniff);
$standardFile = str_replace(DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR.'Docs'.DIRECTORY_SEPARATOR, $sniff);
$standardFile = str_replace('Sniff.php', 'Standard.xml', $standardFile);

if (is_file($standardFile) === true) {
Expand Down

0 comments on commit a10bea6

Please sign in to comment.