Symfony\Component\Finder\Finder::notName PHP Method

notName() public method

Adds rules that files must not match.
See also: FilenameFilterIterator
public notName ( string $pattern ) : Finder | Symfony\Component\Finder\SplFileInfo[]
$pattern string A pattern (a regexp, a glob, or a string)
return Finder | Symfony\Component\Finder\SplFileInfo[] The current Finder instance
    public function notName($pattern)
    {
        $this->notNames[] = $pattern;

        return $this;
    }

Usage Example

コード例 #1
0
ファイル: FinderFacade.php プロジェクト: sakshika/ATM
 /**
  * @return array
  */
 public function findFiles()
 {
     $files = array();
     $finder = new Finder();
     $iterate = false;
     $finder->ignoreUnreadableDirs();
     foreach ($this->items as $item) {
         if (!is_file($item)) {
             $finder->in($item);
             $iterate = true;
         } else {
             $files[] = realpath($item);
         }
     }
     foreach ($this->excludes as $exclude) {
         $finder->exclude($exclude);
     }
     foreach ($this->names as $name) {
         $finder->name($name);
     }
     foreach ($this->notNames as $notName) {
         $finder->notName($notName);
     }
     foreach ($this->regularExpressionsExcludes as $regularExpressionExclude) {
         $finder->notPath($regularExpressionExclude);
     }
     if ($iterate) {
         foreach ($finder as $file) {
             $files[] = $file->getRealpath();
         }
     }
     return $files;
 }
All Usage Examples Of Symfony\Component\Finder\Finder::notName