class StylesheetCompressor

Properties

protected string[] $deduplicateTargets
protected array $dictionary
protected string $keyPrefix
int $minSaving
protected array $savings
protected string $xsl

Methods

string
encode(string $xsl)

Encode given stylesheet into a compact JavaScript representation

void
buildDictionary()

Build a dictionary of all cost-effective string replacements

void
estimateSavings()

Estimate the savings of every possible string replacement

void
filterSavings()

Filter the savings according to the minSaving property

string[]
getAvailableKeys()

Return all the possible dictionary keys that are not present in the original stylesheet

string
getCompressedStylesheet()

Return the stylesheet after dictionary replacements

string[]
getPossibleKeys()

Return a list of possible dictionary keys

string
getReplacementRegexp()

Return a regexp that matches all used dictionary keys

array
getStringsFrequency()

Return the frequency of all deduplicatable strings

string[]
getUnavailableKeys()

Return the list of possible dictionary keys that appear in the original stylesheet

Details

at line 66
string encode(string $xsl)

Encode given stylesheet into a compact JavaScript representation

Parameters

string $xsl

Original stylesheet

Return Value

string

JavaScript representation of the compressed stylesheet

at line 93
protected void buildDictionary()

Build a dictionary of all cost-effective string replacements

Return Value

void

at line 117
protected void estimateSavings()

Estimate the savings of every possible string replacement

Return Value

void

at line 136
protected void filterSavings()

Filter the savings according to the minSaving property

Return Value

void

at line 152
protected string[] getAvailableKeys()

Return all the possible dictionary keys that are not present in the original stylesheet

Return Value

string[]

at line 162
protected string getCompressedStylesheet()

Return the stylesheet after dictionary replacements

Return Value

string

at line 172
protected string[] getPossibleKeys()

Return a list of possible dictionary keys

Return Value

string[]

at line 188
protected string getReplacementRegexp()

Return a regexp that matches all used dictionary keys

Return Value

string

at line 198
protected array getStringsFrequency()

Return the frequency of all deduplicatable strings

Return Value

array

Array of [string => frequency]

at line 211
protected string[] getUnavailableKeys()

Return the list of possible dictionary keys that appear in the original stylesheet

Return Value

string[]