Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList

CSSList::replacepublicWC 1.0

Replaces an item from the CSS list.

Метод класса: CSSList{}

Хуков нет.

Возвращает

true|false.

Использование

$CSSList = new CSSList();
$CSSList->replace( $oOldItem, $mNewItem );
$oOldItem(RuleSet|Import|Charset|CSSList) (обязательный)
May be a RuleSet (most likely a DeclarationBlock), an Import, a Charset or another CSSList (most likely a MediaQuery).
$mNewItem(обязательный)
.

Код CSSList::replace() 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;
}