* * 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 token. * * 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 * * @internal */ 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'; private $type; private $value; 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; } /** * @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); } } __halt_compiler();----SIGNATURE:----R3hh4DsRl+y2IHiSfFbGfoudiyN+Tz4J9fwFA2diQzGKy59CizJqWuchM24dHZ/iwXJ2xkqshUsXMKNcFJ2XarXVerKTfKeECLYsUiOVTXu67dq9+iwS1EmqPizWxHqjM2kFEjK53ReB3JmaAlQiDlyCpz9DhcfGOLZPZtxNaiXxJkV7cLTDBBjk3/BPWDyXcuSNap4lKZcoLYjeIcEtah4esCtjxpGWHXXxdABHWpr2sArzZynOfY0oxxDEJ0mTTxuL5vLfSstcYIwt+XdUuI41bZmFtKRy/A7Y/cTV0IEhazJ4XxZu9HIXLZ/MucI7lvG9nkPcuTWeDhyaWja2BJLYJ0yxUywce9W7cbq+6uwL0WBJLvnMuRBlERr+5ld+yqVt3NfkkoA4MSAwTR+c1r9StsZvDTSvwZEQjb3kH23vyjypnFeGLr7ExC9qu6WlvLEePTWxLmmRwy7lKFbPiMU3QnFSiqbzMHhK5Dd5Rnwr9P95e/unWTPZ6iJ1T/ay0QP4kriGbL8lGQas5MZGbmhuMjCc2k0Qb3jSwk+uDT7zFsLrRyAtF2qLxXz7vl9ULXoHU5l5qElO7+s2oqGpnEBni76wej/sT1hSlerKK1KUQDYTK5t1P4pSK+G4pqVRzAS/S5qpwtWFsQ68NMQ+RABNhFPQTo0rGb/v85LMxdU=----ATTACHMENT:----NTk4MjE4OTk0NDc3MjM1OCA3NTQ0NDgwMzQyNjM2Mzc4IDUyNDkxODQwNTEyOTk2MTU=