MiniAsset\Filter\ClosureJs::output PHP Метод

output() публичный Метод

Run $input through Closure compiler
public output ( string $filename, string $input ) : Compressed
$filename string Filename being generated.
$input string Contents of file
Результат Compressed file
    public function output($filename, $input)
    {
        $output = null;
        $paths = [getcwd(), dirname(dirname(dirname(dirname(__DIR__))))];
        $jar = $this->_findExecutable($paths, $this->_settings['path']);
        // Closure works better if you specify an input file. Also supress warnings by default
        $tmpFile = tempnam(TMP, 'CLOSURE');
        file_put_contents($tmpFile, $input);
        $options = array('js' => $tmpFile) + $this->_settings;
        $options = array_diff_key($options, array('path' => null, 'paths' => null, 'target' => null, 'theme' => null));
        $cmd = 'java -jar "' . $jar . '"';
        foreach ($options as $key => $value) {
            $cmd .= sprintf(' --%s="%s"', $key, $value);
        }
        try {
            $output = $this->_runCmd($cmd, null);
        } catch (Exception $e) {
            //If there is an error need to remove tmpFile.
            // @codingStandardsIgnoreStart
            @unlink($tmpFile);
            // @codingStandardsIgnoreEnd
            throw $e;
        }
        // @codingStandardsIgnoreStart
        @unlink($tmpFile);
        // @codingStandardsIgnoreEnd
        return $output;
    }
ClosureJs