WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
класс не описан

NumberHandler() WC 1.0

CSS selector comment handler.

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

Хуков нет.

Возвращает

Null. Ничего.

Использование

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

Методы

  1. __construct(TokenizerPatterns $patterns)
  2. handle(Reader $reader, TokenStream $stream)

Код NumberHandler: woocommerce/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php WC 4.3.2

<?php
class NumberHandler implements HandlerInterface
{
    private $patterns;

    public function __construct(TokenizerPatterns $patterns)
    {
        $this->patterns = $patterns;
    }

    /**
     * {@inheritdoc}
     */
    public function handle(Reader $reader, TokenStream $stream)
    {
        $match = $reader->findPattern($this->patterns->getNumberPattern());

        if (!$match) {
            return false;
        }

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

        return true;
    }
}