Determine if a file is to be ignored.

@param string $file filename

@return bool
519935
public function fileIsIgnored($file)
    {
        $line = $this->ignoreFile[0];
        $mode = 'regexp';
        $ignored = false;
        if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)
            || $matches[1] === 'glob'
        ) {
            $mode = 'glob';
        }
        if ($mode === 'glob') {
            $ignored = $this->ignoredByGlob($file);
        } elseif ($mode === 'regexp') {
            $ignored = $this->ignoredByRegex($file);
        }
        return $ignored;
    }
182733
public function save(string $file): bool
    {
        $stat = file_put_contents($file, $this->definition->toFbp());

        if ($stat === false) {
            return false;
        }

        return true;
    }
365506
private function shouldSkipFile(File $file): bool
    {
        if (Strings::contains($file->getFilename(), '/tests/')
            && ! Strings::contains($file->getFilename(), 'CodingStandard/tests/')
        ) {
            return true;
        }

        $classWrapper = $this->sniffClassWrapperFactory->createFromFirstClassInFile($file);
        if ($classWrapper === null) {
            return true;
        }

        return $classWrapper->implementsInterface() || $classWrapper->extends();
    }
1279312
public function isImage($file){
        $ext = $file->getExtension();
        if(in_array(strtolower($ext), $this->config["images"]["images_ext"] ) )
            return true;
        else
            return false;
    }
1114309
public static function getFileMimeType($file)
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        if ($finfo) {
            $mime_type = finfo_file($finfo, $file);
            finfo_close($finfo);
            return $mime_type;
        }
        return false;
    }
1133719
public function ensureDefaultFormat($file)
	{
		if ( ! pathinfo($file, PATHINFO_EXTENSION))
		{
			$file .= '.'.$this->defaultFormat;
		}

		return empty($this->configFolder) ? $file : $this->configFolder.DIRECTORY_SEPARATOR.$file;
	}
817475
protected function isConfig($file)
    {
        if (basename($file) === 'config.php' && is_file($file) && is_readable($file)) {
            $contents = file_get_contents($file);

            if ($contents && strpos($contents, 'txpcfg') !== false && file_exists(dirname($file) . '/publish.php')) {
                return dirname($file);
            }
        }

        return false;
    }
982225
public static function clear($file = false) {

        if ($file && self::isFile($file)) {

            $f = @fopen($file, "r+");
            if ($f !== false) {
                ftruncate($f, 0);
                fclose($f);

                return true;
            }
        }

        return false;
    }
187876
protected function isValidFile($file)
    {
        if (!is_file($file) || !is_readable($file)) {
            throw new \InvalidArgumentException(sprintf(
                    'File "%s" Is Not Readable', (string) $file
            ));
        }
    }
992656
public function has($file)
    {
        if (($isArray = is_array($file)) || $file instanceof Traversable) {
            foreach ($file as $key => $f) {
                try {
                    if ( ! $this->has($f)) {
                        return false;
                    }
                }
                catch (InvalidArgumentException $e) {
                    throw new UnexpectedValueException(
                        sprintf(
                            "%s's value at key %s caused InvalidArgumentException",
                            $isArray ? 'Array' : 'FileBag',
                            $key
                        ),
                        null,
                        $e
                    );
                }
                catch (UnexpectedValueException $e) {
                    throw new UnexpectedValueException(
                        sprintf(
                            "%s's value at key %s caused UnexpectedValueException",
                            $isArray ? 'Array' : 'FileBag',
                            $key
                        ),
                        null,
                        $e
                    );
                }
            }
        }
        elseif ($file instanceof SplFileInfo
            || $file instanceof File
        ) {
            return $this->files->contains($file);
        }
        else {
            throw InvalidArgumentException::create(
                sprintf(
                    '%1$s/File|%1$s/File[]|%1$s/FileBag',
                    __NAMESPACE__
                ),
                $file
            );
        }

        return true;
    }
429907
public static function remove(string $file = ''): bool
    {
        $file = static::normalizePath($file);
        if (static::exists($file)) {
            return @\unlink($file);
        }
        return false;
    }
909277
public static function isImage($file)
    {
        if (!$v = getimagesize($file)) {
            return false;
        }
        return in_array($v[2], [IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP]);
    }
1214751
private function _remove($file)
    {
        if (!@unlink($file)) {
            # If we can't remove the file (because of locks or any problem), we will touch
            # the file to invalidate it
            $this->_log("Zend_Cache_Backend_ZendPlatform::_remove() : we can't remove $file => we are going to try to invalidate it");
            if ($this->_directives['lifetime'] === null) {
                return false;
            }
            if (!file_exists($file)) {
                return false;
            }
            return @touch($file, time() - 2*abs($this->_directives['lifetime']));
        }
        return true;
    }
219894
protected function isImageFile($file)
    {
        if( in_array(MimeTypeFinder::get($file), $this->validMimes) )
        {
            return true;
        }
        else
        {
            return false;
        }
    }
968466
protected function parse_file($file = null) {
        if (is_null($file)) {
            $file = $this->file;
        }

        if (empty($this->file_data)) {
            $this->load_data($file);
        }

        return !empty($this->file_data) ? $this->parse_string() : false;
    }
123616
public function isExcluded($exclusions, $path, $file = '')
    {
        if ($file) {
            if (!$file instanceof SplFileInfo) {
                $path = make_path([$path, $file]);
            } else {
                $path = $file->getPathname();
            }
        }

        foreach ($exclusions ?: [] as $excluded) {
            if (starts_with($path, $excluded)) {
                return true;
            }
        }

        return false;
    }
1035214
public function removeFromLibrary(File $file)
    {
        if(!$this->containsFile($file)){
            return false;
        }
        if($this->whitelistContainsFile($file)){
            $this->removeFromWhitelist($file);
        }
        $file->delete();
        return !$this->containsFile($file);
    }