Set filepath of the cache file.

@param string $filepath cache file path
@throws \Exception
762772
public function setFilePath($filepath)
    {
        if (!isset($filepath) || empty($filepath)) {
            throw new PageCacheException(__CLASS__ . ' file path not set or empty');
        }

        $this->filepath = $filepath;
    }
1115557
public static function createFromFilePath ($filePath)
    {
        if (!is_file($filePath))
        {
            throw new \InvalidArgumentException("File does not exist");
        }
        else if (!is_readable($filePath))
        {
            throw new \InvalidArgumentException("File to download is not readable.");
        }

        return new FileDownload(fopen($filePath, "rb"));
    }
962776
protected function checkFilePath($filePath)
	{
	    $filePath = rtrim($filePath, '/\\');
	    if (!is_dir($filePath)) {
			mkdir($filePath, 0755, true);
		}
        
		if (!is_writable($filePath)) {
			throw new \RuntimeException(sprintf('The base cache path `%s` is not writable.', $filePath));
		}

		return true;
	}
1184246
public function setResourcePath($path)
    {
        $escapedPath = rtrim($path, '/');
        if (!file_exists($escapedPath)) {
            throw new Exception(sprintf(
                "The path '%s' to resources' folder does not exist!",
                $escapedPath
            ));
        }

        $this->resourcePath = $escapedPath;
    }
993401
public function setFile($filePath)
    {
        if (is_file($filePath)) {
            $this->file = new SplFileInfo($filePath);

            if (file_exists(
                $propertiesFilePath = $this->file->getPath() . DIRECTORY_SEPARATOR . str_replace(
                        '.phtml',
                        '.json',
                        strtolower($this->file->getBasename())
                    )
            )) {
                $properties = file_get_contents($propertiesFilePath);
                $properties = json_decode($properties, true);

                if (isset($properties[ 'vars' ])) {
                    $this->vars = $properties[ 'vars' ];
                }

                if (isset($properties[ 'presets' ])) {
                    $this->presets = new SplArrayObject($properties[ 'presets' ]);
                }
            }
        }

        return $this;
    }
372996
public function getFileContent($filePath)
    {
        if ($this->repository->fileExists($filePath) === false) {
            throw new Exception(sprintf('The file "%s" cannot be found', $filePath));
        }
        return $this->repository->getFileContent($filePath);
    }
1357150
public function setAvatar($filepath)
    {
        if (! file_exists($filepath)) {
            throw new FileNotFoundException("File does not exist at path {$filepath}.");
        }

        $extension = pathinfo($filepath, PATHINFO_EXTENSION);
        $file      = file_get_contents($filepath);
        $base64    = base64_encode($file);

        $this->attributes['avatarhash'] = "data:image/{$extension};base64,{$base64}";

        return true;
    }
161798
public function setPath(File $path) {
		$this->path = $path;
		if ($this->isCreateIfNotExists() && !$path->isFile()) {
			$path->getParent()->mkdir();
			$path->write("");
			$this->setCreateDefault(true);
			if (!$path->isFile()) {
				throw new FileNotFoundException($path);
			}
		}
		$this->content = $path->getContent();
	}
1176067
public function setFile(string $filePath): self
    {
        if (!file_exists($filePath)) {
            throw new MimeDetectorException("File '" . $filePath . "' does not exist.");
        }

        $this->stream = $this->readFile($filePath);
        $this->createByteCache();
        return $this;
    }
22658
protected function _ensurePathExistence($filePath) {
        $folders = explode(DIRECTORY_SEPARATOR, $filePath);
        // discard the actual file
        array_pop($folders);
        $path = implode(DIRECTORY_SEPARATOR, $folders);
        if (file_exists($path)) {
            return;
        }
        mkdir($path, 0777, true);
    }
945966
public function setRuntimePath($path)
    {
        if (($runtimePath = realpath($path)) === false || !is_dir($runtimePath) || !is_writable($runtimePath)) {
            throw new Exception(Mindy::t('base', 'Application runtime path "{path}" is not valid. Please make sure it is a directory writable by the Web server process.', ['{path}' => $path]));
        }
        $this->_runtimePath = $runtimePath;
    }
737889
protected function moveFile($file, $filePath)
	{
		if (!rename($file, $filePath)) {
            $error = error_get_last();
            throw new Exceptions\FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $file, $filePath, strip_tags($error['message'])));
        }
	}
483286
public function optimizeImage($filepath)
    {
        $fileExtension = $this->extensions[mime_content_type($filepath)];

        $transformHandler = config('imageoptimizer.transform_handler');

        if (!isset($transformHandler[$fileExtension])) {
            throw new \Exception('TransformHandler for file extension: "' . $fileExtension . '" was not found');
        }

        $this->get($transformHandler[$fileExtension])->optimize($filepath);
    }
426204
public function loadFile($filePath)
    {
        if (strrpos($filePath, $this->extension) !== false) {
            $fileKey = str_replace([$this->path, $this->extension, DIRECTORY_SEPARATOR], ['', '', '-'], $filePath);
            $this->store(camelcase($fileKey), new SplFileInfo($filePath));
        }
    }
810122
public function setLogFilePath($logFilePath)
    {
        if (!$this->isParentDirectoryExists($logFilePath)) {
            throw new PageCacheException('Log file directory does not exist for the path provided '
                . $logFilePath);
        }

        $this->logFilePath = $logFilePath;
        return $this;
    }
1053678
public static function loadContextFromFile(string $filePath): ContextInterface
    {
        if(!file_exists($filePath)){
            throw new Exception\FileNotFoundException('Context file not found: '.$filePath, 404, null, $filePath);
        }

        $contents = file_get_contents($filePath);
        $context_array = json_decode($contents, true);

        if($context_array === null){
            throw new Exception\MalformedJsonException('JSON sintax error.');
        }

        return new self($context_array);
    }
875912
final public function createFile($filePath = null)
    {
        if (isset($filePath)) {
            $this->filePath = $filePath;
        }

        if (pathinfo($this->filePath, PATHINFO_EXTENSION) === '') {
            $this->filePath .= $this->fileExtension;
        }

        return $this;
    }