| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 12 | 
| Code Lines | 6 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 7 | 
| CRAP Score | 2 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 22 | 42 | public function apply(string $string): string  | 
            |
| 23 |     { | 
            ||
| 24 | // if value contains no non-space characters  | 
            ||
| 25 | 42 |         if (preg_match('/^\p{Zs}*$/u', $string)) { | 
            |
| 26 | 7 | return ' ';  | 
            |
| 27 | }  | 
            ||
| 28 | // trim leading and trailing spaces  | 
            ||
| 29 | 35 |         $string = preg_replace('/^\p{Zs}+/u', '', $string); | 
            |
| 30 | 35 |         $string = preg_replace('/\p{Zs}+$/u', '', $string); | 
            |
| 31 | // convert inner space sequences to two U+0020 characters  | 
            ||
| 32 | 35 |         $string = preg_replace('/\p{Zs}+/u', '  ', $string); | 
            |
| 33 | 35 |         return " {$string} "; | 
            |
| 34 | }  | 
            ||
| 36 |