class Reader
Same name in this branch
- 11.1.x vendor/phpunit/phpunit/src/Runner/Baseline/Reader.php \PHPUnit\Runner\Baseline\Reader
CSS selector reader.
This component is a port of the Python cssselect library, which is copyright Ian Bicking, @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
@internal
Hierarchy
- class \Symfony\Component\CssSelector\Parser\Reader
Expanded class hierarchy of Reader
See also
https://github.com/SimonSapin/cssselect.
8 files declare their use of Reader
- CommentHandler.php in vendor/
symfony/ css-selector/ Parser/ Handler/ CommentHandler.php - HandlerInterface.php in vendor/
symfony/ css-selector/ Parser/ Handler/ HandlerInterface.php - HashHandler.php in vendor/
symfony/ css-selector/ Parser/ Handler/ HashHandler.php - IdentifierHandler.php in vendor/
symfony/ css-selector/ Parser/ Handler/ IdentifierHandler.php - NumberHandler.php in vendor/
symfony/ css-selector/ Parser/ Handler/ NumberHandler.php
File
-
vendor/
symfony/ css-selector/ Parser/ Reader.php, line 24
Namespace
Symfony\Component\CssSelector\ParserView source
class Reader {
private int $length;
private int $position = 0;
public function __construct(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;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Reader::$length | private | property | |
Reader::$position | private | property | |
Reader::findPattern | public | function | |
Reader::getOffset | public | function | |
Reader::getPosition | public | function | |
Reader::getRemainingLength | public | function | |
Reader::getSubstring | public | function | |
Reader::isEOF | public | function | |
Reader::moveForward | public | function | |
Reader::moveToEnd | public | function | |
Reader::__construct | public | function |