/** * @param $type * @param $content * @param $options * * @return string * @throws Exception */ protected static function _minify($type, $content, $options) { self::_prepare(); if (!($tmpFile = tempnam(self::$tempDir, 'yuic_'))) { throw new Exception('Minify_YUICompressor : could not create temp file.'); } file_put_contents($tmpFile, $content); self::$yuiCommand = self::_getCmd($options, $type, $tmpFile); $result_code = 0; $output = array(); exec(self::$yuiCommand, $output, $result_code); unlink($tmpFile); if ((int) $result_code !== 0) { throw new Exception('Minify_YUICompressor : YUI compressor execution failed.'); } return implode("\n", $output); }