text = trim($text) . "\n"; $this->compression = $compression; } /** * Entry point function to minify javascript. * * @param string $js Javascript source code as a string. * @param string $compression Compression option. {light, deep}. * @return string $output Output javascript code as a string. */ public static function minify($js, $compression = 'light') { try { $me = new SugarMin($js, $compression); $output = $me->jsParser(); return $output; } catch (Exception $e) { // Exception handling is left up to the implementer. throw $e; } } /** * @return bool|string * @throws Exception */ protected function jsParser() { $jshrink = new Minifier; return $jshrink::minify($this->text); } }