Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function format(string $subject): string |
||
14 | { |
||
15 | $regex = '/(?<=[a-z])(?=[A-Z])|(?<=[A-Z\.])(?=[A-Z][a-z])/x'; |
||
16 | $words = preg_split($regex, $subject, limit: -1, flags: PREG_SPLIT_NO_EMPTY); |
||
17 | |||
18 | if (!empty($words)) { |
||
19 | return implode($this->delimiter, $words); |
||
20 | }; |
||
21 | return $subject; |
||
22 | } |
||
24 |