Check if a cache file exists.
@param  string $path   Image path.
@param  array  $params Image manipulation params.
@return bool   Whether the cache file exists.
187148
public function cacheFileExists($path, array $params)
    {
        return $this->cache->has(
            $this->getCachePath($path, $params)
        );
    }
1253453
protected function isWithinFilesystem($path)
    {
        $pathUrl = new Url($path);
        $fsUrl = $this->filesystem->url();

        if (!$pathUrl->scheme) {
            $pathUrl = $pathUrl->scheme('file');
        }

        if (!$fsUrl->scheme) {
            $fsUrl = $fsUrl->scheme('file');
        }

        if ($pathUrl->scheme != $fsUrl->scheme) {
            return false;
        }

        if (Helper::startsWith("$pathUrl->path", "$fsUrl->path")) {
            return true;
        }

        return $this->filesystem->exists($path);
    }
44421
private function isCacheUpToDate(&$path, $input = null)
    {
        if (!$input) {
            $compiler = $this->getRenderer()->getCompiler();
            $input = $compiler->resolve($path);
            $path = $this->getCachePath(
                ($this->getOption('keep_base_name') ? basename($path) : '').
                $this->hashPrint($input)
            );

            // If up_to_date_check never refresh the cache
            if (!$this->getOption('up_to_date_check')) {
                return true;
            }

            // If there is no cache file, create it
            if (!file_exists($path)) {
                return false;
            }

            // Else check the main input path and all imported paths in the template
            return !$this->hasExpiredImport($input, $path);
        }

        $path = $this->getCachePath($this->hashPrint($input));

        // Do not re-parse file if the same hash exists
        return file_exists($path);
    }
1198902
public function has(string $path)
    {
        $path = Util::normalizePath($path);

        return $path === '' ? false : (bool) $this->adapter->has($path);
    }
504666
private function isFolderExists($path)
    {
        return $this->filesystem->exists($path) && $this->filesystem->isDirectory($path);
    }
609107
public function hasDir($path)
    {
        $meta = $this->getMetadata($path);
        return ($meta && isset($meta['hasdir'])) ? $meta : [
            'hasdir' => true
        ];
    }
775516
public function isNeedRecompile(string $cache, string $path): bool
    {
        switch ($this->mode) {
            case LoaderMode::RECOMPILE_ALWAYS:
                return true;

            case LoaderMode::RECOMPILE_NEVER:
                return !file_exists($cache);

            case LoaderMode::RECOMPILE_NORMAL:
            default:
                return !file_exists($cache) || filemtime($cache) < $this->finder->lastModified($path);
        }
    }
570917
public function has($path)
    {
        list($prefix, $path) = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->has($path);
    }
669800
public function exists($path)
    {
        list($name, $path) = $this->splitPath($path);

        return $this->load($name)->exists($path);
    }
1256208
protected function createCacheDirectory($path): bool
    {
        if (
            !$path
            ||
            $path === '/'
            ||
            $path === '.'
            ||
            $path === '\\'
        ) {
            return false;
        }

        // if the directory already exists, just return true
        if (\is_dir($path) && \is_writable($path)) {
            return true;
        }

        // if more than one level, try parent first
        if (\dirname($path) !== '.') {
            $return = $this->createCacheDirectory(\dirname($path));
            // if creating parent fails, we can abort immediately
            if (!$return) {
                return false;
            }
        }

        $mode_dec = \intval($this->fileMode, 8);
        $old_umask = \umask(0);

        /** @noinspection PhpUsageOfSilenceOperatorInspection */
        if (!@\mkdir($path, $mode_dec) && !\is_dir($path)) {
            $return = false;
        } else {
            $return = true;
        }

        if (\is_dir($path) && !\is_writable($path)) {
            $return = \chmod($path, $mode_dec);
        }

        \umask($old_umask);

        return $return;
    }
747786
private function clientCacheForFile($path)
	{
		$lastModified = filemtime($path);

		if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $lastModified)
		{
			header('HTTP/1.0 304 Not Modified');
			exit;
		}
	}
938139
public function isfile(string $path): Promise
    {
        if (!@\file_exists($path)) {
            return new Success(false);
        }

        $isFile = @\is_file($path);
        \clearstatcache(true, $path);

        return new Success($isFile);
    }
26396
public function has($path)
    {
        $path = $this->applyPathPrefix($path);
        $object = $this->bucket->object($path);

        return $object->exists();
    }
868868
public function existsChunk($path)
    {
        $path = Alias::getAlias($path, ['lang' => $this->locale]);
        if (!pathinfo($path, PATHINFO_EXTENSION)) {
            $path .= '.' . $this->defaultExtension;
        }

        return file_exists($path);
    }
430714
public function outputImage($path, array $params)
    {
        $path = $this->makeImage($path, $params);

        header('Content-Type:'.$this->cache->getMimetype($path));
        header('Content-Length:'.$this->cache->getSize($path));
        header('Cache-Control:'.'max-age=31536000, public');
        header('Expires:'.date_create('+1 years')->format('D, d M Y H:i:s').' GMT');

        $stream = $this->cache->readStream($path);

        if (ftell($stream) !== 0) {
            rewind($stream);
        }
        fpassthru($stream);
        fclose($stream);
    }
45749
private function verify(string $path)
  {
    if (!is_dir($this->cacheDirectory))
      mkdir($this->cacheDirectory, 0777, true);

      if (!is_dir($this->cacheDirectory)) {
        return $this->exception(
          'Caching directory "' . $this->cacheDirectory . '" does not exist.'
        );
      }

    if (!is_dir($this->viewsDirectory))
      return $this->exception(
        'Views directory "' . $this->viewsDirectory . '" does not exist.'
      );

    if (!file_exists($path))
      return $this->exception(
        'View file "' . $path . '" does not exist.'
      );
  }
1254502
public function has($path) {
			try {
				return $this->bucket->fileExists($path);
			} catch (\Exception $e) {
				throw new B2FlysystemException('Error checking for file', B2FlysystemException::B2_SDK_ERROR, $e);
			}
		}