Symfony\Component\Finder\Finder::ignoreDotFiles PHP Method

ignoreDotFiles() public method

Excludes "hidden" directories and files (starting with a dot).
See also: ExcludeDirectoryFilterIterator
public ignoreDotFiles ( boolean $ignoreDotFiles ) : Finder | Symfony\Component\Finder\SplFileInfo[]
$ignoreDotFiles boolean Whether to exclude "hidden" files or not
return Finder | Symfony\Component\Finder\SplFileInfo[] The current Finder instance
    public function ignoreDotFiles($ignoreDotFiles)
    {
        if ($ignoreDotFiles) {
            $this->ignore |= static::IGNORE_DOT_FILES;
        } else {
            $this->ignore &= ~static::IGNORE_DOT_FILES;
        }

        return $this;
    }

Usage Example

コード例 #1
0
 /**
  * @return Finder
  */
 protected function getSpool()
 {
     $filesystem = new Filesystem();
     $finder = new Finder();
     if ($filesystem->exists($this->spoolDir)) {
         $spool = $finder->ignoreDotFiles(true)->in($this->spoolDir)->files();
         return $spool;
     }
     throw new \RuntimeException("Spool not found or empty: " . $this->spoolDir);
 }
All Usage Examples Of Symfony\Component\Finder\Finder::ignoreDotFiles