/** * Makes sure that template and compiler paths are set * @param string $method * @throws KnitException */ public function checkPaths(string $method) { // Path to template files if (!isset($this->diskTemplate)) { throw KnitException::pathNotSet($method, "template", "setTemplatePath"); } // Path to compiler's working directory if (!isset($this->diskCompiler)) { throw KnitException::pathNotSet($method, "compiler", "setCompilerPath"); } }
/** * @return Knit * @throws KnitException */ public function flushCache() : Knit { if (!isset($this->diskCache)) { throw KnitException::pathNotSet(__METHOD__, "cache", "setCachePath"); } $cacheFiles = $this->diskCache->find("knit_*"); foreach ($cacheFiles as $file) { $this->diskCache->delete($file); } return $this; }
/** * @return string * @throws KnitException */ public function getCachePath() : string { if (!isset($this->diskCache)) { throw KnitException::pathNotSet(__METHOD__, "cache", "setCachePath"); } return $this->diskCache->getPath(); }