Passed
Pull Request — master (#1141)
by Aleksei
10:45
created
src/Models/tests/NameValue.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@
 block discarded – undo
17 17
 
18 18
     public function __toString(): string
19 19
     {
20
-        return (string) $this->value;
20
+        return (string)$this->value;
21 21
     }
22 22
 
23 23
     public function setValue(mixed $data): self
24 24
     {
25
-        $this->value = \strtoupper((string) $data);
25
+        $this->value = \strtoupper((string)$data);
26 26
 
27 27
         return $this;
28 28
     }
Please login to merge, or discard this patch.
src/Http/src/Request/InputManager.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         #[Proxy] private readonly ContainerInterface $container,
122 122
         /** @invisible */
123 123
         HttpConfig $config = new HttpConfig()
124
-    ) {
124
+    ){
125 125
         $this->bagAssociations = \array_merge($this->bagAssociations, $config->getInputBags());
126 126
     }
127 127
 
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $input = clone $this;
152 152
 
153
-        if ($add) {
154
-            $input->prefix .= '.' . $prefix;
153
+        if ($add){
154
+            $input->prefix .= '.'.$prefix;
155 155
             $input->prefix = \trim($input->prefix, '.');
156
-        } else {
156
+        }else{
157 157
             $input->prefix = $prefix;
158 158
         }
159 159
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         return match (true) {
171 171
             empty($path) => '/',
172
-            $path[0] !== '/' => '/' . $path,
172
+            $path[0] !== '/' => '/'.$path,
173 173
             default => $path
174 174
         };
175 175
     }
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function request(): Request
191 191
     {
192
-        try {
192
+        try{
193 193
             $request = $this->container->get(Request::class);
194
-        } catch (ContainerExceptionInterface $e) {
194
+        }catch (ContainerExceptionInterface $e){
195 195
             throw new ScopeException(
196 196
                 'Unable to get `ServerRequestInterface` in active container scope',
197 197
                 $e->getCode(),
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         }
201 201
 
202 202
         // Flushing input state
203
-        if ($this->request !== $request) {
203
+        if ($this->request !== $request){
204 204
             $this->bags = [];
205 205
             $this->request = $request;
206 206
         }
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function bearerToken(): ?string
215 215
     {
216
-        $header = (string) $this->header('Authorization', '');
216
+        $header = (string)$this->header('Authorization', '');
217 217
 
218 218
         $position = \strrpos($header, 'Bearer ');
219 219
 
220
-        if ($position !== false) {
220
+        if ($position !== false){
221 221
             $header = \substr($header, $position + 7);
222 222
 
223 223
             return \str_contains($header, ',')
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
     public function isJsonExpected(bool $softMatch = false): bool
272 272
     {
273 273
         $acceptHeader = AcceptHeader::fromString($this->request()->getHeaderLine('Accept'));
274
-        foreach ($this->jsonTypes as $jsonType) {
275
-            if ($acceptHeader->has($jsonType)) {
274
+        foreach ($this->jsonTypes as $jsonType){
275
+            if ($acceptHeader->has($jsonType)){
276 276
                 return true;
277 277
             }
278 278
         }
279 279
 
280
-        if ($softMatch) {
281
-            foreach ($acceptHeader->getAll() as $item) {
282
-                $itemValue = \strtolower((string) $item->getValue());
283
-                if (\str_ends_with($itemValue, '/json') || \str_ends_with($itemValue, '+json')) {
280
+        if ($softMatch){
281
+            foreach ($acceptHeader->getAll() as $item){
282
+                $itemValue = \strtolower((string)$item->getValue());
283
+                if (\str_ends_with($itemValue, '/json') || \str_ends_with($itemValue, '+json')){
284 284
                     return true;
285 285
                 }
286 286
             }
@@ -319,19 +319,19 @@  discard block
 block discarded – undo
319 319
         // ensure proper request association
320 320
         $this->request();
321 321
 
322
-        if (isset($this->bags[$name])) {
322
+        if (isset($this->bags[$name])){
323 323
             return $this->bags[$name];
324 324
         }
325 325
 
326 326
         $definition = $this->findBagDefinition($name);
327
-        if (!$definition) {
327
+        if (!$definition){
328 328
             throw new InputException(\sprintf("Undefined input bag '%s'", $name));
329 329
         }
330 330
 
331 331
         $class = $definition['class'];
332 332
         $data = \call_user_func([$this->request(), $definition['source']]);
333 333
 
334
-        if (!\is_array($data)) {
334
+        if (!\is_array($data)){
335 335
             $data = (array)$data;
336 336
         }
337 337
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
     public function hasBag(string $name): bool
342 342
     {
343
-        if (isset($this->bags[$name])) {
343
+        if (isset($this->bags[$name])){
344 344
             return true;
345 345
         }
346 346
 
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
      */
361 361
     private function findBagDefinition(string $name): ?array
362 362
     {
363
-        if (isset($this->bagAssociations[$name])) {
363
+        if (isset($this->bagAssociations[$name])){
364 364
             return $this->bagAssociations[$name];
365 365
         }
366 366
 
367
-        foreach ($this->bagAssociations as $bag) {
368
-            if (isset($bag['alias']) && $bag['alias'] === $name) {
367
+        foreach ($this->bagAssociations as $bag){
368
+            if (isset($bag['alias']) && $bag['alias'] === $name){
369 369
                 return $bag;
370 370
             }
371 371
         }
Please login to merge, or discard this patch.
Braces   +38 added lines, -18 removed lines patch added patch discarded remove patch
@@ -150,10 +150,13 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $input = clone $this;
152 152
 
153
-        if ($add) {
153
+        if ($add)
154
+        {
154 155
             $input->prefix .= '.' . $prefix;
155 156
             $input->prefix = \trim($input->prefix, '.');
156
-        } else {
157
+        }
158
+        else
159
+        {
157 160
             $input->prefix = $prefix;
158 161
         }
159 162
 
@@ -189,9 +192,12 @@  discard block
 block discarded – undo
189 192
      */
190 193
     public function request(): Request
191 194
     {
192
-        try {
195
+        try
196
+        {
193 197
             $request = $this->container->get(Request::class);
194
-        } catch (ContainerExceptionInterface $e) {
198
+        }
199
+        catch (ContainerExceptionInterface $e)
200
+        {
195 201
             throw new ScopeException(
196 202
                 'Unable to get `ServerRequestInterface` in active container scope',
197 203
                 $e->getCode(),
@@ -200,7 +206,8 @@  discard block
 block discarded – undo
200 206
         }
201 207
 
202 208
         // Flushing input state
203
-        if ($this->request !== $request) {
209
+        if ($this->request !== $request)
210
+        {
204 211
             $this->bags = [];
205 212
             $this->request = $request;
206 213
         }
@@ -217,7 +224,8 @@  discard block
 block discarded – undo
217 224
 
218 225
         $position = \strrpos($header, 'Bearer ');
219 226
 
220
-        if ($position !== false) {
227
+        if ($position !== false)
228
+        {
221 229
             $header = \substr($header, $position + 7);
222 230
 
223 231
             return \str_contains($header, ',')
@@ -271,16 +279,21 @@  discard block
 block discarded – undo
271 279
     public function isJsonExpected(bool $softMatch = false): bool
272 280
     {
273 281
         $acceptHeader = AcceptHeader::fromString($this->request()->getHeaderLine('Accept'));
274
-        foreach ($this->jsonTypes as $jsonType) {
275
-            if ($acceptHeader->has($jsonType)) {
282
+        foreach ($this->jsonTypes as $jsonType)
283
+        {
284
+            if ($acceptHeader->has($jsonType))
285
+            {
276 286
                 return true;
277 287
             }
278 288
         }
279 289
 
280
-        if ($softMatch) {
281
-            foreach ($acceptHeader->getAll() as $item) {
290
+        if ($softMatch)
291
+        {
292
+            foreach ($acceptHeader->getAll() as $item)
293
+            {
282 294
                 $itemValue = \strtolower((string) $item->getValue());
283
-                if (\str_ends_with($itemValue, '/json') || \str_ends_with($itemValue, '+json')) {
295
+                if (\str_ends_with($itemValue, '/json') || \str_ends_with($itemValue, '+json'))
296
+                {
284 297
                     return true;
285 298
                 }
286 299
             }
@@ -319,19 +332,22 @@  discard block
 block discarded – undo
319 332
         // ensure proper request association
320 333
         $this->request();
321 334
 
322
-        if (isset($this->bags[$name])) {
335
+        if (isset($this->bags[$name]))
336
+        {
323 337
             return $this->bags[$name];
324 338
         }
325 339
 
326 340
         $definition = $this->findBagDefinition($name);
327
-        if (!$definition) {
341
+        if (!$definition)
342
+        {
328 343
             throw new InputException(\sprintf("Undefined input bag '%s'", $name));
329 344
         }
330 345
 
331 346
         $class = $definition['class'];
332 347
         $data = \call_user_func([$this->request(), $definition['source']]);
333 348
 
334
-        if (!\is_array($data)) {
349
+        if (!\is_array($data))
350
+        {
335 351
             $data = (array)$data;
336 352
         }
337 353
 
@@ -340,7 +356,8 @@  discard block
 block discarded – undo
340 356
 
341 357
     public function hasBag(string $name): bool
342 358
     {
343
-        if (isset($this->bags[$name])) {
359
+        if (isset($this->bags[$name]))
360
+        {
344 361
             return true;
345 362
         }
346 363
 
@@ -360,12 +377,15 @@  discard block
 block discarded – undo
360 377
      */
361 378
     private function findBagDefinition(string $name): ?array
362 379
     {
363
-        if (isset($this->bagAssociations[$name])) {
380
+        if (isset($this->bagAssociations[$name]))
381
+        {
364 382
             return $this->bagAssociations[$name];
365 383
         }
366 384
 
367
-        foreach ($this->bagAssociations as $bag) {
368
-            if (isset($bag['alias']) && $bag['alias'] === $name) {
385
+        foreach ($this->bagAssociations as $bag)
386
+        {
387
+            if (isset($bag['alias']) && $bag['alias'] === $name)
388
+            {
369 389
                 return $bag;
370 390
             }
371 391
         }
Please login to merge, or discard this patch.
src/Console/src/Configurator/ConstantBasedConfigurator.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
     public function configure(Command $command, \ReflectionClass $reflection): void
15 15
     {
16 16
         $command->setName($reflection->getConstant('NAME'));
17
-        $command->setDescription((string) $reflection->getConstant('DESCRIPTION'));
17
+        $command->setDescription((string)$reflection->getConstant('DESCRIPTION'));
18 18
 
19
-        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option) {
19
+        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option){
20 20
             $command->addOption(...$option);
21 21
         }
22 22
 
23
-        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument) {
23
+        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument){
24 24
             $command->addArgument(...$argument);
25 25
         }
26 26
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,11 +16,13 @@
 block discarded – undo
16 16
         $command->setName($reflection->getConstant('NAME'));
17 17
         $command->setDescription((string) $reflection->getConstant('DESCRIPTION'));
18 18
 
19
-        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option) {
19
+        foreach ($reflection->getMethod('defineOptions')->invoke($command) as $option)
20
+        {
20 21
             $command->addOption(...$option);
21 22
         }
22 23
 
23
-        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument) {
24
+        foreach ($reflection->getMethod('defineArguments')->invoke($command) as $argument)
25
+        {
24 26
             $command->addArgument(...$argument);
25 27
         }
26 28
     }
Please login to merge, or discard this patch.