Automattic\WooCommerce\Vendor\Sabberworm\CSS\Parsing

ParserState::consumeUntilpublicWC 1.0

Method of the class: ParserState{}

No Hooks.

Returns

String.

Usage

$ParserState = new ParserState();
$ParserState->consumeUntil( $aEnd, $bIncludeEnd, $consumeEnd, $comments );
$aEnd(required)
.
$bIncludeEnd(string)
.
Default: false
$consumeEnd(string)
.
Default: false
$comments(array)
.
Default: []

ParserState::consumeUntil() code WC 10.8.1

public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, array &$comments = [])
{
    $aEnd = is_array($aEnd) ? $aEnd : [$aEnd];
    $out = '';
    $start = $this->iCurrentPosition;

    while (!$this->isEnd()) {
        $char = $this->consume(1);
        if (in_array($char, $aEnd)) {
            if ($bIncludeEnd) {
                $out .= $char;
            } elseif (!$consumeEnd) {
                $this->iCurrentPosition -= $this->strlen($char);
            }
            return $out;
        }
        $out .= $char;
        if ($comment = $this->consumeComment()) {
            $comments[] = $comment;
        }
    }

    if (in_array(self::EOF, $aEnd)) {
        return $out;
    }

    $this->iCurrentPosition = $start;
    throw new UnexpectedEOFException(
        'One of ("' . implode('","', $aEnd) . '")',
        $this->peek(5),
        'search',
        $this->iLineNo
    );
}