| 1 | <?php |
||
| 5 | class Token |
||
| 6 | { |
||
| 7 | const T_CONTENT = 1; |
||
| 8 | const T_DELIMITER = 2; |
||
| 9 | const T_NEW_LINE = 3; |
||
| 10 | const T_QUOTE = 4; |
||
| 11 | const T_NULL = 5; |
||
| 12 | const T_ESCAPE = 6; |
||
| 13 | const T_DOUBLE_QUOTE = 7; |
||
| 14 | |||
| 15 | /** @var int */ |
||
| 16 | private $type; |
||
| 17 | /** @var string */ |
||
| 18 | private $content; |
||
| 19 | /** @var int */ |
||
| 20 | private $position; |
||
| 21 | /** @var int */ |
||
| 22 | private $length; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Token constructor. |
||
| 26 | * |
||
| 27 | * @param int $type |
||
| 28 | * @param string $content |
||
| 29 | * @param int $position |
||
| 30 | */ |
||
| 31 | 13 | public function __construct($type, $content, $position) |
|
| 38 | |||
| 39 | /** |
||
| 40 | * @return int |
||
| 41 | */ |
||
| 42 | 13 | public function getType() |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 13 | public function getContent() |
|
| 54 | |||
| 55 | /** |
||
| 56 | * @return int |
||
| 57 | */ |
||
| 58 | 13 | public function getLength() |
|
| 62 | |||
| 63 | /** |
||
| 64 | * @return int |
||
| 65 | */ |
||
| 66 | 5 | public function getPosition() |
|
| 70 | |||
| 71 | /** |
||
| 72 | * Append some content onto this content |
||
| 73 | * |
||
| 74 | * @param string $content |
||
| 75 | * |
||
| 76 | * @return static |
||
| 77 | */ |
||
| 78 | 13 | public function addContent($content) |
|
| 84 | } |
||
| 85 |