This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/CssSelector/Token.php

74 lines
1.5 KiB
PHP
Raw Normal View History

2010-03-31 07:42:18 +01:00
<?php
/*
* This file is part of the Symfony package.
2010-03-31 07:42:18 +01:00
*
* (c) Fabien Potencier <fabien@symfony.com>
2010-03-31 07:42:18 +01:00
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector;
2010-03-31 07:42:18 +01:00
/**
* Token represents a CSS Selector token.
*
* This component is a port of the Python lxml library,
* which is copyright Infrae and distributed under the BSD license.
*
* @author Fabien Potencier <fabien@symfony.com>
2010-03-31 07:42:18 +01:00
*/
class Token
{
private $type;
private $value;
private $position;
2010-03-31 07:42:18 +01:00
/**
* Constructor.
*
* @param string $type The type of this token.
* @param mixed $value The value of this token.
* @param integer $position The order of this token.
*/
public function __construct($type, $value, $position)
{
$this->type = $type;
$this->value = $value;
$this->position = $position;
}
2010-03-31 07:42:18 +01:00
/**
* Gets a string representation of this token.
*
* @return string
*/
public function __toString()
{
return (string) $this->value;
}
2010-03-31 07:42:18 +01:00
/**
2011-02-05 22:52:16 +00:00
* Answers whether this token's type equals to $type.
*
* @param string $type The type to test against this token's one.
*
* @return Boolean
*/
public function isType($type)
{
return $this->type == $type;
}
2010-03-31 07:42:18 +01:00
/**
* Gets the position of this token.
*
* @return integer
*/
public function getPosition()
{
return $this->position;
}
2010-03-31 07:42:18 +01:00
}