本文整理匯總了PHP中PHP_CodeSniffer::getSniffFiles方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHP_CodeSniffer::getSniffFiles方法的具體用法?PHP PHP_CodeSniffer::getSniffFiles怎麽用?PHP PHP_CodeSniffer::getSniffFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHP_CodeSniffer
的用法示例。
在下文中一共展示了PHP_CodeSniffer::getSniffFiles方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getStandardFiles
/**
* Returns a list of paths to XML standard files for all sniffs in a standard.
*
* Any sniffs that do not have an XML standard file are obviously not included
* in the returned array. If documentation is only being generated for some
* sniffs (ie. $this->_sniffs is not empty) then all others sniffs will
* be filtered from the results as well.
*
* @return array(string)
*/
protected function getStandardFiles()
{
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;
}
$phpcs = new PHP_CodeSniffer();
$sniffs = $phpcs->getSniffFiles($standardDir, $standard);
$standardFiles = array();
foreach ($sniffs as $sniff) {
if (empty($this->_sniffs) === false) {
// We are limiting the docs to certain sniffs only, so filter
// out any unwanted sniffs.
$sniffName = substr($sniff, strrpos($sniff, '/') + 1);
$sniffName = substr($sniffName, 0, -9);
if (in_array($sniffName, $this->_sniffs) === false) {
continue;
}
}
$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) {
$standardFiles[] = $standardFile;
}
}
//end foreach
return $standardFiles;
}