ConfigOptimizer
class ConfigOptimizer
This class creates local variables to deduplicate complex configValues
Properties
protected array | $configValues | ||
protected Encoder | $encoder | ||
protected array | $jsLengths |
Methods
Return the var declarations for all deduplicated config values
Clear the deduplicated config values stored in this instance
Test whether given value can be deduplicated
Mark ConfigValue instances that have been used multiple times
Return the name of the variable that will a given value
Test whether given value is iterable
Test whether given value should be preserved and not deduplicated
Details
at line 35
__construct(Encoder $encoder)
Constructor
at line 46
string
getVarDeclarations()
Return the var declarations for all deduplicated config values
at line 69
array|Dictionary
optimize(array|Dictionary $object)
Optimize given config object
at line 79
void
reset()
Clear the deduplicated config values stored in this instance
at line 91
protected bool
canDeduplicate(mixed $value)
Test whether given value can be deduplicated
at line 107
protected void
deduplicateConfigValues()
Mark ConfigValue instances that have been used multiple times
at line 126
protected string
getVarName(string $js)
Return the name of the variable that will a given value
at line 137
protected bool
isIterable(mixed $value)
Test whether given value is iterable
at line 148
protected array|Dictionary
optimizeObjectContent(array|Dictionary $object)
Optimize given object's content
at line 162
protected ConfigValue
recordObject(array|Code|Dictionary $object)
Record a given config object as a ConfigValue instance
at line 188
protected array|Dictionary
recordObjectContent(array|Dictionary $object)
Record the content of given config object
at line 207
protected bool
shouldPreserve(mixed $value)
Test whether given value should be preserved and not deduplicated