| 1 | <?php |
||
| 19 | trait ChunkByDash |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Chuck the tokens, splitting on hyphen. |
||
| 23 | * |
||
| 24 | * @param Token[] $tokenList |
||
| 25 | * @param string $separator One of Token class constants |
||
| 26 | * |
||
| 27 | * @return Token[][] |
||
| 28 | */ |
||
| 29 | 11 | private function chunk(array $tokenList, $separator = Token::DASH_SEPARATOR) |
|
| 50 | } |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: