當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PHP_CodeSniffer::getSniffFiles方法代碼示例

本文整理匯總了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;
 }
開發者ID:sunnystone85,項目名稱:CsPCHookSugar,代碼行數:42,代碼來源:Generator.php


注:本文中的PHP_CodeSniffer::getSniffFiles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。