class Token in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/css-selector/Parser/Token.php \Symfony\Component\CssSelector\Parser\Token
- 8 core/lib/Drupal/Core/Utility/Token.php \Drupal\Core\Utility\Token
- 8 core/lib/Drupal/Core/Render/Element/Token.php \Drupal\Core\Render\Element\Token
Same name and namespace in other branches
- 8.0 vendor/symfony/css-selector/Parser/Token.php \Symfony\Component\CssSelector\Parser\Token
CSS selector token.
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\Token
Expanded class hierarchy of Token
See also
https://github.com/SimonSapin/cssselect.
18 files declare their use of Token
- AbstractHandlerTest.php in vendor/
symfony/ css-selector/ Tests/ Parser/ Handler/ AbstractHandlerTest.php - CommentHandlerTest.php in vendor/
symfony/ css-selector/ Tests/ Parser/ Handler/ CommentHandlerTest.php - FunctionNode.php in vendor/
symfony/ css-selector/ Node/ FunctionNode.php - FunctionNodeTest.php in vendor/
symfony/ css-selector/ Tests/ Node/ FunctionNodeTest.php - HashHandler.php in vendor/
symfony/ css-selector/ Parser/ Handler/ HashHandler.php
File
- vendor/
symfony/ css-selector/ Parser/ Token.php, line 22
Namespace
Symfony\Component\CssSelector\ParserView source
class Token {
const TYPE_FILE_END = 'eof';
const TYPE_DELIMITER = 'delimiter';
const TYPE_WHITESPACE = 'whitespace';
const TYPE_IDENTIFIER = 'identifier';
const TYPE_HASH = 'hash';
const TYPE_NUMBER = 'number';
const TYPE_STRING = 'string';
/**
* @var int
*/
private $type;
/**
* @var string
*/
private $value;
/**
* @var int
*/
private $position;
/**
* @param int $type
* @param string $value
* @param int $position
*/
public function __construct($type, $value, $position) {
$this->type = $type;
$this->value = $value;
$this->position = $position;
}
/**
* @return int
*/
public function getType() {
return $this->type;
}
/**
* @return string
*/
public function getValue() {
return $this->value;
}
/**
* @return int
*/
public function getPosition() {
return $this->position;
}
/**
* @return bool
*/
public function isFileEnd() {
return self::TYPE_FILE_END === $this->type;
}
/**
* @param array $values
*
* @return bool
*/
public function isDelimiter(array $values = array()) {
if (self::TYPE_DELIMITER !== $this->type) {
return false;
}
if (empty($values)) {
return true;
}
return in_array($this->value, $values);
}
/**
* @return bool
*/
public function isWhitespace() {
return self::TYPE_WHITESPACE === $this->type;
}
/**
* @return bool
*/
public function isIdentifier() {
return self::TYPE_IDENTIFIER === $this->type;
}
/**
* @return bool
*/
public function isHash() {
return self::TYPE_HASH === $this->type;
}
/**
* @return bool
*/
public function isNumber() {
return self::TYPE_NUMBER === $this->type;
}
/**
* @return bool
*/
public function isString() {
return self::TYPE_STRING === $this->type;
}
/**
* @return string
*/
public function __toString() {
if ($this->value) {
return sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position);
}
return sprintf('<%s at %s>', $this->type, $this->position);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Token:: |
private | property | ||
Token:: |
private | property | ||
Token:: |
private | property | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
public | function | ||
Token:: |
constant | |||
Token:: |
constant | |||
Token:: |
constant | |||
Token:: |
constant | |||
Token:: |
constant | |||
Token:: |
constant | |||
Token:: |
constant | |||
Token:: |
public | function | ||
Token:: |
public | function |