1 | <?php |
||
21 | trait TranscoderTrait |
||
22 | { |
||
23 | /** |
||
24 | * Encoded Characters regular expression pattern |
||
25 | * |
||
26 | * @see http://tools.ietf.org/html/rfc3986#section-2.1 |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected static $encodedChars = '[A-Fa-f0-9]{2}'; |
||
31 | |||
32 | /** |
||
33 | * RFC3986 Sub delimiter characters regular expression pattern |
||
34 | * |
||
35 | * @see http://tools.ietf.org/html/rfc3986#section-2.2 |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected static $subdelimChars = "\!\$&'\(\)\*\+,;\=%"; |
||
40 | |||
41 | /** |
||
42 | * RFC3986 unreserved characters regular expression pattern |
||
43 | * |
||
44 | * @see http://tools.ietf.org/html/rfc3986#section-2.3 |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected static $unreservedChars = 'A-Za-z0-9_\-\.~'; |
||
49 | |||
50 | /** |
||
51 | * RFC3986 unreserved characters encoded regular expression pattern |
||
52 | * |
||
53 | * @see http://tools.ietf.org/html/rfc3986#section-2.3 |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected static $unreservedCharsEncoded = '2[D|E]|3[0-9]|4[1-9|A-F]|5[0-9|A|F]|6[1-9|A-F]|7[0-9|E]'; |
||
58 | |||
59 | /** |
||
60 | * Encode a component string |
||
61 | * |
||
62 | * @param string $str The string to encode |
||
63 | * @param string $regexp a regular expression |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 1530 | protected static function encode($str, $regexp) |
|
80 | |||
81 | /** |
||
82 | * Encode a path string according to RFC3986 |
||
83 | * |
||
84 | * @param string $str can be a string or an array |
||
85 | * |
||
86 | * @return string The same type as the input parameter |
||
87 | */ |
||
88 | 1238 | protected static function encodePath($str) |
|
95 | |||
96 | /** |
||
97 | * Decode a component string |
||
98 | * |
||
99 | * @param string $str The string to decode |
||
100 | * @param string $pattern a regular expression pattern |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 1687 | protected static function decode($str, $pattern) |
|
118 | |||
119 | /** |
||
120 | * Decode a component according to RFC3986 |
||
121 | * |
||
122 | * @param string $str |
||
123 | * |
||
124 | * @return string |
||
125 | */ |
||
126 | 1056 | protected static function decodeComponent($str) |
|
130 | |||
131 | /** |
||
132 | * Decode a path component according to RFC3986 |
||
133 | * |
||
134 | * @param string $str |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | 1218 | protected static function decodePath($str) |
|
142 | } |
||
143 |