| Conditions | 2 |
| Paths | 1 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 29 | public static function format(array $data): array |
||
| 30 | { |
||
| 31 | 2 | return self::applyFilter(function ($var) { |
|
| 32 | 2 | $regex = '/(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])/x'; |
|
| 33 | 2 | $words = preg_split($regex, $var, $limit = -1, PREG_SPLIT_NO_EMPTY); |
|
| 34 | |||
| 35 | 2 | if (!empty($words)) { |
|
| 36 | 2 | return implode(' ', $words); |
|
| 37 | }; |
||
| 38 | 1 | return $var; |
|
| 39 | 2 | }, $data); |
|
| 40 | } |
||
| 41 | } |
||
| 42 |