Automattic\WooCommerce\Vendor\Symfony\Component\CssSelector\Parser\Handler

WhitespaceHandler{}WC 1.0└─ HandlerInterface

CSS selector whitespace handler.

This component is a port of the Python cssselect library, which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.

No Hooks.

Usage

$WhitespaceHandler = new WhitespaceHandler();
// use class methods

Methods

  1. public handle(Reader $reader, TokenStream $stream)

WhitespaceHandler{} code WC 10.4.3

class WhitespaceHandler implements HandlerInterface
{
    /**
     * {@inheritdoc}
     */
    public function handle(Reader $reader, TokenStream $stream): bool
    {
        $match = $reader->findPattern('~^[ \t\r\n\f]+~');

        if (false === $match) {
            return false;
        }

        $stream->push(new Token(Token::TYPE_WHITESPACE, $match[0], $reader->getPosition()));
        $reader->moveForward(\strlen($match[0]));

        return true;
    }
}