PHP Класс Minify_JS_ClosureCompiler, minify

Автор: Stephen Clay ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$additionalOptions string[] Additional options to pass to the compiler service
$fallbackMinifier Function to minify JS if service fails. Default is JSMin
$maxBytes integer The maximum JS size that can be sent to the compiler server in bytes
$serviceUrl string

Открытые методы

Метод Описание
__construct ( array $options = [] )
min ( string $js ) : string Call the service to perform the minification
minify ( string $js, array $options = [] ) : string Minify JavaScript code via HTTP request to a Closure Compiler API

Защищенные методы

Метод Описание
buildPostBody ( string $js, boolean $returnErrors = false ) : string Build a POST request body
getResponse ( string $postBody ) : string Get the response for a given POST body

Описание методов

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

public __construct ( array $options = [] )
$options array Options with keys available below: fallbackFunc : (callable) function to minify if service unavailable. Default is JSMin. compilerUrl : (string) URL to closure compiler server maxBytes : (int) The maximum amount of bytes to be sent as js_code in the POST request. Defaults to 200000. additionalParams : (string[]) Additional parameters to pass to the compiler server. Can be anything named in https://developers.google.com/closure/compiler/docs/api-ref except for js_code and output_info

buildPostBody() защищенный Метод

Build a POST request body
protected buildPostBody ( string $js, boolean $returnErrors = false ) : string
$js string JavaScript code
$returnErrors boolean
Результат string

getResponse() защищенный Метод

Get the response for a given POST body
protected getResponse ( string $postBody ) : string
$postBody string
Результат string

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

Call the service to perform the minification
public min ( string $js ) : string
$js string JavaScript code
Результат string

minify() публичный статический Метод

Minify JavaScript code via HTTP request to a Closure Compiler API
public static minify ( string $js, array $options = [] ) : string
$js string input code
$options array Options passed to __construct(). @see __construct
Результат string

Описание свойств

$additionalOptions защищенное свойство

Additional options to pass to the compiler service
protected string[] $additionalOptions
Результат string[]

$fallbackMinifier защищенное свойство

Function to minify JS if service fails. Default is JSMin
protected $fallbackMinifier

$maxBytes защищенное свойство

The maximum JS size that can be sent to the compiler server in bytes
protected int $maxBytes
Результат integer

$serviceUrl защищенное свойство

protected string $serviceUrl
Результат string