| Conditions | 4 |
| Paths | 6 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 43 | private function chunk( |
|
| 28 | array $tokenList, |
||
| 29 | array $separatorList |
||
| 30 | ) { |
||
| 31 | 43 | $chunkList = []; |
|
| 32 | 43 | $accumulator = []; |
|
| 33 | |||
| 34 | // Split token stream by dash separators |
||
| 35 | 43 | for ($i = 0; $i < count($tokenList); $i++) { |
|
| 36 | 43 | if (in_array($tokenList[$i]->getType(), $separatorList)) { |
|
| 37 | 23 | $chunkList[] = $accumulator; |
|
| 38 | 23 | $chunkList[] = [$tokenList[$i]]; |
|
| 39 | 23 | $accumulator = []; |
|
| 40 | 23 | } else { |
|
| 41 | 43 | $accumulator[] = $tokenList[$i]; |
|
| 42 | } |
||
| 43 | 43 | } |
|
| 44 | |||
| 45 | 43 | if (count($accumulator)) { |
|
| 46 | 43 | $chunkList[] = $accumulator; |
|
| 47 | 43 | } |
|
| 48 | |||
| 49 | 43 | return $chunkList; |
|
| 50 | } |
||
| 51 | } |
||
| 52 |