You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I fail to see how any method of the Minify_CSS_Compressor class in minify/lib/Minify/CSS/Compressor.php is dependent on the class instance (i.e. on $this). The only place where $this is used is in the callbacks to preg_match_callback:
Just remember to initialize the one and only true property _inHack(_options is not used anyway) like this
// Initialize!
self::$_inHack = false;
in function _process(). Then you can declare all methods static and refer to $_inHack with self::$_inHack. There is nothing more to it - simple. 😉
WHY
You spare an instantiation of Minify_CSS_Compressor each time a script minifies a CSS. In high-traffic scenarios, this might make a measurable difference.
The text was updated successfully, but these errors were encountered:
I fail to see how any method of the
Minify_CSS_Compressor
class inminify/lib/Minify/CSS/Compressor.php
is dependent on the class instance (i.e. on$this
). The only place where$this
is used is in the callbacks topreg_match_callback
:$css = preg_replace_callback($pattern, array($this, '_selectorsCB'), $css);
but this can be changed to
$css = preg_replace_callback($pattern, array(get_called_class(), '_selectorsCB'), $css);
Just remember to initialize the one and only true property
_inHack
(_options
is not used anyway) like thisin function
_process()
. Then you can declare all methods static and refer to$_inHack
withself::$_inHack
. There is nothing more to it - simple. 😉WHY
You spare an instantiation of
Minify_CSS_Compressor
each time a script minifies a CSS. In high-traffic scenarios, this might make a measurable difference.The text was updated successfully, but these errors were encountered: