@@ -119,7 +119,7 @@ |
||
119 | 119 | * |
120 | 120 | * @param int $offset the label offset to remove and replace by |
121 | 121 | * the given component |
122 | - * @param HierarchicalComponent|string $component the component added |
|
122 | + * @param string|null $component the component added |
|
123 | 123 | * |
124 | 124 | * @return static |
125 | 125 | */ |
@@ -54,7 +54,7 @@ |
||
54 | 54 | */ |
55 | 55 | protected function decodeUriPart($uri, $property) |
56 | 56 | { |
57 | - $decoder = function (array $matches) { |
|
57 | + $decoder = function(array $matches) { |
|
58 | 58 | return rawurldecode($matches[0]); |
59 | 59 | }; |
60 | 60 |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $encodingType = $this->validateEncodingType($encodingType); |
122 | 122 | $encoder = $this->getEncoder($encodingType, $separator); |
123 | - $arr = array_map(function ($value) { |
|
123 | + $arr = array_map(function($value) { |
|
124 | 124 | return !is_array($value) ? [$value] : $value; |
125 | 125 | }, $arr); |
126 | 126 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function buildPair(callable $encoder, array $value, $key) |
145 | 145 | { |
146 | - $reducer = function (array $carry, $data) use ($key, $encoder) { |
|
146 | + $reducer = function(array $carry, $data) use ($key, $encoder) { |
|
147 | 147 | $pair = $key; |
148 | 148 | if (null !== $data) { |
149 | 149 | $pair .= '='.call_user_func($encoder, $data); |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | if (PHP_QUERY_RFC3986 === $encodingType) { |
174 | - return function ($str) use ($regexp) { |
|
174 | + return function($str) use ($regexp) { |
|
175 | 175 | return $this->encode($str, $regexp); |
176 | 176 | }; |
177 | 177 | } |
178 | 178 | |
179 | 179 | if (PHP_QUERY_RFC1738 === $encodingType) { |
180 | - return function ($str) use ($regexp) { |
|
180 | + return function($str) use ($regexp) { |
|
181 | 181 | return str_replace(['+', '~'], ['%2B', '%7E'], $this->encode($str, $regexp)); |
182 | 182 | }; |
183 | 183 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | return [$this, 'decodeComponent']; |
199 | 199 | } |
200 | 200 | |
201 | - return function ($value) { |
|
201 | + return function($value) { |
|
202 | 202 | return $this->decodeComponent(str_replace('+', ' ', $value)); |
203 | 203 | }; |
204 | 204 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | protected static function encode($str, $regexp) |
68 | 68 | { |
69 | - $encoder = function (array $matches) { |
|
69 | + $encoder = function(array $matches) { |
|
70 | 70 | if (preg_match('/^[A-Za-z0-9_\-\.~]$/', rawurldecode($matches[0]))) { |
71 | 71 | return $matches[0]; |
72 | 72 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | protected static function decode($str, $pattern) |
104 | 104 | { |
105 | 105 | $regexp = ',%'.$pattern.',i'; |
106 | - $decoder = function (array $matches) use ($regexp) { |
|
106 | + $decoder = function(array $matches) use ($regexp) { |
|
107 | 107 | if (preg_match($regexp, $matches[0])) { |
108 | 108 | return strtoupper($matches[0]); |
109 | 109 | } |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | { |
65 | 65 | $host = $this->lower($this->setIsAbsolute($str)); |
66 | 66 | $raw_labels = explode('.', $host); |
67 | - $labels = array_map(function ($value) { |
|
67 | + $labels = array_map(function($value) { |
|
68 | 68 | return idn_to_ascii($value); |
69 | 69 | }, $raw_labels); |
70 | 70 | |
71 | 71 | $this->assertValidHost($labels); |
72 | 72 | $this->isIdn = $raw_labels !== $labels; |
73 | 73 | |
74 | - return array_reverse(array_map(function ($label) { |
|
74 | + return array_reverse(array_map(function($label) { |
|
75 | 75 | return idn_to_utf8($label); |
76 | 76 | }, $labels)); |
77 | 77 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | protected function lower($str) |
96 | 96 | { |
97 | - return preg_replace_callback('/[A-Z]+/', function ($matches) { |
|
97 | + return preg_replace_callback('/[A-Z]+/', function($matches) { |
|
98 | 98 | return strtolower($matches[0]); |
99 | 99 | }, $str); |
100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function assertValidHost(array $labels) |
110 | 110 | { |
111 | - $verifs = array_filter($labels, function ($value) { |
|
111 | + $verifs = array_filter($labels, function($value) { |
|
112 | 112 | return '' !== trim($value); |
113 | 113 | }); |
114 | 114 |
@@ -136,7 +136,7 @@ |
||
136 | 136 | return false; |
137 | 137 | } |
138 | 138 | |
139 | - $convert = function ($carry, $char) { |
|
139 | + $convert = function($carry, $char) { |
|
140 | 140 | return $carry.str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT); |
141 | 141 | }; |
142 | 142 | $res = array_reduce(str_split(unpack('A16', inet_pton($ipv6))[1]), $convert, ''); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $data = $this->filterEncodedPath($data); |
117 | 117 | |
118 | - $filterSegment = function ($segment) { |
|
118 | + $filterSegment = function($segment) { |
|
119 | 119 | return isset($segment); |
120 | 120 | }; |
121 | 121 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function getExtension() |
264 | 264 | { |
265 | - list($basename, ) = explode(';', $this->getBasename(), 2); |
|
265 | + list($basename,) = explode(';', $this->getBasename(), 2); |
|
266 | 266 | |
267 | 267 | return pathinfo($basename, PATHINFO_EXTENSION); |
268 | 268 | } |
@@ -273,7 +273,7 @@ |
||
273 | 273 | $this->userInfo->getContent(), |
274 | 274 | $this->host->getContent(), |
275 | 275 | $this->port->getContent(), |
276 | - ], function ($value) { |
|
276 | + ], function($value) { |
|
277 | 277 | return null !== $value; |
278 | 278 | }); |
279 | 279 |