@@ -22,6 +22,6 @@ |
||
22 | 22 | */ |
23 | 23 | public function perform(): void |
24 | 24 | { |
25 | - throw new Exception('Unhandled failed command error at ' . __METHOD__ . ' (line ' . __LINE__ . ')'); |
|
25 | + throw new Exception('Unhandled failed command error at '.__METHOD__.' (line '.__LINE__.')'); |
|
26 | 26 | } |
27 | 27 | } |
@@ -22,6 +22,6 @@ |
||
22 | 22 | |
23 | 23 | public function perform(): void |
24 | 24 | { |
25 | - $this->write('Hello World - ' . ($this->count++)); |
|
25 | + $this->write('Hello World - '.($this->count++)); |
|
26 | 26 | } |
27 | 27 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | public function perform(): void |
28 | 28 | { |
29 | - switch ($this->argument('helper')) { |
|
29 | + switch ($this->argument('helper')){ |
|
30 | 30 | case 'verbose': |
31 | 31 | $this->write($this->isVerbose() ? 'true' : 'false'); |
32 | 32 | break; |
@@ -26,7 +26,8 @@ |
||
26 | 26 | |
27 | 27 | public function perform(): void |
28 | 28 | { |
29 | - switch ($this->argument('helper')) { |
|
29 | + switch ($this->argument('helper')) |
|
30 | + { |
|
30 | 31 | case 'verbose': |
31 | 32 | $this->write($this->isVerbose() ? 'true' : 'false'); |
32 | 33 | break; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | class StreamsTest extends TestCase |
18 | 18 | { |
19 | - private const FIXTURE_DIRECTORY = __DIR__ . '/fixtures'; |
|
19 | + private const FIXTURE_DIRECTORY = __DIR__.'/fixtures'; |
|
20 | 20 | |
21 | 21 | public function setUp(): void |
22 | 22 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->assertSame(strlen('sample text'), filesize($filename)); |
42 | 42 | $this->assertSame(md5('sample text'), md5_file($filename)); |
43 | 43 | |
44 | - $newFilename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
44 | + $newFilename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
45 | 45 | copy($filename, $newFilename); |
46 | 46 | |
47 | 47 | $this->assertFileExists($newFilename); |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | |
80 | 80 | public function testException() |
81 | 81 | { |
82 | - try { |
|
82 | + try{ |
|
83 | 83 | fopen('spiral://non-exists', 'rb'); |
84 | - } catch (\Throwable $e) { |
|
84 | + }catch (\Throwable $e){ |
|
85 | 85 | $this->assertStringContainsString('failed to open stream', $e->getMessage()); |
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | - try { |
|
89 | + try{ |
|
90 | 90 | filemtime('spiral://non-exists'); |
91 | - } catch (\Throwable $e) { |
|
91 | + }catch (\Throwable $e){ |
|
92 | 92 | $this->assertStringContainsString('stat failed', $e->getMessage()); |
93 | 93 | } |
94 | 94 | } |
@@ -79,16 +79,22 @@ |
||
79 | 79 | |
80 | 80 | public function testException() |
81 | 81 | { |
82 | - try { |
|
82 | + try |
|
83 | + { |
|
83 | 84 | fopen('spiral://non-exists', 'rb'); |
84 | - } catch (\Throwable $e) { |
|
85 | + } |
|
86 | + catch (\Throwable $e) |
|
87 | + { |
|
85 | 88 | $this->assertStringContainsString('failed to open stream', $e->getMessage()); |
86 | 89 | } |
87 | 90 | |
88 | 91 | |
89 | - try { |
|
92 | + try |
|
93 | + { |
|
90 | 94 | filemtime('spiral://non-exists'); |
91 | - } catch (\Throwable $e) { |
|
95 | + } |
|
96 | + catch (\Throwable $e) |
|
97 | + { |
|
92 | 98 | $this->assertStringContainsString('stat failed', $e->getMessage()); |
93 | 99 | } |
94 | 100 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function stream_open($path, $mode, $options, &$opened_path) |
73 | 73 | { |
74 | - if (!isset(self::$uris[$path])) { |
|
74 | + if (!isset(self::$uris[$path])){ |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function url_stat($path, $flags) |
157 | 157 | { |
158 | - if (!isset(self::$uris[$path])) { |
|
158 | + if (!isset(self::$uris[$path])){ |
|
159 | 159 | return null; |
160 | 160 | } |
161 | 161 | |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | private function getStreamStats(StreamInterface $stream) |
172 | 172 | { |
173 | 173 | $mode = $this->mode; |
174 | - if (empty($mode)) { |
|
175 | - if ($stream->isReadable()) { |
|
174 | + if (empty($mode)){ |
|
175 | + if ($stream->isReadable()){ |
|
176 | 176 | $mode = 'r'; |
177 | 177 | } |
178 | 178 | |
179 | - if ($stream->isWritable()) { |
|
179 | + if ($stream->isWritable()){ |
|
180 | 180 | $mode = !empty($mode) ? 'r+' : 'w'; |
181 | 181 | } |
182 | 182 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function register() |
205 | 205 | { |
206 | - if (self::$registered) { |
|
206 | + if (self::$registered){ |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function has($file) |
221 | 221 | { |
222 | - if ($file instanceof StreamInterface) { |
|
223 | - $file = 'spiral://' . spl_object_hash($file); |
|
222 | + if ($file instanceof StreamInterface){ |
|
223 | + $file = 'spiral://'.spl_object_hash($file); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return isset(self::$uris[$file]); |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | public static function getResource(StreamInterface $stream) |
238 | 238 | { |
239 | 239 | $mode = null; |
240 | - if ($stream->isReadable()) { |
|
240 | + if ($stream->isReadable()){ |
|
241 | 241 | $mode = 'r'; |
242 | 242 | } |
243 | 243 | |
244 | - if ($stream->isWritable()) { |
|
244 | + if ($stream->isWritable()){ |
|
245 | 245 | $mode = !empty($mode) ? 'r+' : 'w'; |
246 | 246 | } |
247 | 247 | |
248 | - if (empty($mode)) { |
|
248 | + if (empty($mode)){ |
|
249 | 249 | throw new WrapperException("Stream is not available in read or write modes"); |
250 | 250 | } |
251 | 251 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | { |
263 | 263 | self::register(); |
264 | 264 | |
265 | - $uri = 'spiral://' . spl_object_hash($stream); |
|
265 | + $uri = 'spiral://'.spl_object_hash($stream); |
|
266 | 266 | self::$uris[$uri] = $stream; |
267 | 267 | |
268 | 268 | return $uri; |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public static function release($file) |
278 | 278 | { |
279 | - if ($file instanceof StreamInterface) { |
|
280 | - $file = 'spiral://' . spl_object_hash($file); |
|
279 | + if ($file instanceof StreamInterface){ |
|
280 | + $file = 'spiral://'.spl_object_hash($file); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | unset(self::$uris[$file]); |
@@ -71,7 +71,8 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function stream_open($path, $mode, $options, &$opened_path) |
73 | 73 | { |
74 | - if (!isset(self::$uris[$path])) { |
|
74 | + if (!isset(self::$uris[$path])) |
|
75 | + { |
|
75 | 76 | return false; |
76 | 77 | } |
77 | 78 | |
@@ -155,7 +156,8 @@ discard block |
||
155 | 156 | */ |
156 | 157 | public function url_stat($path, $flags) |
157 | 158 | { |
158 | - if (!isset(self::$uris[$path])) { |
|
159 | + if (!isset(self::$uris[$path])) |
|
160 | + { |
|
159 | 161 | return null; |
160 | 162 | } |
161 | 163 | |
@@ -171,12 +173,15 @@ discard block |
||
171 | 173 | private function getStreamStats(StreamInterface $stream) |
172 | 174 | { |
173 | 175 | $mode = $this->mode; |
174 | - if (empty($mode)) { |
|
175 | - if ($stream->isReadable()) { |
|
176 | + if (empty($mode)) |
|
177 | + { |
|
178 | + if ($stream->isReadable()) |
|
179 | + { |
|
176 | 180 | $mode = 'r'; |
177 | 181 | } |
178 | 182 | |
179 | - if ($stream->isWritable()) { |
|
183 | + if ($stream->isWritable()) |
|
184 | + { |
|
180 | 185 | $mode = !empty($mode) ? 'r+' : 'w'; |
181 | 186 | } |
182 | 187 | } |
@@ -203,7 +208,8 @@ discard block |
||
203 | 208 | */ |
204 | 209 | public static function register() |
205 | 210 | { |
206 | - if (self::$registered) { |
|
211 | + if (self::$registered) |
|
212 | + { |
|
207 | 213 | return; |
208 | 214 | } |
209 | 215 | |
@@ -219,7 +225,8 @@ discard block |
||
219 | 225 | */ |
220 | 226 | public static function has($file) |
221 | 227 | { |
222 | - if ($file instanceof StreamInterface) { |
|
228 | + if ($file instanceof StreamInterface) |
|
229 | + { |
|
223 | 230 | $file = 'spiral://' . spl_object_hash($file); |
224 | 231 | } |
225 | 232 | |
@@ -237,15 +244,18 @@ discard block |
||
237 | 244 | public static function getResource(StreamInterface $stream) |
238 | 245 | { |
239 | 246 | $mode = null; |
240 | - if ($stream->isReadable()) { |
|
247 | + if ($stream->isReadable()) |
|
248 | + { |
|
241 | 249 | $mode = 'r'; |
242 | 250 | } |
243 | 251 | |
244 | - if ($stream->isWritable()) { |
|
252 | + if ($stream->isWritable()) |
|
253 | + { |
|
245 | 254 | $mode = !empty($mode) ? 'r+' : 'w'; |
246 | 255 | } |
247 | 256 | |
248 | - if (empty($mode)) { |
|
257 | + if (empty($mode)) |
|
258 | + { |
|
249 | 259 | throw new WrapperException("Stream is not available in read or write modes"); |
250 | 260 | } |
251 | 261 | |
@@ -276,7 +286,8 @@ discard block |
||
276 | 286 | */ |
277 | 287 | public static function release($file) |
278 | 288 | { |
279 | - if ($file instanceof StreamInterface) { |
|
289 | + if ($file instanceof StreamInterface) |
|
290 | + { |
|
280 | 291 | $file = 'spiral://' . spl_object_hash($file); |
281 | 292 | } |
282 | 293 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $headers = $acceptHeader->getAll(); |
119 | 119 | $this->assertCount(count($expected), $headers); |
120 | 120 | |
121 | - foreach ($expected as $i => $value) { |
|
121 | + foreach ($expected as $i => $value){ |
|
122 | 122 | $this->assertSame($value, $headers[$i]->getValue()); |
123 | 123 | } |
124 | 124 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $headers = $acceptHeader->getAll(); |
165 | 165 | $this->assertCount(count($expected), $headers); |
166 | 166 | |
167 | - foreach ($expected as $i => $value) { |
|
167 | + foreach ($expected as $i => $value){ |
|
168 | 168 | $this->assertSame($value, (string)$headers[$i]); |
169 | 169 | } |
170 | 170 | } |
@@ -118,7 +118,8 @@ discard block |
||
118 | 118 | $headers = $acceptHeader->getAll(); |
119 | 119 | $this->assertCount(count($expected), $headers); |
120 | 120 | |
121 | - foreach ($expected as $i => $value) { |
|
121 | + foreach ($expected as $i => $value) |
|
122 | + { |
|
122 | 123 | $this->assertSame($value, $headers[$i]->getValue()); |
123 | 124 | } |
124 | 125 | } |
@@ -164,7 +165,8 @@ discard block |
||
164 | 165 | $headers = $acceptHeader->getAll(); |
165 | 166 | $this->assertCount(count($expected), $headers); |
166 | 167 | |
167 | - foreach ($expected as $i => $value) { |
|
168 | + foreach ($expected as $i => $value) |
|
169 | + { |
|
168 | 170 | $this->assertSame($value, (string)$headers[$i]); |
169 | 171 | } |
170 | 172 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $core = $this->getCore(); |
46 | 46 | |
47 | - $core->setHandler(function () { |
|
47 | + $core->setHandler(function (){ |
|
48 | 48 | return 'hello world'; |
49 | 49 | }); |
50 | 50 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function testHandlerInterface(): void |
74 | 74 | { |
75 | 75 | $core = $this->getCore(); |
76 | - $core->setHandler(new CallableHandler(function () { |
|
76 | + $core->setHandler(new CallableHandler(function (){ |
|
77 | 77 | return 'hello world'; |
78 | 78 | }, new ResponseFactory(new HttpConfig(['headers' => []])))); |
79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $core = $this->getCore(); |
87 | 87 | |
88 | - $core->setHandler(function ($req, $resp) { |
|
88 | + $core->setHandler(function ($req, $resp){ |
|
89 | 89 | return $resp->withAddedHeader('hello', 'value'); |
90 | 90 | }); |
91 | 91 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $core = $this->getCore(); |
100 | 100 | |
101 | - $core->setHandler(function ($req, $resp) { |
|
101 | + $core->setHandler(function ($req, $resp){ |
|
102 | 102 | echo 'hello!'; |
103 | 103 | |
104 | 104 | return $resp->withAddedHeader('hello', 'value'); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | $core = $this->getCore(); |
116 | 116 | |
117 | - $core->setHandler(function ($req, $resp) { |
|
117 | + $core->setHandler(function ($req, $resp){ |
|
118 | 118 | echo 'hello!'; |
119 | 119 | $resp->getBody()->write('world '); |
120 | 120 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | $core = $this->getCore(); |
133 | 133 | |
134 | - $core->setHandler(function () { |
|
134 | + $core->setHandler(function (){ |
|
135 | 135 | ob_start(); |
136 | 136 | ob_start(); |
137 | 137 | echo 'hello!'; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | $core = $this->getCore(); |
154 | 154 | |
155 | - $core->setHandler(function () { |
|
155 | + $core->setHandler(function (){ |
|
156 | 156 | return [ |
157 | 157 | 'status' => 404, |
158 | 158 | 'message' => 'not found', |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | { |
169 | 169 | $core = $this->getCore(); |
170 | 170 | |
171 | - $core->setHandler(function () { |
|
171 | + $core->setHandler(function (){ |
|
172 | 172 | return new Json([ |
173 | 173 | 'status' => 404, |
174 | 174 | 'message' => 'not found', |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | { |
185 | 185 | $core = $this->getCore([HeaderMiddleware::class]); |
186 | 186 | |
187 | - $core->setHandler(function () { |
|
187 | + $core->setHandler(function (){ |
|
188 | 188 | return 'hello?'; |
189 | 189 | }); |
190 | 190 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $core->getPipeline()->pushMiddleware(new Header2Middleware()); |
202 | 202 | $core->getPipeline()->riseMiddleware(new HeaderMiddleware()); |
203 | 203 | |
204 | - $core->setHandler(function () { |
|
204 | + $core->setHandler(function (){ |
|
205 | 205 | return 'hello?'; |
206 | 206 | }); |
207 | 207 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $core->getPipeline()->pushMiddleware(new HeaderMiddleware()); |
219 | 219 | $core->getPipeline()->riseMiddleware(new Header2Middleware()); |
220 | 220 | |
221 | - $core->setHandler(function () { |
|
221 | + $core->setHandler(function (){ |
|
222 | 222 | return 'hello?'; |
223 | 223 | }); |
224 | 224 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | { |
233 | 233 | $core = $this->getCore(); |
234 | 234 | |
235 | - $core->setHandler(function () { |
|
235 | + $core->setHandler(function (){ |
|
236 | 236 | $this->assertTrue($this->container->has(ServerRequestInterface::class)); |
237 | 237 | |
238 | 238 | return 'OK'; |
@@ -44,7 +44,8 @@ discard block |
||
44 | 44 | { |
45 | 45 | $core = $this->getCore(); |
46 | 46 | |
47 | - $core->setHandler(function () { |
|
47 | + $core->setHandler(function () |
|
48 | + { |
|
48 | 49 | return 'hello world'; |
49 | 50 | }); |
50 | 51 | |
@@ -73,7 +74,8 @@ discard block |
||
73 | 74 | public function testHandlerInterface(): void |
74 | 75 | { |
75 | 76 | $core = $this->getCore(); |
76 | - $core->setHandler(new CallableHandler(function () { |
|
77 | + $core->setHandler(new CallableHandler(function () |
|
78 | + { |
|
77 | 79 | return 'hello world'; |
78 | 80 | }, new ResponseFactory(new HttpConfig(['headers' => []])))); |
79 | 81 | |
@@ -85,7 +87,8 @@ discard block |
||
85 | 87 | { |
86 | 88 | $core = $this->getCore(); |
87 | 89 | |
88 | - $core->setHandler(function ($req, $resp) { |
|
90 | + $core->setHandler(function ($req, $resp) |
|
91 | + { |
|
89 | 92 | return $resp->withAddedHeader('hello', 'value'); |
90 | 93 | }); |
91 | 94 | |
@@ -98,7 +101,8 @@ discard block |
||
98 | 101 | { |
99 | 102 | $core = $this->getCore(); |
100 | 103 | |
101 | - $core->setHandler(function ($req, $resp) { |
|
104 | + $core->setHandler(function ($req, $resp) |
|
105 | + { |
|
102 | 106 | echo 'hello!'; |
103 | 107 | |
104 | 108 | return $resp->withAddedHeader('hello', 'value'); |
@@ -114,7 +118,8 @@ discard block |
||
114 | 118 | { |
115 | 119 | $core = $this->getCore(); |
116 | 120 | |
117 | - $core->setHandler(function ($req, $resp) { |
|
121 | + $core->setHandler(function ($req, $resp) |
|
122 | + { |
|
118 | 123 | echo 'hello!'; |
119 | 124 | $resp->getBody()->write('world '); |
120 | 125 | |
@@ -131,7 +136,8 @@ discard block |
||
131 | 136 | { |
132 | 137 | $core = $this->getCore(); |
133 | 138 | |
134 | - $core->setHandler(function () { |
|
139 | + $core->setHandler(function () |
|
140 | + { |
|
135 | 141 | ob_start(); |
136 | 142 | ob_start(); |
137 | 143 | echo 'hello!'; |
@@ -152,7 +158,8 @@ discard block |
||
152 | 158 | { |
153 | 159 | $core = $this->getCore(); |
154 | 160 | |
155 | - $core->setHandler(function () { |
|
161 | + $core->setHandler(function () |
|
162 | + { |
|
156 | 163 | return [ |
157 | 164 | 'status' => 404, |
158 | 165 | 'message' => 'not found', |
@@ -168,7 +175,8 @@ discard block |
||
168 | 175 | { |
169 | 176 | $core = $this->getCore(); |
170 | 177 | |
171 | - $core->setHandler(function () { |
|
178 | + $core->setHandler(function () |
|
179 | + { |
|
172 | 180 | return new Json([ |
173 | 181 | 'status' => 404, |
174 | 182 | 'message' => 'not found', |
@@ -184,7 +192,8 @@ discard block |
||
184 | 192 | { |
185 | 193 | $core = $this->getCore([HeaderMiddleware::class]); |
186 | 194 | |
187 | - $core->setHandler(function () { |
|
195 | + $core->setHandler(function () |
|
196 | + { |
|
188 | 197 | return 'hello?'; |
189 | 198 | }); |
190 | 199 | |
@@ -201,7 +210,8 @@ discard block |
||
201 | 210 | $core->getPipeline()->pushMiddleware(new Header2Middleware()); |
202 | 211 | $core->getPipeline()->riseMiddleware(new HeaderMiddleware()); |
203 | 212 | |
204 | - $core->setHandler(function () { |
|
213 | + $core->setHandler(function () |
|
214 | + { |
|
205 | 215 | return 'hello?'; |
206 | 216 | }); |
207 | 217 | |
@@ -218,7 +228,8 @@ discard block |
||
218 | 228 | $core->getPipeline()->pushMiddleware(new HeaderMiddleware()); |
219 | 229 | $core->getPipeline()->riseMiddleware(new Header2Middleware()); |
220 | 230 | |
221 | - $core->setHandler(function () { |
|
231 | + $core->setHandler(function () |
|
232 | + { |
|
222 | 233 | return 'hello?'; |
223 | 234 | }); |
224 | 235 | |
@@ -232,7 +243,8 @@ discard block |
||
232 | 243 | { |
233 | 244 | $core = $this->getCore(); |
234 | 245 | |
235 | - $core->setHandler(function () { |
|
246 | + $core->setHandler(function () |
|
247 | + { |
|
236 | 248 | $this->assertTrue($this->container->has(ServerRequestInterface::class)); |
237 | 249 | |
238 | 250 | return 'OK'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $pipeline = new Pipeline(new Container()); |
28 | 28 | |
29 | - $handler = new CallableHandler(function () { |
|
29 | + $handler = new CallableHandler(function (){ |
|
30 | 30 | return 'response'; |
31 | 31 | }, new ResponseFactory(new HttpConfig(['headers' => []]))); |
32 | 32 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $pipeline = new Pipeline(new Container()); |
43 | 43 | |
44 | - $handler = new CallableHandler(function () { |
|
44 | + $handler = new CallableHandler(function (){ |
|
45 | 45 | return 'response'; |
46 | 46 | }, new ResponseFactory(new HttpConfig(['headers' => []]))); |
47 | 47 |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | { |
27 | 27 | $pipeline = new Pipeline(new Container()); |
28 | 28 | |
29 | - $handler = new CallableHandler(function () { |
|
29 | + $handler = new CallableHandler(function () |
|
30 | + { |
|
30 | 31 | return 'response'; |
31 | 32 | }, new ResponseFactory(new HttpConfig(['headers' => []]))); |
32 | 33 | |
@@ -41,7 +42,8 @@ discard block |
||
41 | 42 | { |
42 | 43 | $pipeline = new Pipeline(new Container()); |
43 | 44 | |
44 | - $handler = new CallableHandler(function () { |
|
45 | + $handler = new CallableHandler(function () |
|
46 | + { |
|
45 | 47 | return 'response'; |
46 | 48 | }, new ResponseFactory(new HttpConfig(['headers' => []]))); |
47 | 49 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function emptyItemProvider(): iterable |
34 | 34 | { |
35 | 35 | $values = ['', ' ']; |
36 | - foreach ($values as $value) { |
|
36 | + foreach ($values as $value){ |
|
37 | 37 | yield from [ |
38 | 38 | [AcceptHeaderItem::fromString($value)], |
39 | 39 | [new AcceptHeaderItem($value)], |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function testItemQualityBoundaries(float $quality, AcceptHeaderItem $item): void |
84 | 84 | { |
85 | - if ($quality > 1) { |
|
85 | + if ($quality > 1){ |
|
86 | 86 | $this->assertSame(1.0, $item->getQuality()); |
87 | 87 | } |
88 | 88 | |
89 | - if ($quality < 0) { |
|
89 | + if ($quality < 0){ |
|
90 | 90 | $this->assertSame(0.0, $item->getQuality()); |
91 | 91 | } |
92 | 92 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public function qualityBoundariesProvider(): iterable |
101 | 101 | { |
102 | 102 | $qualities = [-1, 0, 0.5, 1, 2]; |
103 | - foreach ($qualities as $quality) { |
|
103 | + foreach ($qualities as $quality){ |
|
104 | 104 | yield from [ |
105 | 105 | [$quality, AcceptHeaderItem::fromString("*;q=$quality")], |
106 | 106 | [$quality, AcceptHeaderItem::fromString("*;Q=$quality")], |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | ] |
141 | 141 | ]; |
142 | 142 | |
143 | - foreach ($set as $params) { |
|
143 | + foreach ($set as $params){ |
|
144 | 144 | $formattedParams = []; |
145 | - foreach ($params['passed'] as $k => $v) { |
|
145 | + foreach ($params['passed'] as $k => $v){ |
|
146 | 146 | $formattedParams[] = "$k=$v"; |
147 | 147 | } |
148 | 148 |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | public function emptyItemProvider(): iterable |
34 | 34 | { |
35 | 35 | $values = ['', ' ']; |
36 | - foreach ($values as $value) { |
|
36 | + foreach ($values as $value) |
|
37 | + { |
|
37 | 38 | yield from [ |
38 | 39 | [AcceptHeaderItem::fromString($value)], |
39 | 40 | [new AcceptHeaderItem($value)], |
@@ -82,11 +83,13 @@ discard block |
||
82 | 83 | */ |
83 | 84 | public function testItemQualityBoundaries(float $quality, AcceptHeaderItem $item): void |
84 | 85 | { |
85 | - if ($quality > 1) { |
|
86 | + if ($quality > 1) |
|
87 | + { |
|
86 | 88 | $this->assertSame(1.0, $item->getQuality()); |
87 | 89 | } |
88 | 90 | |
89 | - if ($quality < 0) { |
|
91 | + if ($quality < 0) |
|
92 | + { |
|
90 | 93 | $this->assertSame(0.0, $item->getQuality()); |
91 | 94 | } |
92 | 95 | |
@@ -100,7 +103,8 @@ discard block |
||
100 | 103 | public function qualityBoundariesProvider(): iterable |
101 | 104 | { |
102 | 105 | $qualities = [-1, 0, 0.5, 1, 2]; |
103 | - foreach ($qualities as $quality) { |
|
106 | + foreach ($qualities as $quality) |
|
107 | + { |
|
104 | 108 | yield from [ |
105 | 109 | [$quality, AcceptHeaderItem::fromString("*;q=$quality")], |
106 | 110 | [$quality, AcceptHeaderItem::fromString("*;Q=$quality")], |
@@ -140,9 +144,11 @@ discard block |
||
140 | 144 | ] |
141 | 145 | ]; |
142 | 146 | |
143 | - foreach ($set as $params) { |
|
147 | + foreach ($set as $params) |
|
148 | + { |
|
144 | 149 | $formattedParams = []; |
145 | - foreach ($params['passed'] as $k => $v) { |
|
150 | + foreach ($params['passed'] as $k => $v) |
|
151 | + { |
|
146 | 152 | $formattedParams[] = "$k=$v"; |
147 | 153 | } |
148 | 154 |