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