Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet

RuleSet::getRulesAssocpublicWC 1.0

Returns all rules matching the given pattern and returns them in an associative array with the rule’s name as keys. This method exists mainly for backwards-compatibility and is really only partially useful.

Note: This method loses some information: Calling this (with an argument of background-) on a declaration block like { background-color: green; background-color; rgba(0, 127, 0, 0.7); } will only yield an associative array containing the rgba-valued rule while getRules() would yield an indexed array containing both.

Method of the class: RuleSet{}

No Hooks.

Returns

Array. Rule>

Usage

$RuleSet = new RuleSet();
$RuleSet->getRulesAssoc( $mRule );
$mRule(Rule|string|null)
$mRule Pattern to search for. If null, returns all rules. If the pattern ends with a dash, all rules starting with the pattern are returned as well as one matching the pattern with the dash excluded. Passing a Rule for this parameter is deprecated in version 8.9.0, and will not work from v9.0. Call getRulesAssoc($rule->getRule()) instead.
Default: null

RuleSet::getRulesAssoc() code WC 10.8.1

public function getRulesAssoc($mRule = null)
{
    /** @var array<string, Rule> $aResult */
    $aResult = [];
    foreach ($this->getRules($mRule) as $oRule) {
        $aResult[$oRule->getRule()] = $oRule;
    }
    return $aResult;
}