public function minify($src)
	{
		$options = ($this->options) ? ' ' . $this->options : '';

		// Add our custom externs if default externs are disabled
		if ($this->excludeDefaultExterns && $this->compilationLevel === 'ADVANCED_OPTIMIZATIONS')
		{
			$options .= ' --externs ' . __DIR__ . '/../externs.application.js --env=CUSTOM';
		}

		$crc     = crc32($src);
		$inFile  = sys_get_temp_dir() . '/' . $crc . '.js';
		$outFile = sys_get_temp_dir() . '/' . $crc . '.min.js';
		file_put_contents($inFile, $src);

		$cmd = $this->command
		     . ' --compilation_level ' . escapeshellarg($this->compilationLevel)
		     . $options
		     . ' --js ' . escapeshellarg($inFile)
		     . ' --js_output_file ' . escapeshellarg($outFile);

		exec($cmd . ' 2>&1', $output, $return);
		unlink($inFile);

		if (file_exists($outFile))
		{
			$src = trim(file_get_contents($outFile));
			unlink($outFile);
		}

		if (!empty($return))
		{
			throw new RuntimeException('An error occured during minification: ' . implode("\n", $output));
		}

		return $src;
	}
public function minify($src)
	{
		$options = ($this->options) ? ' ' . $this->options : '';

		// Add our custom externs if default externs are disabled
		if ($this->excludeDefaultExterns && $this->compilationLevel === 'ADVANCED_OPTIMIZATIONS')
		{
			$options .= ' --externs ' . __DIR__ . '/../externs.application.js --env=CUSTOM';
		}

		$crc     = crc32($src);
		$inFile  = sys_get_temp_dir() . '/' . $crc . '.js';
		$outFile = sys_get_temp_dir() . '/' . $crc . '.min.js';
		file_put_contents($inFile, $src);

		$cmd = $this->command
		     . ' --compilation_level ' . escapeshellarg($this->compilationLevel)
		     . $options
		     . ' --js ' . escapeshellarg($inFile)
		     . ' --js_output_file ' . escapeshellarg($outFile);

		exec($cmd . ' 2>&1', $output, $return);
		unlink($inFile);

		if (file_exists($outFile))
		{
			$src = trim(file_get_contents($outFile));
			unlink($outFile);
		}

		if (!empty($return))
		{
			throw new RuntimeException('An error occured during minification: ' . implode("\n", $output));
		}

		return $src;
	}
public function minify ( $ src ) { $ options = ( $ this -> options ) ? ' ' . $ this -> options : '' ; // Add our custom externs if default externs are disabled if ( $ this -> excludeDefaultExterns && $ this -> compilationLevel === 'ADVANCED_OPTIMIZATIONS' ) { $ options .= ' --externs ' . __DIR__ . '/../externs.application.js --env=CUSTOM' ; } $ crc = crc32 ( $ src ) ; $ inFile = sys_get_temp_dir ( ) . '/' . $ crc . '.js' ; $ outFile = sys_get_temp_dir ( ) . '/' . $ crc . '.min.js' ; file_put_contents ( $ inFile , $ src ) ; $ cmd = $ this -> command . ' --compilation_level ' . escapeshellarg ( $ this -> compilationLevel ) . $ options . ' --js ' . escapeshellarg ( $ inFile ) . ' --js_output_file ' . escapeshellarg ( $ outFile ) ; exec ( $ cmd . ' 2>&1' , $ output , $ return ) ; unlink ( $ inFile ) ; if ( file_exists ( $ outFile ) ) { $ src = trim ( file_get_contents ( $ outFile ) ) ; unlink ( $ outFile ) ; } if ( ! empty ( $ return ) ) { throw new RuntimeException ( 'An error occured during minification: ' . implode ( "\n" , $ output ) ) ; } return $ src ; }
Compile given JavaScript source via the Closure Compiler application

@param  string $src JavaScript source
@return string      Compiled source
Compile given JavaScript source via the Closure Compiler application