Automattic\WooCommerce\Vendor\Sabberworm\CSS\CSSList

CSSList::parseListpublic staticWC 1.0

Method of the class: CSSList{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = CSSList::parseList( $oParserState, $oList );
$oParserState(ParserState) (required)
.
$oList(CSSList) (required)
.

CSSList::parseList() code WC 10.5.0

public static function parseList(ParserState $oParserState, CSSList $oList)
{
    $bIsRoot = $oList instanceof Document;
    if (is_string($oParserState)) {
        $oParserState = new ParserState($oParserState, Settings::create());
    }
    $bLenientParsing = $oParserState->getSettings()->bLenientParsing;
    $aComments = [];
    while (!$oParserState->isEnd()) {
        $aComments = array_merge($aComments, $oParserState->consumeWhiteSpace());
        $oListItem = null;
        if ($bLenientParsing) {
            try {
                $oListItem = self::parseListItem($oParserState, $oList);
            } catch (UnexpectedTokenException $e) {
                $oListItem = false;
            }
        } else {
            $oListItem = self::parseListItem($oParserState, $oList);
        }
        if ($oListItem === null) {
            // List parsing finished
            return;
        }
        if ($oListItem) {
            $oListItem->addComments($aComments);
            $oList->append($oListItem);
        }
        $aComments = $oParserState->consumeWhiteSpace();
    }
    $oList->addComments($aComments);
    if (!$bIsRoot && !$bLenientParsing) {
        throw new SourceException("Unexpected end of document", $oParserState->currentLine());
    }
}