Token.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Symfony\Components\CssSelector;
  3. /*
  4. * This file is part of the Symfony package.
  5. *
  6. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. /**
  12. * Token represents a CSS Selector token.
  13. *
  14. * This component is a port of the Python lxml library,
  15. * which is copyright Infrae and distributed under the BSD license.
  16. *
  17. * @package Symfony
  18. * @subpackage Components_CssSelector
  19. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  20. */
  21. class Token
  22. {
  23. protected $type;
  24. protected $value;
  25. protected $position;
  26. public function __construct($type, $value, $position)
  27. {
  28. $this->type = $type;
  29. $this->value = $value;
  30. $this->position = $position;
  31. }
  32. public function __toString()
  33. {
  34. return (string) $this->value;
  35. }
  36. public function isType($type)
  37. {
  38. return $this->type == $type;
  39. }
  40. public function getPosition()
  41. {
  42. return $this->position;
  43. }
  44. }