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 | 1 | public function decode($string) |
|
22 | { |
||
23 | 1 | $decoded = []; |
|
24 | |||
25 | 1 | foreach (explode(DIRECTORY_SEPARATOR, $string) as $word) { |
|
26 | 1 | if (false === $this->isASafeString($word)) { |
|
27 | 1 | $word = urldecode($word); |
|
28 | } |
||
29 | |||
30 | 1 | $decoded[] = $word; |
|
31 | } |
||
32 | |||
33 | 1 | return implode(DIRECTORY_SEPARATOR, $decoded); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param string $string |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | 5 | public function encode($string) |
|
54 | } |
||
55 | } |
||
56 |