Automattic\WooCommerce\EmailEditorVendor\Sabberworm\CSS\Rule

Rule::getValues │ public │ WC 1.0

Устарела с версии 9.0. Больше не поддерживается и может быть удалена. Используйте `getValue()` and check for existence of a (nested set of) ValueList object(s).

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

Хуков нет.

Возвращает

array<int,. array<int, RuleValueList>>

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

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

Список изменений

Устарела 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() WC 11.3.0

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;
}