当前位置: 首页>>代码示例>>PHP>>正文


PHP Path::find方法代码示例

本文整理汇总了PHP中Path::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Path::find方法的具体用法?PHP Path::find怎么用?PHP Path::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * Gets (extended) config
  * @param  string $identifier
  * @return array
  */
 public function get($identifier)
 {
     if (!isset($this->configs[$identifier])) {
         $files = \Path::find('theme.config.' . $identifier, false);
         $config = array();
         foreach ($files as $file) {
             $fileContent = (include $file);
             $fileContent = $fileContent ? $fileContent : array();
             $config = array_merge($config, $fileContent);
         }
         $this->config[$identifier] = $config;
     }
     return $this->config[$identifier];
 }
开发者ID:binocle,项目名称:support,代码行数:19,代码来源:Config.php

示例2: factory

 public static function factory($filename)
 {
     $extension = pathinfo(Path::find(Path::VIEW, $filename), PATHINFO_EXTENSION);
     switch ($extension) {
         case 'htm':
         case 'html':
             $ret = new ViewHTML(Path::find(Path::VIEW, $filename));
             break;
         case 'txt':
             $ret = new ViewTXT(Path::find(Path::VIEW, $filename));
             break;
         case 'xml':
             $ret = new ViewXML(Path::find(Path::VIEW, $filename));
             break;
         case 'xsl':
         case 'xslt':
             $ret = new ViewXSLT(Path::find(Path::VIEW, $filename));
             break;
         default:
             $ret = new ViewPHP(Path::find(Path::VIEW, $filename));
     }
     return $ret;
 }
开发者ID:googlecode-mirror,项目名称:balrog,代码行数:23,代码来源:Views.class.php

示例3: lint_directory

 /**
 ----------------------------------------------------------------------+
 * @desc 	Analyse directory
 ----------------------------------------------------------------------+
 */
 protected function lint_directory()
 {
     $ext = $this->config->check('extensions');
     if (empty($ext)) {
         $ext = 'php';
     }
     $ignore = $this->config->check('ignore');
     $this->msg("Gathering file info...\n");
     $files = empty($ignore) ? Path::find($this->target, "/^.*?\\.({$ext})\$/u") : Path::find($this->target, "/^.*?\\.({$ext})\$/u", $ignore);
     if ($this->config->check(OPT_HARVEST_DOCS)) {
         $this->msg("Harvesting mode on ...\n");
     }
     $this->penalty = 0;
     $numfiles = count($files);
     $reports = array();
     $penaltys = array();
     $nodes = array();
     foreach ($files as $_) {
         $this->msg("Linting file: {$_}\n");
         if ($this->config->check(OPT_DEBUG_TIME_EXTRA)) {
             $time = microtime(true);
         }
         $linter = new Linter($_, $this->config);
         $report = $linter->lint();
         $penalty = $linter->penalty();
         $stats = array($_, $linter->score());
         if ($this->config->check(OPT_REPORT)) {
             if ($_[0] !== '/') {
                 $href = preg_match('/^\\.\\//u', $_) ? $_ : "./{$_}";
             } else {
                 $href = $_;
             }
             $penaltys[$href] = $penalty;
             $reports[$href] = $report;
         }
         if ($this->config->check(OPT_HARVEST_DOCS)) {
             $penaltys[$_] = $penalty;
             $nodes[] = $linter->nodes();
         }
         $this->penalty += $penalty;
         $this->msg($this->reporter->score($penalty));
         if ($this->config->check(OPT_DEBUG_TIME_EXTRA)) {
             $x = microtime(true) - $time;
             $stats[] = $x;
             $this->msg("Time for file: {$x} seconds\n");
         }
         $this->stats[] = $stats;
     }
     if ($this->config->check(OPT_HARVEST_DOCS)) {
         $reporter = new Report\Harvest($this->config);
         $reporter->create($nodes, $penaltys, $this->target);
     }
     $this->reporter->create($reports, $penaltys, $this->target);
     $cnt = count($this->stats);
     $this->msg("{$cnt} files, ", 0);
     $this->msg($this->reporter->average($this->penalty, $numfiles), 0);
     $arr = array();
     foreach ($this->stats as $_) {
         $arr[] = $_[1];
     }
     array_multisort($this->stats, SORT_NUMERIC, $arr);
     $this->msg("Worst: {$this->stats[0][0]} with {$this->stats[0][1]}\n", 0);
     if ($this->config->check(OPT_DEBUG_TIME_EXTRA)) {
         $arr = array();
         foreach ($this->stats as $_) {
             $arr[] = $_[2];
         }
         $avg = array_sum($arr) / $cnt;
         echo "Avarage time per file: {$avg} seconds\n";
     }
 }
开发者ID:robotis,项目名称:PHPLinter,代码行数:76,代码来源:CLI.php

示例4: find

 public function find($path)
 {
     if (is_string($path)) {
         $path = new Path($path);
     }
     return $path->find($this);
 }
开发者ID:makinacorpus,项目名称:drupal-usync,代码行数:7,代码来源:Node.php


注:本文中的Path::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。