function __construct($styles) { $this->old_styles = $styles; // Unset all the object properties except our private copy of the styles object. // We have to unset everything so that the overload methods talk to $this->old_styles->whatever // instead of $this->whatever. foreach (array_keys(get_object_vars($this)) as $key) { if ('old_styles' === $key) { continue; } unset($this->{$key}); } parent::__construct(); }
public function __construct($styles = '') { $this->old_styles = empty($styles) || !$styles instanceof WP_Styles ? new WP_Styles() : $styles; // Unset all the object properties except our private copy of the // styles object. We have to unset everything so that the overload // methods talk to $this->old_styles->whatever instead of $this->whatever. foreach (array_keys(get_object_vars($this)) as $key) { if ('old_styles' === $key) { continue; } unset($this->{$key}); } parent::__construct(); }
function __construct($styles) { $this->old_styles = $styles; parent::__construct(); }