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 $pattern a regular expression pattern |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 1512 | protected static function encode($str, $pattern) |
|
81 | |||
82 | /** |
||
83 | * Encode a path string according to RFC3986 |
||
84 | * |
||
85 | * @param string $str can be a string or an array |
||
86 | * |
||
87 | * @return string The same type as the input parameter |
||
88 | */ |
||
89 | 1238 | protected static function encodePath($str) |
|
93 | |||
94 | /** |
||
95 | * Encode a string according to RFC3986 Rules |
||
96 | * |
||
97 | * @param string $str |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 696 | protected static function encodeQueryFragment($str) |
|
105 | |||
106 | /** |
||
107 | * Decode a component string |
||
108 | * |
||
109 | * @param string $str The string to decode |
||
110 | * @param string $pattern a regular expression pattern |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | 1669 | protected static function decode($str, $pattern) |
|
128 | |||
129 | /** |
||
130 | * Decode a component according to RFC3986 |
||
131 | * |
||
132 | * @param string $str |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | 1038 | protected static function decodeComponent($str) |
|
140 | |||
141 | /** |
||
142 | * Decode a path component according to RFC3986 |
||
143 | * |
||
144 | * @param string $str |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | 1218 | protected static function decodePath($str) |
|
152 | } |
||
153 |