1 | <?php |
||
7 | abstract class AbstractToken implements Token |
||
8 | { |
||
9 | /** @var int */ |
||
10 | private $depth; |
||
11 | |||
12 | /** @var int */ |
||
13 | protected $line; |
||
14 | |||
15 | /** @var null|Token */ |
||
16 | private $parent; |
||
17 | |||
18 | /** @var int */ |
||
19 | protected $position; |
||
20 | |||
21 | /** @var boolean */ |
||
22 | private $throwOnError; |
||
23 | |||
24 | /** @var string */ |
||
25 | private $type; |
||
26 | |||
27 | /** @var string */ |
||
28 | protected $value; |
||
29 | |||
30 | /** |
||
31 | * Constructor |
||
32 | * |
||
33 | * @param string $type |
||
34 | * @param Token|null $parent |
||
35 | * @param bool $throwOnError |
||
36 | * |
||
37 | * @throws \InvalidArgumentException |
||
38 | */ |
||
39 | 116 | public function __construct(string $type, Token $parent = null, bool $throwOnError = false) |
|
57 | |||
58 | 43 | public function getDepth() : int |
|
62 | |||
63 | /** |
||
64 | * Getter for 'line'. |
||
65 | */ |
||
66 | 38 | public function getLine() : int |
|
70 | |||
71 | 19 | public function isClosingElementImplied(string $html) : bool |
|
75 | |||
76 | 28 | public function getParent() |
|
80 | |||
81 | /** |
||
82 | * Getter for 'position'. |
||
83 | */ |
||
84 | 38 | public function getPosition() : int |
|
88 | |||
89 | /** |
||
90 | * Getter for 'throwOnError'. |
||
91 | * |
||
92 | * @return boolean |
||
93 | */ |
||
94 | 38 | protected function getThrowOnError() : bool |
|
98 | |||
99 | /** |
||
100 | * Getter for 'type'. |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 1 | public function getType() : string |
|
108 | |||
109 | /** |
||
110 | * Getter for "value" |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | 50 | public function getValue() : string |
|
118 | |||
119 | 1 | public function isCDATA() : bool |
|
123 | |||
124 | 1 | public function isComment() : bool |
|
128 | |||
129 | 1 | public function isDocType() : bool |
|
133 | |||
134 | 1 | public function isElement() : bool |
|
138 | |||
139 | 1 | public function isPhp() : bool |
|
143 | |||
144 | 23 | public function isText() : bool |
|
148 | |||
149 | 116 | protected function isValidType(string $type) : bool |
|
158 | |||
159 | 90 | protected function setTokenPosition(string $html) |
|
165 | } |
||
166 |