PHP 8.3.31
Preview: Reader.php Size: 1.80 KB
/home/getspomw/royalsquad.us/vendor/symfony/css-selector/Parser/Reader.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\CssSelector\Parser;

/**
 * CSS selector reader.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
 *
 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
 *
 * @internal
 */
class Reader
{
    private int $length;
    private int $position = 0;

    public function __construct(
        private string $source,
    ) {
        $this->length = \strlen($source);
    }

    public function isEOF(): bool
    {
        return $this->position >= $this->length;
    }

    public function getPosition(): int
    {
        return $this->position;
    }

    public function getRemainingLength(): int
    {
        return $this->length - $this->position;
    }

    public function getSubstring(int $length, int $offset = 0): string
    {
        return substr($this->source, $this->position + $offset, $length);
    }

    public function getOffset(string $string): int|false
    {
        $position = strpos($this->source, $string, $this->position);

        return false === $position ? false : $position - $this->position;
    }

    public function findPattern(string $pattern): array|false
    {
        $source = substr($this->source, $this->position);

        if (preg_match($pattern, $source, $matches)) {
            return $matches;
        }

        return false;
    }

    public function moveForward(int $length): void
    {
        $this->position += $length;
    }

    public function moveToEnd(): void
    {
        $this->position = $this->length;
    }
}

Directory Contents

Dirs: 3 × Files: 6

Name Size Perms Modified Actions
Handler DIR
- drwxrwxrwx 2025-09-17 06:53:17
Edit Download
Shortcut DIR
- drwxrwxrwx 2026-04-19 15:18:46
Edit Download
Tokenizer DIR
- drwxrwxrwx 2025-09-17 06:53:17
Edit Download
1.98 KB lrw-r--r-- 2026-04-25 12:34:54
Edit Download
13.17 KB lrw-rw-rw- 2025-09-17 06:53:17
Edit Download
809 B lrw-rw-rw- 2025-09-17 06:53:17
Edit Download
1.80 KB lrw-rw-rw- 2025-09-17 06:53:17
Edit Download
2.34 KB lrw-rw-rw- 2025-09-17 06:53:17
Edit Download
3.24 KB lrw-rw-rw- 2025-09-17 06:53:17
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).