| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 26 | public function encode(string $string): string |
|
| 42 | { |
||
| 43 | 26 | $encoded = []; |
|
| 44 | |||
| 45 | 26 | foreach (explode(DIRECTORY_SEPARATOR, $string) as $word) { |
|
| 46 | 26 | if (false === $this->isASafeString($word)) { |
|
| 47 | 14 | $word = urlencode($word); |
|
| 48 | } |
||
| 49 | |||
| 50 | 26 | $encoded[] = $word; |
|
| 51 | } |
||
| 52 | |||
| 53 | 26 | return implode(DIRECTORY_SEPARATOR, $encoded); |
|
| 54 | } |
||
| 56 |