Tells whether a file exists and is readable.
@from Symfony-filesystem
@param string $filename Path to the file
@return bool
@throws IOException When windows path is longer than 258 characters
332639
public static function isReadable(string $filename): bool
    {
        if ('\\' === DIRECTORY_SEPARATOR && \strlen($filename) > 258) {
            throw new IOException('Could not check if file is readable because path length exceeds 258 characters.');
        }

        return is_readable($filename);
    }
146343
function isFile( $filename = false )
    {
        if ( !$filename )
            $filename = $this->FileName;
        return $this->doIsFile( $filename );
    }
1155391
private function hasValidExtension($filename)
    {
        // Current extension
        $extension = mb_strtolower(pathinfo($filename, \PATHINFO_EXTENSION), 'UTF-8');

        // Make sure all extensions are in lowercase
        foreach ($this->extensions as &$expected) {
            $expected = mb_strtolower($expected, 'UTF-8');
        }

        return in_array($extension, $this->extensions);
	}
555361
public static function delete($filename)
    {
        if (is_string($filename) && file_exists($filename)) {
            unlink($filename);
            return true;
        }

        return false;
    }
88959
public function getFileContent($fileName)
    {
        $Location = array_search($fileName, $this->files, true);
        if (!isset($this->filesData[$fileName])) return false;
        $data = $this->filesData[$fileName];
        $Location_Real = $Location * $this->blockSize;
        if ($this->iso->Seek($Location_Real, SEEK_SET) === false)
            return false;

        return $this->iso->Read($data['size']);
    }
1294598
public function isStackable($filename)
    {
        try {
            $file = $this->matcher->getFile($filename);
        } catch (FileNotFoundException $e) {
            return false;
        }

        if (!in_array($file->getExtension(), $this->acceptedFileTypes)) {
            return false;
        }

        return !$this->contains($file);
    }
706805
private static function _isReadable($filename)
    {
        if (!$fh = @fopen($filename, 'r', true)) {
            return false;
        }
        @fclose($fh);
        return true;
    }
71671
protected function checkFileName($fileName)
    {
        $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));

        $allow = $this->getWhitelistedExtensions();
        $block = $this->getBlacklistedExtensions();

        return  (   (false === $allow || in_array($extension, $allow))
                &&  (false === $block || ! in_array($extension, $block))
                );
    }
383375
private function readFile($fileName) {
        try {
            $data = file_get_contents($fileName, false);
        }
        catch (PHPError $ex) {
            if (strEndsWith($ex->getMessage(), 'failed to open stream: No such file or directory'))
                return null;
            throw $ex;
        }

        if ($data === false)
            throw new RuntimeException('file_get_contents() returned FALSE, $fileName: "'.$fileName);

        return unserialize($data);
    }
661851
public function contains($filename)
    {
        $this->initialize();

        try {
            $file = $this->matcher->getFile($filename);
        } catch (FileNotFoundException $e) {
            return false;
        }

        foreach ($this->files as $item) {
            if ($item->getFullPath() === $file->getFullPath()) {
                return true;
            }
        }

        return false;
    }
1289788
public function fileExists($fileName, $storageName = '')
    {
        //check whether file is set or not
        if ($fileName == '') {
            AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
            throw new Exception(Exception::MSG_NO_FILENAME);
        }

        //build URI
        $strURI = $this->strURIExist . $fileName;
        if ($storageName != '') {
            $strURI .= '?storage=' . $storageName;
        }
        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = json_decode(Utils::processCommand($signedURI, 'GET', '', ''));
        if (!$responseStream->FileExist->IsExist) {
            return FALSE;
        }
        return TRUE;
    }
138476
private function createFileDirIfNotExists(string $filename): bool
    {
        $pathinfo = pathinfo($filename);
        if (isset($pathinfo['dirname']) && $pathinfo['dirname'] !== '.') {
            if (is_dir($pathinfo['dirname'])) {
                return true;
            } elseif (is_file($pathinfo['dirname'])) {
                return false;
            } else {
                return $this->createDirIfNotExists($pathinfo['dirname']);
            }
        }
        return false;
    }
140557
private function isEnvironmentFilename(string $filename): bool
    {
        $filenameEnding = substr($filename, strpos($filename, '.'));
        foreach ($this->environments as $environment) {
            if ($filenameEnding === '.' . $environment . '.php') {
                return true;
            }
        }
        return false;
    }
193093
public static function isGifFile($filename)
    {
        try {
            $image = new ImageFile($filename);
            if (strtolower($image->getMime()) !== @image_type_to_mime_type(IMAGETYPE_GIF)) {
                return false;
            }

            return true;
        } catch (\RuntimeException $ex) {
            return false;
        }
    }
1096781
function read($filename){
		$filename = md5($filename);
		$filepath = $this->getConfig('cache_path').$filename.'.tmp';
		
		if(!file_exists($filepath)){
			return FALSE;
		}
		
		if ( ! $fp = @fopen($filepath, 'r')){
			return FALSE;
		}
		flock($fp, LOCK_SH);

		$cache = '';
		if (filesize($filepath) > 0)
		{
			$cache = fread($fp, filesize($filepath));
		}

		flock($fp, LOCK_UN);
		fclose($fp);

		// Strip out the embedded timestamp
		if ( ! preg_match("/(\d+T_SKY-->)/", $cache, $match))
		{
			return FALSE;
		}
		// Has the file expired? If so we'll delete it.
		if (time() >= trim(str_replace('TS--->', '', $match['1'])))
		{
			if (is_writable($filepath))
			{
				@unlink($filepath);
				return FALSE;
			}
		}

		// Display the cache
		return str_replace($match['0'], '', $cache);
	}
1006203
public static function isVcsFile($fileName)
    {
        foreach (self::$vcsPatterns as $pattern) {
            if (strpos($fileName, $pattern) !== false) {
                return true;
            }
        }
        return false;
    }
276432
public function setFileName($fileName = null) {
		if (empty($fileName)) {
			return false;
		}

		$this->_fileName = (string)$fileName;

		return true;
	}