1 | <?php |
||
13 | class TokensIterator extends ArrayIterator |
||
14 | { |
||
15 | /** |
||
16 | * @param mixed $token |
||
17 | * @param int $tokenType |
||
18 | * |
||
19 | * @return bool |
||
20 | */ |
||
21 | public static function isToken($token, $tokenType) |
||
25 | |||
26 | /** |
||
27 | * @param mixed $token |
||
28 | * @param int[] $tokenTypes |
||
29 | * |
||
30 | * @return bool |
||
31 | */ |
||
32 | public static function isOneOfTokens($token, array $tokenTypes) |
||
36 | |||
37 | /** |
||
38 | * @param string $contents Contents of PHP file to tokenize |
||
39 | * |
||
40 | * @return TokensIterator |
||
41 | */ |
||
42 | public static function fromContents($contents) |
||
46 | |||
47 | /** |
||
48 | * @param string $filePath Path to PHP file to tokenize |
||
49 | * |
||
50 | * @return TokensIterator |
||
51 | */ |
||
52 | public static function fromFile($filePath) |
||
56 | |||
57 | /** |
||
58 | * @throws UnexpectedEndOfTokens |
||
59 | */ |
||
60 | public function skipNextBlock() |
||
65 | |||
66 | /** |
||
67 | * @throws UnexpectedEndOfTokens |
||
68 | */ |
||
69 | public function findNextBlock() |
||
81 | |||
82 | /** |
||
83 | * @throws UnexpectedEndOfTokens |
||
84 | */ |
||
85 | public function skipBlock() |
||
107 | |||
108 | public function skipWhitespaces() |
||
112 | |||
113 | public function skipTokensIfPresent(array $tokenTypes) |
||
119 | |||
120 | /** |
||
121 | * @param int $tokenType |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | public function currentIs($tokenType) |
||
129 | |||
130 | /** |
||
131 | * @param int[] $tokenTypes |
||
132 | * |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function currentIsOneOf(array $tokenTypes) |
||
139 | } |
||
140 |