Check whether the given file should be included in the final Filelist

@param SplFileInfo $file

@return boolean
197779
public function filter(SplFileInfo $file)
    {
        try {
            $class = $this->getClassName($file->getPathname());
        } catch (Exception $e){
            return false;
        }

        $usedtraits = class_uses($class, $this->useautoload);

        foreach ($this->instances as $instance) {
            if (in_array($instance, $usedtraits)) {
                return true;
            }
        }

        return false;
    }
100410
private function classForFile(SplFileInfo $file): string
    {
        $subnamespace = str_replace('/', '\\', $file->getRelativePath());
        if (!empty($subnamespace)) {
            $subnamespace .= '\\';
        }
        $class = $this->namespace.'\\'.$subnamespace.$file->getBasename('.php');

        return $class;
    }
219059
public function fixFile(SplFileInfo $file)
    {
        $filePath = $file->getRealPath();

        $image = $this->imagine->open($file->getRealPath());

        $image = $this->fixImage($filePath, $image);
        $image->save();

        return true;
    }
197861
private function getFileContents(SplFileInfo $file)
    {
        $content = $file->getContents();
        if ($file->getExtension() === 'js' && substr($content, -1) !== ';') {
            $content .= ';';
        }

        return $content;
    }
885194
private function checkFile(SplFileInfo $file)
    {
        $tokens = token_get_all($file->getContents());
        $licenseTokenIndex = $this->getLicenseTokenIndex($tokens);

        if ($licenseTokenIndex === null) {
            $this->log(sprintf('Missing license header in "%s"', $file->getRealPath()));
        } elseif ($tokens[$licenseTokenIndex][1] != $this->getLicenseAsComment()) {
            $this->log(sprintf('Different license header in "%s"', $file->getRealPath()));
        }
    }
123405
protected function mapFileInfo(SplFileInfo $file)
    {
        $normalized = [
            'type' => $file->getType(),
            'path' => $this->getFilePath($file),
        ];

        $normalized['timestamp'] = $file->getMTime();

        if ($normalized['type'] === 'file') {
            $normalized['size'] = $file->getSize();
        }

        return $normalized;
    }
581053
public function clean(SplFileInfo $file)
    {
        $name = $file->getFilename();
        if ($file->isFile()) {
            $name = pathinfo($name, PATHINFO_FILENAME);
        }

        $name = str_replace("\t\n\r\0\x0B", ' ', $name); // remove control characters
        $name = str_replace('_', ' ', $name);

        $name = preg_replace('/\[[^\[\]]*\]/', ' ', $name); // remove [...]
        $name = preg_replace('/\([^\(\)]*\)/', ' ', $name); // remove (...)

        // remove all file meta data
        $reg = sprintf('/[ .,](?:%s)[ .,]/i', implode('|', $this->meta));
        while (preg_match($reg, $name.' ')) {
            $name = preg_replace($reg, ' ', $name.' ');
        }

        $name = str_replace('  ', ' ', $name); // remove double spaces
        $name = trim($name, ' .,-');

        return $name;
    }
982262
private function getFilenameFromFile(SplFileInfo $file) : string
    {
        return substr($file->getRelativePathname(), 0, -(strlen($this->fileExtension) + 1));
    }
59748
protected function _filterFile(SplFileInfo $fileInfo)
    {
        if (!$fileInfo->isFile()) {
            return false;
        }

        if (($expr = $this->_getFilenameRegex()) && !preg_match($expr, $fileInfo->getPathname())) {
            return false;
        }

        if (($callback = $this->_getCallbackFilter()) && !call_user_func_array($callback, array($fileInfo))) {
            return false;
        }

        return true;
    }
408751
private function getClassFullNameFromFile(SplFileInfo $file)
    {
        $targets = [
            realpath($this->namespaceDirectory).'/',
            '.php',
        ];

        $replaceValues = ['', ''];

        $className = str_replace($targets, $replaceValues, realpath($file->getPathname()));
        $className = str_replace('/', "\\", $className);

        return $this->namespace."\\".$className;
    }
1174627
public function filter(\SplFileInfo $file)
    {
        try {
            $class = $this->getClassName($file->getPathname());
        } catch (\Exception $e){
            return false;
        }

        if (! @include_once($file->getPathname())) {
            return false;
        }

        $ReflectionClass = new \ReflectionClass($class);

        foreach ($this->instances as $instance) {
            if ($ReflectionClass->isSubclassOf($instance)) {
                return true;
            }

            if ($class === $instance) {
                return true;
            }
        }

        return false;
    }
997005
public function filter(\SplFileInfo $file)
    {
        $filedate = new \DateTime('@' . $file->{'get' . $this->compareType}());

        $diff = $this->compareDate->diff($filedate);
        $diffSign = $diff->format('%R');

        if ((int) $diff->format('%y%m%d%h%i%s') == 0 && $this->compareAction == self::CHECK_EQUAL) {
            return true;
        }
        if ($diffSign == '-' && $this->compareAction == self::CHECK_BEFORE) {
            return true;
        }
        if ($diffSign == '+' && $this->compareAction == self::CHECK_AFTER) {
            return true;
        }

        return false;
    }
647888
public function fileMime($file, $rule)
    {
        if (!($file instanceof SplFileObject)) {
            return false;
        }

        return $this->checkMime($file, $rule);
    }
500949
protected function checkFile(SplFileInfo $file, $force) {
        $scssPath = $file->getPathname();
        $scssMod = $file->getMTime();
        $scssName = preg_replace('/^.+(\/|\\\\)([^\/\\\\]+)$/', '\\2', $scssPath);

        // don't compile `_`-prefixed system files
        if (substr($scssName, 0, 1) === '_') {
            $this->sysMod = max($this->sysMod, $scssMod);
            return;
        }

        $cssPath = preg_replace('/(\.|\/|\\\\)scss($|\/|\\\\)/', '\\1css\\2', $scssPath);
        $cssMod = is_file($cssPath) ? filemtime($cssPath) : 0;
        $this->oldestMod = min($this->oldestMod, $cssMod);

        $isModified = $scssMod - $cssMod > 0 ? true : false;

        if ($isModified || $force) {
            $this->generateCss($scssPath, $cssPath);
        }
        
        // Possibly imported mixin/sys file changed, update all CSS files
        if (!$force && $this->sysMod > $this->oldestMod) {
            $this->checkFiles(true);
            $this->oldestMod = $this->sysMod;
        }        
    }
86430
function shouldBeIncluded(file) {

  if (!showAllFiles && file[0] === '.') {
    return false
  }
  if (hasExcludePattern) {
    return !excludePattern.test(file)
  }
  if (hasIncludePattern) {
    return includePattern.test(file)
  }
  return true
}
786024
private function validateFile(\SplFileInfo $file)
    {
        if (!$file->isReadable()) {
            throw new InvalidConfigurationException('Configuration file is not readable');
        }
        $validExtensions = $this->configFileExtensions();
        if (!in_array($file->getExtension(), $validExtensions, true)) {
            throw new InvalidConfigurationException('Invalid configuration file type provided');
        }
    }
136124
private function doesFileChecksFailed(string $file): bool
    {
        //check if file exist
        if (!\file_exists($file)) {
            return true;
        }

        //take cache from file
        $cacheValue = include $file;

        //check if cache is expired and delete file from storage
        if ($cacheValue['expires'] <= \time() && $cacheValue['expires'] !== 0) {
            \unlink($file);

            return true;
        }

        return false;
    }