Symfony\Component\Finder\Finder::exclude PHP Method

exclude() public method

Excludes directories.
See also: ExcludeDirectoryFilterIterator
public exclude ( string | array $dirs ) : Finder | Symfony\Component\Finder\SplFileInfo[]
$dirs string | array A directory path or an array of directories
return Finder | Symfony\Component\Finder\SplFileInfo[] The current Finder instance
    public function exclude($dirs)
    {
        $this->exclude = array_merge($this->exclude, (array) $dirs);

        return $this;
    }

Usage Example

コード例 #1
0
ファイル: FileFinderBuilder.php プロジェクト: suralc/pvra
 /**
  * @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;
 }
All Usage Examples Of Symfony\Component\Finder\Finder::exclude