Automattic\WooCommerce\Vendor\Sabberworm\CSS\Rule
Rule::parse
Method of the class: Rule{}
No Hooks.
Returns
Rule.
Usage
$result = Rule::parse( $oParserState, $commentsBeforeRule );
- $oParserState(ParserState) (required)
- .
- $commentsBeforeRule
- .
Default:[]
Rule::parse() Rule::parse code WC 10.4.3
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;
}