PHP Class Minify_JS_ClosureCompiler, minify

Afficher le fichier Open project: mrclay/minify Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
buildPostBody ( string $js, boolean $returnErrors = false ) : string Build a POST request body
getResponse ( string $postBody ) : string Get the response for a given POST body

Method Details

__construct() public méthode

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() protected méthode

Build a POST request body
protected buildPostBody ( string $js, boolean $returnErrors = false ) : string
$js string JavaScript code
$returnErrors boolean
Résultat string

getResponse() protected méthode

Get the response for a given POST body
protected getResponse ( string $postBody ) : string
$postBody string
Résultat string

min() public méthode

Call the service to perform the minification
public min ( string $js ) : string
$js string JavaScript code
Résultat string

minify() public static méthode

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
Résultat string

Property Details

$additionalOptions protected_oe property

Additional options to pass to the compiler service
protected string[] $additionalOptions
Résultat string[]

$fallbackMinifier protected_oe property

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

$maxBytes protected_oe property

The maximum JS size that can be sent to the compiler server in bytes
protected int $maxBytes
Résultat integer

$serviceUrl protected_oe property

protected string $serviceUrl
Résultat string