Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList

CSSList::replacepublicWC 1.0

Replaces an item from the CSS list.

Method of the class: CSSList{}

No Hooks.

Returns

true|false.

Usage

$CSSList = new CSSList();
$CSSList->replace( $oOldItem, $mNewItem );
$oOldItem(RuleSet|Import|Charset|CSSList) (required)
May be a RuleSet (most likely a DeclarationBlock), an Import, a Charset or another CSSList (most likely a MediaQuery).
$mNewItem(required)
.

CSSList::replace() code WC 10.4.3

public function replace($oOldItem, $mNewItem)
{
    $iKey = array_search($oOldItem, $this->aContents, true);
    if ($iKey !== false) {
        if (is_array($mNewItem)) {
            array_splice($this->aContents, $iKey, 1, $mNewItem);
        } else {
            array_splice($this->aContents, $iKey, 1, [$mNewItem]);
        }
        return true;
    }
    return false;
}