Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 1 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
24 | 8 | public function format(): string |
|
25 | { |
||
26 | 8 | $words = str($this->name)->split('/\s/'); |
|
27 | |||
28 | 8 | $this->name = $words->map(function (string $word) { |
|
29 | 8 | return str($word)->ucfirst(); |
|
30 | 8 | })->join(' '); |
|
31 | |||
32 | 8 | return str($this->name) |
|
33 | 8 | ->replaceMatches('/\p{C}+/u', '') |
|
34 | 8 | ->squish() |
|
35 | 8 | ->value(); |
|
36 | } |
||
38 |