Automattic\WooCommerce\Vendor\Sabberworm\CSS\Rule

Rule::getValuespublicWC 1.0

Deprecated since 9.0. It is no longer supported and may be removed in future releases. Use `getValue()` and check for existence of a (nested set of) ValueList object(s) instead.

Method of the class: Rule{}

No Hooks.

Returns

Array. array<int, RuleValueList>>

Usage

$Rule = new Rule();
$Rule->getValues();

Changelog

Deprecated will be removed in version 9.0
Old-Style 2-dimensional array returned. Retained for (some) backwards-compatibility.
Use getValue() instead and check for the existence of a (nested set of) ValueList object(s).

Rule::getValues() code WC 10.8.1

public function getValues()
{
    if (!$this->mValue instanceof RuleValueList) {
        return [[$this->mValue]];
    }
    if ($this->mValue->getListSeparator() === ',') {
        return [$this->mValue->getListComponents()];
    }
    $aResult = [];
    foreach ($this->mValue->getListComponents() as $mValue) {
        if (!$mValue instanceof RuleValueList || $mValue->getListSeparator() !== ',') {
            $aResult[] = [$mValue];
            continue;
        }
        if ($this->mValue->getListSeparator() === ' ' || count($aResult) === 0) {
            $aResult[] = [];
        }
        foreach ($mValue->getListComponents() as $mValue) {
            $aResult[count($aResult) - 1][] = $mValue;
        }
    }
    return $aResult;
}