You are here

class WhitespaceHandler in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php \Symfony\Component\CssSelector\Parser\Handler\WhitespaceHandler

CSS selector whitespace handler.

This component is a port of the Python cssselect library, which is copyright Ian Bicking, @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>

Hierarchy

Expanded class hierarchy of WhitespaceHandler

See also

https://github.com/SimonSapin/cssselect.

1 file declares its use of WhitespaceHandler
WhitespaceHandlerTest.php in vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php

File

vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php, line 26

Namespace

Symfony\Component\CssSelector\Parser\Handler
View source
class WhitespaceHandler implements HandlerInterface {

  /**
   * {@inheritdoc}
   */
  public function handle(Reader $reader, TokenStream $stream) {
    $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;
  }

}

Members