@@ -52,6 +52,9 @@ discard block |
||
| 52 | 52 | return array_keys(array_column($this->tokens, 'type'), $tokenType); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @return integer|null |
|
| 57 | + */ |
|
| 55 | 58 | private function getKeyToSlice($tokenType) { |
| 56 | 59 | $keys = $this->getKeysOfTokenType($tokenType); |
| 57 | 60 | if (empty($keys)) return false; |
@@ -68,6 +71,9 @@ discard block |
||
| 68 | 71 | return $this->sliceTokens($tokenType, "to", $inclusive); |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $type |
|
| 76 | + */ |
|
| 71 | 77 | private function sliceTokens($tokenType, $type, $increment = false) { |
| 72 | 78 | $key = $this->getKeyToSlice($tokenType); |
| 73 | 79 | if ($key === false) return new Tokens([]); |
@@ -76,6 +82,9 @@ discard block |
||
| 76 | 82 | else return new Tokens(array_slice($this->tokens, $this->iterator, $key)); |
| 77 | 83 | } |
| 78 | 84 | |
| 85 | + /** |
|
| 86 | + * @param integer $count |
|
| 87 | + */ |
|
| 79 | 88 | public function skip($count) { |
| 80 | 89 | $this->iterator += $count; |
| 81 | 90 | } |