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


PHP Finder::size方法代码示例

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


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

示例1: withFilters

 /**
  * @param array $filters
  * @return $this
  */
 public function withFilters(array $filters)
 {
     if (!empty($filters)) {
         foreach ($filters as $currentFilter) {
             if (!strpos($currentFilter, ':')) {
                 throw new \InvalidArgumentException(sprintf('The filter "%s" is not a valid filter. A valid filter has the format <name>:<value>.', $currentFilter));
             }
             $currentFilterElements = explode(':', $currentFilter, 2);
             switch (trim($currentFilterElements[0])) {
                 case 'exclude':
                     $this->finder->exclude($currentFilterElements[1]);
                     break;
                 case 'name':
                     $this->finder->name($currentFilterElements[1]);
                     break;
                 case 'notName':
                     $this->finder->notName($currentFilterElements[1]);
                     break;
                 case 'path':
                     $this->finder->path($currentFilterElements[1]);
                     break;
                 case 'size':
                     $this->finder->size($currentFilterElements[1]);
             }
         }
     }
     return $this;
 }
开发者ID:suralc,项目名称:pvra,代码行数:32,代码来源:FileFinderBuilder.php

示例2: index

 public function index()
 {
     /*
     |--------------------------------------------------------------------------
     | Paramers
     |--------------------------------------------------------------------------
     |
     | Match overrides Extension. Exclusion applies in both cases.
     |
     */
     $match = $this->fetchParam('match', false);
     $exclude = $this->fetchParam('exclude', false);
     $extension = $this->fetchParam('extension', false);
     $in = $this->fetchParam('in', false);
     $not_in = $this->fetchParam('not_in', false);
     $file_size = $this->fetchParam('file_size', false);
     $file_date = $this->fetchParam('file_date', false);
     $depth = $this->fetchParam('depth', false);
     if ($file_size) {
         $file_size = Helper::explodeOptions($file_size);
     }
     if ($extension) {
         $extension = Helper::explodeOptions($extension);
     }
     /*
     |--------------------------------------------------------------------------
     | Finder
     |--------------------------------------------------------------------------
     |
     | Get_Files implements most of the Symfony Finder component as a clean
     | tag wrapper mapped to matched filenames.
     |
     */
     $finder = new Finder();
     $finder->in($in);
     // Finder doesn't respect multiple glob options,
     // so this will need to wait until later.
     //
     // $match = str_replace('{{', '{', $match);
     // $match = str_replace('}}', '}', $match);
     /*
     |--------------------------------------------------------------------------
     | Name
     |--------------------------------------------------------------------------
     |
     | Match is the "native" Finder name() method, which is supposed to
     | implement string, glob, and regex. The glob support is only partial,
     | so "extension" is a looped *single* glob rule iterator.
     |
     */
     if ($match) {
         $finder->name($match);
     } elseif ($extension) {
         foreach ($extension as $ext) {
             $finder->name("*.{$ext}");
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Exclude
     |--------------------------------------------------------------------------
     |
     | Exclude directories from matching. Remapped to "not in" to allow more
     | intuitive differentiation between filename and directory matching.
     |
     */
     if ($not_in) {
         $finder->exclude($not_in);
     }
     /*
     |--------------------------------------------------------------------------
     | Not Name
     |--------------------------------------------------------------------------
     |
     | Exclude files matching a given pattern: string, regex, or glob.
     |
     */
     if ($exclude) {
         $finder->notName($exclude);
     }
     /*
     |--------------------------------------------------------------------------
     | File Size
     |--------------------------------------------------------------------------
     |
     | Restrict files by size. Can be chained and allows comparison operators.
     |
     */
     if ($file_size) {
         foreach ($file_size as $size) {
             $finder->size($size);
         }
     }
     /*
     |--------------------------------------------------------------------------
     | File Date
     |--------------------------------------------------------------------------
     |
     | Restrict files by last modified date. Can use comparison operators, and
     | since/after is aliased to >, and until/before to <.
//.........这里部分代码省略.........
开发者ID:nob,项目名称:joi,代码行数:101,代码来源:pi.get_files.php

示例3: index

 public function index()
 {
     /*
     |--------------------------------------------------------------------------
     | Paramers
     |--------------------------------------------------------------------------
     |
     | Match overrides Extension. Exclusion applies in both cases.
     |
     */
     $match = $this->fetchParam('match', false);
     $exclude = $this->fetchParam('exclude', false);
     $extension = $this->fetchParam(array('extension', 'type'), false);
     $in = $this->fetchParam(array('in', 'folder', 'from'), false);
     $not_in = $this->fetchParam('not_in', false);
     $file_size = $this->fetchParam('file_size', false);
     $file_date = $this->fetchParam('file_date', false);
     $depth = $this->fetchParam('depth', false);
     $sort_by = $this->fetchParam(array('sort_by', 'order_by'), false);
     $sort_dir = $this->fetchParam(array('sort_dir', 'sort_direction'), 'asc');
     $limit = $this->fetchParam('limit', false);
     if ($in) {
         $in = Helper::explodeOptions($in);
     }
     if ($not_in) {
         $not_in = Helper::explodeOptions($not_in);
     }
     if ($file_size) {
         $file_size = Helper::explodeOptions($file_size);
     }
     if ($extension) {
         $extension = Helper::explodeOptions($extension);
     }
     /*
     |--------------------------------------------------------------------------
     | Finder
     |--------------------------------------------------------------------------
     |
     | Get_Files implements most of the Symfony Finder component as a clean
     | tag wrapper mapped to matched filenames.
     |
     */
     $finder = new Finder();
     if ($in) {
         foreach ($in as $location) {
             $finder->in(Path::fromAsset($location));
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Name
     |--------------------------------------------------------------------------
     |
     | Match is the "native" Finder name() method, which is supposed to
     | implement string, glob, and regex. The glob support is only partial,
     | so "extension" is a looped *single* glob rule iterator.
     |
     */
     if ($match) {
         $finder->name($match);
     } elseif ($extension) {
         foreach ($extension as $ext) {
             $finder->name("*.{$ext}");
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Exclude
     |--------------------------------------------------------------------------
     |
     | Exclude directories from matching. Remapped to "not in" to allow more
     | intuitive differentiation between filename and directory matching.
     |
     */
     if ($not_in) {
         foreach ($not_in as $location) {
             $finder->exclude($location);
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Not Name
     |--------------------------------------------------------------------------
     |
     | Exclude files matching a given pattern: string, regex, or glob.
     | By default we don't allow looking for PHP files. Be smart.
     |
     */
     if ($this->fetchParam('allow_php', false) !== TRUE) {
         $finder->notName("*.php");
     }
     if ($exclude) {
         $finder->notName($exclude);
     }
     /*
     |--------------------------------------------------------------------------
     | File Size
     |--------------------------------------------------------------------------
     |
     | Restrict files by size. Can be chained and allows comparison operators.
//.........这里部分代码省略.........
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:101,代码来源:pi.get_files.php

示例4: createFinder

 /**
  * @param  InputInterface $input
  * @return Finder
  */
 public function createFinder(InputInterface $input)
 {
     $finder = new Finder();
     $finder->files();
     foreach ($input->getArgument('directory') as $dir) {
         $finder->in($dir);
     }
     foreach ($input->getOption('not-dir') as $ignoreDir) {
         $finder->exclude($ignoreDir);
     }
     foreach ($input->getOption('file-name') as $pattern) {
         $finder->name($pattern);
     }
     foreach ($input->getOption('not-file-name') as $pattern) {
         $finder->notName($pattern);
     }
     foreach ($input->getOption('contains') as $pattern) {
         $finder->contains($pattern);
     }
     foreach ($input->getOption('not-contains') as $pattern) {
         $finder->notContains($pattern);
     }
     foreach ($input->getOption('path') as $pattern) {
         $finder->path($pattern);
     }
     foreach ($input->getOption('not-path') as $pattern) {
         $finder->notPath($pattern);
     }
     if ($size = $input->getOption('size')) {
         $finder->size($size);
     }
     if ($modified = $input->getOption('modified')) {
         $finder->date($modified);
     }
     if ($depth = $input->getOption('depth')) {
         $finder->depth($depth);
     }
     return $finder;
 }
开发者ID:hanneskod,项目名称:phpfind,代码行数:43,代码来源:Command.php

示例5: _parseIterator

 /**
  * @param \DOMNode $node
  * @return \Iterator|null
  */
 protected function _parseIterator(DOMNode $node)
 {
     $finder = new Finder();
     $finder->files();
     foreach ($node->childNodes as $option) {
         if ($option->nodeType === XML_ELEMENT_NODE) {
             $nodeName = strtolower($option->nodeName);
             $value = $option->nodeValue;
             switch ($nodeName) {
                 case 'name':
                     $finder->name($value);
                     break;
                 case 'notname':
                     $finder->notName($value);
                     break;
                 case 'path':
                     $finder->in($value);
                     break;
                 case 'size':
                     $finder->size($value);
                     break;
                 case 'exclude':
                     $finder->exclude($value);
                     break;
             }
         }
     }
     return $finder->getIterator();
 }
开发者ID:robo47,项目名称:php-manipulator,代码行数:33,代码来源:Xml.php

示例6: size

 /**
  * @return Finder
  */
 public function size($size)
 {
     return parent::size($size);
 }
开发者ID:stopsopa,项目名称:utils,代码行数:7,代码来源:Finder.php


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