Automattic\WooCommerce\Vendor\Sabberworm\CSS\Rule
Rule::parse
Метод класса: Rule{}
Хуков нет.
Возвращает
Rule.
Использование
$result = Rule::parse( $oParserState, $commentsBeforeRule );
- $oParserState(ParserState) (обязательный)
- .
- $commentsBeforeRule(array<int, Comment>)
- .
По умолчанию:[]
Код Rule::parse() Rule::parse WC 11.1.1
public static function parse(ParserState $oParserState, $commentsBeforeRule = [])
{
$aComments = \array_merge($commentsBeforeRule, $oParserState->consumeWhiteSpace());
$oRule = new Rule(
$oParserState->parseIdentifier(!$oParserState->comes("--")),
$oParserState->currentLine(),
$oParserState->currentColumn()
);
$oRule->setComments($aComments);
$oRule->addComments($oParserState->consumeWhiteSpace());
$oParserState->consume(':');
$oValue = Value::parseValue($oParserState, self::listDelimiterForRule($oRule->getRule()));
$oRule->setValue($oValue);
if ($oParserState->getSettings()->bLenientParsing) {
while ($oParserState->comes('\\')) {
$oParserState->consume('\\');
$oRule->addIeHack($oParserState->consume());
$oParserState->consumeWhiteSpace();
}
}
$oParserState->consumeWhiteSpace();
if ($oParserState->comes('!')) {
$oParserState->consume('!');
$oParserState->consumeWhiteSpace();
$oParserState->consume('important');
$oRule->setIsImportant(true);
}
$oParserState->consumeWhiteSpace();
while ($oParserState->comes(';')) {
$oParserState->consume(';');
}
return $oRule;
}