| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 50 | public static function tokenize(string $period) : array |
|
| 26 | { |
||
| 27 | 50 | $chars = str_split(rtrim(ltrim($period))); |
|
| 28 | 50 | $words = $temp = []; |
|
| 29 | |||
| 30 | 50 | foreach ($chars as $char) { |
|
| 31 | 50 | if (in_array(ord($char), [32, 44, 58, 59])) { |
|
| 32 | 50 | $words[] = implode('', $temp); |
|
| 33 | 50 | $temp = []; |
|
| 34 | 50 | continue; |
|
| 35 | } |
||
| 36 | |||
| 37 | 50 | $temp[] = $char; |
|
| 38 | } |
||
| 39 | |||
| 40 | 50 | $words[] = implode('', $temp); |
|
| 41 | |||
| 42 | 50 | return array_values(array_filter($words, 'trim')); |
|
| 43 | } |
||
| 45 |