CommentHandler.php
2 years ago
HandlerInterface.php
2 years ago
HashHandler.php
2 years ago
IdentifierHandler.php
2 years ago
NumberHandler.php
2 years ago
StringHandler.php
2 years ago
WhitespaceHandler.php
2 years ago
index.php
2 years ago
NumberHandler.php
26 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Symfony\Component\CssSelector\Parser\Handler; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Symfony\Component\CssSelector\Parser\Reader; |
| 5 | use MailPoetVendor\Symfony\Component\CssSelector\Parser\Token; |
| 6 | use MailPoetVendor\Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; |
| 7 | use MailPoetVendor\Symfony\Component\CssSelector\Parser\TokenStream; |
| 8 | class NumberHandler implements HandlerInterface |
| 9 | { |
| 10 | private $patterns; |
| 11 | public function __construct(TokenizerPatterns $patterns) |
| 12 | { |
| 13 | $this->patterns = $patterns; |
| 14 | } |
| 15 | public function handle(Reader $reader, TokenStream $stream) : bool |
| 16 | { |
| 17 | $match = $reader->findPattern($this->patterns->getNumberPattern()); |
| 18 | if (!$match) { |
| 19 | return \false; |
| 20 | } |
| 21 | $stream->push(new Token(Token::TYPE_NUMBER, $match[0], $reader->getPosition())); |
| 22 | $reader->moveForward(\strlen($match[0])); |
| 23 | return \true; |
| 24 | } |
| 25 | } |
| 26 |