| Total Complexity | 6 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class UrlEncoder extends SafeNameEncoder |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @param string $string |
||
| 18 | * |
||
| 19 | * @return string |
||
| 20 | */ |
||
| 21 | 9 | public function decode(string $string): string |
|
| 22 | { |
||
| 23 | 9 | $decoded = []; |
|
| 24 | |||
| 25 | 9 | foreach (explode(DIRECTORY_SEPARATOR, $string) as $word) { |
|
| 26 | 9 | if (false === $this->isASafeString($word)) { |
|
| 27 | 6 | $word = urldecode($word); |
|
| 28 | } |
||
| 29 | |||
| 30 | 9 | $decoded[] = $word; |
|
| 31 | } |
||
| 32 | |||
| 33 | 9 | return implode(DIRECTORY_SEPARATOR, $decoded); |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $string |
||
| 38 | * |
||
| 39 | * @return string |
||
| 40 | */ |
||
| 41 | 26 | public function encode(string $string): string |
|
| 54 | } |
||
| 55 | } |
||
| 56 |