当前位置: 首页>>代码示例>>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;未经允许,请勿转载。