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


PHP RecursiveDirectoryIterator::setInfoClass方法代码示例

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


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

示例1: from

 /**
  * Create Pages object instance from path
  *
  * @param string $path
  * @param array|callable $filter
  * @param string $class
  * @return \cms\Pages
  */
 public static function from($path, $filter = ['index', '404'], $class = Page::class)
 {
     $iterator = new \RecursiveDirectoryIterator(realpath($path), \RecursiveDirectoryIterator::SKIP_DOTS);
     if (class_exists($class)) {
         $iterator->setInfoClass($class);
     }
     $filter = is_callable($filter) ? $filter : function (Page $item) use($filter) {
         return $item->isValid((array) $filter);
     };
     return new self(new \RecursiveCallbackFilterIterator($iterator, $filter));
 }
开发者ID:austinvernsonger,项目名称:cms,代码行数:19,代码来源:Pages.php

示例2: __construct

 public function __construct(array $sources)
 {
     foreach ($sources as $source) {
         if ($source instanceof \SplFileInfo) {
             $this->children[] = $source;
         } elseif (is_string($source) && ($source = realpath($source))) {
             if (is_file($source)) {
                 $child = new SourceFileInfo($source);
                 $child->setInfoClass(SourceFileInfo::class);
                 $this->children[] = $child;
             } elseif (is_dir($source)) {
                 $child = new \RecursiveDirectoryIterator($source);
                 $child->setInfoClass(SourceFileInfo::class);
                 $this->children[] = $child;
             }
         }
     }
 }
开发者ID:clockworkgeek,项目名称:magei18n,代码行数:18,代码来源:RecursiveSourcesIterator.php

示例3: createIterator

 /**
  *  create an iterator to iterate through the children
  *  
  *  @since  6-23-11   
  *  @param  string  $regex
  *  @param  integer $depth
  *  @return \Traversable
  */
 public function createIterator($regex = '', $depth = -1)
 {
     $depth = (int) $depth;
     $iterator = null;
     if ($this->isDir()) {
         if ($depth < 0 || $depth > 1) {
             $iterator = new RecursiveDirectoryIterator($this->getPathname(), FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::SKIP_DOTS);
             $iterator->setInfoClass(get_class($this));
             $iterator = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST);
             $iterator->setMaxDepth($depth);
         } else {
             $iterator = new FilesystemIterator($this->getPathname(), FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::SKIP_DOTS);
             $iterator->setInfoClass(get_class($this));
         }
         //if/else
     } else {
         $iterator = $this->openFile();
         $iterator->setFlags(\SplFileObject::DROP_NEW_LINE | \SplFileObject::SKIP_EMPTY);
     }
     //if/else
     if (!empty($regex)) {
         $iterator = new RegexIterator($iterator, $regex, RegexIterator::MATCH);
     }
     //if/else
     return $iterator;
 }
开发者ID:Jaymon,项目名称:Montage,代码行数:34,代码来源:Path.php

示例4: createRecursiveDirectoryIterator

 /**
  * Создаёт объект RecursiveDirectoryIterator для текущей директории.
  *
  * @return RecursiveDirectoryIterator
  */
 public function createRecursiveDirectoryIterator($flags = null)
 {
     if (isset($flags)) {
         $iterator = new \RecursiveDirectoryIterator($this->getRealPath(), $flags);
     } else {
         $iterator = new \RecursiveDirectoryIterator($this->getRealPath());
     }
     $iterator->setFileClass('Stalxed\\FileSystem\\FileObject');
     $iterator->setInfoClass('Stalxed\\FileSystem\\FileInfo');
     return $iterator;
 }
开发者ID:stalxed,项目名称:filesystem,代码行数:16,代码来源:DirectoryObject.php


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