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