class Reader in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/css-selector/Parser/Reader.php \Symfony\Component\CssSelector\Parser\Reader
- 8 vendor/zendframework/zend-feed/src/Reader/Reader.php \Zend\Feed\Reader\Reader
Same name and namespace in other branches
- 8.0 vendor/symfony/css-selector/Parser/Reader.php \Symfony\Component\CssSelector\Parser\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>
Hierarchy
- class \Symfony\Component\CssSelector\Parser\Reader
Expanded class hierarchy of Reader
See also
https://github.com/SimonSapin/cssselect.
11 files declare their use of Reader
- AbstractHandlerTest.php in vendor/
symfony/ css-selector/ Tests/ Parser/ Handler/ AbstractHandlerTest.php - CommentHandler.php in vendor/
symfony/ css-selector/ Parser/ Handler/ CommentHandler.php - CommentHandlerTest.php in vendor/
symfony/ css-selector/ Tests/ Parser/ Handler/ CommentHandlerTest.php - HandlerInterface.php in vendor/
symfony/ css-selector/ Parser/ Handler/ HandlerInterface.php - HashHandler.php in vendor/
symfony/ css-selector/ Parser/ Handler/ HashHandler.php
File
- vendor/
symfony/ css-selector/ Parser/ Reader.php, line 22
Namespace
Symfony\Component\CssSelector\ParserView source
class Reader {
/**
* @var string
*/
private $source;
/**
* @var int
*/
private $length;
/**
* @var int
*/
private $position = 0;
/**
* @param string $source
*/
public function __construct($source) {
$this->source = $source;
$this->length = strlen($source);
}
/**
* @return bool
*/
public function isEOF() {
return $this->position >= $this->length;
}
/**
* @return int
*/
public function getPosition() {
return $this->position;
}
/**
* @return int
*/
public function getRemainingLength() {
return $this->length - $this->position;
}
/**
* @param int $length
* @param int $offset
*
* @return string
*/
public function getSubstring($length, $offset = 0) {
return substr($this->source, $this->position + $offset, $length);
}
/**
* @param string $string
*
* @return int
*/
public function getOffset($string) {
$position = strpos($this->source, $string, $this->position);
return false === $position ? false : $position - $this->position;
}
/**
* @param string $pattern
*
* @return bool
*/
public function findPattern($pattern) {
$source = substr($this->source, $this->position);
if (preg_match($pattern, $source, $matches)) {
return $matches;
}
return false;
}
/**
* @param int $length
*/
public function moveForward($length) {
$this->position += $length;
}
/**
*/
public function moveToEnd() {
$this->position = $this->length;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Reader:: |
private | property | ||
Reader:: |
private | property | ||
Reader:: |
private | property | ||
Reader:: |
public | function | ||
Reader:: |
public | function | ||
Reader:: |
public | function | ||
Reader:: |
public | function | ||
Reader:: |
public | function | ||
Reader:: |
public | function | ||
Reader:: |
public | function | ||
Reader:: |
public | function | ||
Reader:: |
public | function |