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:
$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 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.
I fail to see how any method of the
Minify_CSS_Compressorclass inminify/lib/Minify/CSS/Compressor.phpis dependent on the class instance (i.e. on$this). The only place where$thisis 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(_optionsis not used anyway) like thisin function
_process(). Then you can declare all methods static and refer to$_inHackwithself::$_inHack. There is nothing more to it - simple. 😉WHY
You spare an instantiation of
Minify_CSS_Compressoreach time a script minifies a CSS. In high-traffic scenarios, this might make a measurable difference.