File tree 2 files changed +4
-24
lines changed
2 files changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ CHANGE LOG
7
7
* Use PSR-7, PSR-17 and PSR-18 only
8
8
* Update against latest API spec
9
9
* Refactored exceptions and internals
10
+ * Encode URIs according to RFC 3986
10
11
11
12
12
13
## V2.1.5 (29/06/2020)
Original file line number Diff line number Diff line change 24
24
*/
25
25
final class UriBuilder
26
26
{
27
- /**
28
- * The URI part separator.
29
- *
30
- * @var string
31
- */
32
- private const URI_SEPARATOR = '/ ' ;
33
-
34
27
/**
35
28
* Build a URI from the given parts.
36
29
*
@@ -45,10 +38,10 @@ public static function build(string ...$parts)
45
38
throw new ValueError (sprintf ('%s::buildUri(): Argument #%d ($parts) must non-empty ' , self ::class, $ index + 1 ));
46
39
}
47
40
48
- $ parts [$ index ] = self :: encodePart ($ part );
41
+ $ parts [$ index ] = rawurlencode ($ part );
49
42
}
50
43
51
- return implode (self :: URI_SEPARATOR , $ parts );
44
+ return implode (' / ' , $ parts );
52
45
}
53
46
54
47
/**
@@ -60,20 +53,6 @@ public static function build(string ...$parts)
60
53
*/
61
54
public static function appendSeparator (string $ uri )
62
55
{
63
- return sprintf ('%s%s ' , $ uri , self ::URI_SEPARATOR );
64
- }
65
-
66
- /**
67
- * Encode the given part for a URI.
68
- *
69
- * @param string $part
70
- *
71
- * @return string
72
- */
73
- private static function encodePart (string $ part )
74
- {
75
- $ part = rawurlencode ($ part );
76
-
77
- return str_replace ('. ' , '%2E ' , $ part );
56
+ return sprintf ('%s%s ' , $ uri , '/ ' );
78
57
}
79
58
}
You can’t perform that action at this time.
0 commit comments