/** * Perform actual minification * * @return void */ protected function minify() { $isExists = $this->staticViewDir->isExist($this->path); if (!$isExists) { $shouldMinify = true; } elseif ($this->strategy == self::FILE_EXISTS) { $shouldMinify = false; } else { $origlFile = $this->rootDir->getRelativePath($this->originalAsset->getSourceFile()); $origMtime = $this->rootDir->stat($origlFile)['mtime']; $minMtime = $this->staticViewDir->stat($this->path)['mtime']; $shouldMinify = $origMtime != $minMtime; } if ($shouldMinify) { $content = $this->adapter->minify($this->originalAsset->getContent()); $this->staticViewDir->writeFile($this->path, $content); } }
/** * @param LocalInterface $asset * @return int */ protected function getAssetSize(LocalInterface $asset) { return mb_strlen(utf8_encode($asset->getContent()), 'utf-8') / 1024; }