cacheDir)) ? $this->getFromCache($src) : $this->minify($src); } catch (Exception $e) { if (!$this->keepGoing) { throw $e; } } return $src; } /** * Return a value that uniquely identifies this minifier's configuration * * @return array|string */ public function getCacheDifferentiator() { return ''; } /** * Get the minified source from cache, or minify and cache the result * * @param string $src JavaScript source * @return string Minified source */ protected function getFromCache($src) { $differentiator = $this->getCacheDifferentiator(); $key = sha1(serialize([get_class($this), $differentiator, $src])); $cacheFile = $this->cacheDir . '/minifier.' . $key . '.js'; if (!file_exists($cacheFile)) { file_put_contents($cacheFile, $this->minify($src)); } return file_get_contents($cacheFile); } }