GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#62)
by Simone
02:22
created
src/Mado/QueryBundle/DependencyInjection/MadoQueryExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         $configuration = new Configuration();
23 23
         $config = $this->processConfiguration($configuration, $configs);
24 24
 
25
-        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
25
+        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
26 26
         $loader->load('services.yml');
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Mado/QueryBundle/Queries/QueryBuilderFactory.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
         $needle = $prevEntityAlias . "_" . $currentEntityAlias;
109 109
 
110
-        return ! in_array($needle, $this->joins);
110
+        return !in_array($needle, $this->joins);
111 111
     }
112 112
 
113 113
     private function storeJoin($prevEntityAlias, $currentEntityAlias)
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
     private function applyFilterAnd($filter, $value)
214 214
     {
215 215
         $whereCondition = null;
216
-        $filterAndOperator = explode('|',$filter);
216
+        $filterAndOperator = explode('|', $filter);
217 217
 
218 218
         $fieldName = $filterAndOperator[0];
219 219
         $fieldName = $this->parser->camelize($fieldName);
220 220
 
221 221
         $operator = $this->getValueAvailableFilters()[self::DEFAULT_OPERATOR];
222
-        if(isset($filterAndOperator[1])){
222
+        if (isset($filterAndOperator[1])) {
223 223
             $operator = $this->getValueAvailableFilters()[$filterAndOperator[1]];
224 224
         }
225 225
 
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
             // $filterAndOperator[1] = 'bar'
240 240
             if (isset($filterAndOperator[1])) {
241 241
                 if ('list' == $filterAndOperator[1]) {
242
-                    $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')';
242
+                    $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')';
243 243
                 } else if ('field_eq' == $filterAndOperator[1]) {
244 244
                     $whereCondition =
245
-                        $this->entityAlias . '.' . $fieldName . ' '.
245
+                        $this->entityAlias . '.' . $fieldName . ' ' .
246 246
                         $operator['meta'] . '' .
247 247
                         $this->entityAlias . '.' . $value
248 248
                         ;
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
                     //'Oops! Eccezzione'
252 252
                     //);
253 253
                 } else {
254
-                    $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt;
254
+                    $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt;
255 255
                 }
256 256
             } else {
257
-                $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt;
257
+                $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt;
258 258
             }
259 259
 
260 260
             $this->qBuilder->andWhere($whereCondition);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         } else {
276 276
             $isNotARelation = 0 !== strpos($fieldName, 'Embedded.');
277 277
             if ($isNotARelation) {
278
-                $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value;
278
+                $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value;
279 279
                 $this->qBuilder->andWhere($whereCondition);
280 280
             }
281 281
         }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
             $relationEntityAlias = $this->getRelationEntityAlias();
289 289
 
290 290
             $embeddedFields = explode('.', $fieldName);
291
-            $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]);
291
+            $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]);
292 292
 
293 293
             $salt = '';
294 294
             foreach ($this->qBuilder->getParameters() as $parameter) {
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
             }
299 299
 
300 300
             if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) {
301
-                $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')';
301
+                $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')';
302 302
             } else {
303
-                $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt;
303
+                $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt;
304 304
             }
305 305
 
306 306
             $this->qBuilder->andWhere($whereCondition);
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
     private function applyFilterOr($filter, $value, $orCondition)
324 324
     {
325 325
         $whereCondition = null;
326
-        $filterAndOperator = explode('|',$filter);
326
+        $filterAndOperator = explode('|', $filter);
327 327
 
328 328
         $fieldName = $filterAndOperator[0];
329 329
         $fieldName = $this->parser->camelize($fieldName);
330 330
 
331 331
         $operator = $this->getValueAvailableFilters()[self::DEFAULT_OPERATOR];
332
-        if(isset($filterAndOperator[1])){
332
+        if (isset($filterAndOperator[1])) {
333 333
             $operator = $this->getValueAvailableFilters()[$filterAndOperator[1]];
334 334
         }
335 335
 
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
             // $filterAndOperator[1] = 'bar'
354 354
             if (isset($filterAndOperator[1])) {
355 355
                 if ('list' == $filterAndOperator[1]) {
356
-                    $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')';
356
+                    $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')';
357 357
                 } else if ('field_eq' == $filterAndOperator[1]) {
358 358
                     $whereCondition =
359
-                        $this->entityAlias . '.' . $fieldName . ' '.
359
+                        $this->entityAlias . '.' . $fieldName . ' ' .
360 360
                         $operator['meta'] . '' .
361 361
                         $this->entityAlias . '.' . $value
362 362
                     ;
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
                     //'Oops! Eccezzione'
366 366
                     //);
367 367
                 } else {
368
-                    $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt;
368
+                    $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt;
369 369
                 }
370 370
             } else {
371
-                $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt;
371
+                $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt;
372 372
             }
373 373
 
374 374
             if ($orCondition['orCondition'] != null) {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
         } else {
397 397
             $isNotARelation = 0 !== strpos($fieldName, 'Embedded.');
398 398
             if ($isNotARelation) {
399
-                $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value;
399
+                $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value;
400 400
                 if ($orCondition['orCondition'] != null) {
401 401
                     $orCondition['orCondition'] .= ' OR ' . $whereCondition;
402 402
                 } else {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
             $relationEntityAlias = $this->getRelationEntityAlias();
414 414
 
415 415
             $embeddedFields = explode('.', $fieldName);
416
-            $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]);
416
+            $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]);
417 417
 
418 418
             $salt = '';
419 419
             foreach ($this->qBuilder->getParameters() as $parameter) {
@@ -427,9 +427,9 @@  discard block
 block discarded – undo
427 427
             }
428 428
 
429 429
             if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) {
430
-                $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')';
430
+                $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')';
431 431
             } else {
432
-                $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt;
432
+                $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt;
433 433
             }
434 434
 
435 435
             if ($orCondition['orCondition'] != null) {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 
481 481
             if (in_array($fieldName, $this->fields)) {
482 482
                 $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA;
483
-                $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction);
483
+                $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction);
484 484
             }
485 485
 
486 486
             if (strstr($sort, '_embedded.')) {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                 $fieldName = $this->parser->camelize($embeddedFields[2]);
492 492
                 $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA;
493 493
 
494
-                $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction);
494
+                $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction);
495 495
             }
496 496
 
497 497
         }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         return $this->pageLength;
580 580
     }
581 581
 
582
-    public function setSelect( $select) : QueryBuilderFactory
582
+    public function setSelect($select) : QueryBuilderFactory
583 583
     {
584 584
         $this->select = $select;
585 585
 
Please login to merge, or discard this patch.
tests/Mado/QueryBundle/Objects/QueryBuilderFactoryTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             'path' => __DIR__ . '/../../data/db.sqlite',
16 16
         ),
17 17
         \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(
18
-            array(__DIR__."/src"),
18
+            array(__DIR__ . "/src"),
19 19
             true
20 20
         ));
21 21
     }
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     public function testProvideOneSingleResult()
24 24
     {
25 25
         $queryBuilderFactory = new QueryBuilderFactory($this->manager);
26
-        $queryBuilderFactory->setFields([ 'id' ]);
27
-        $queryBuilderFactory->setFilters([ 'id|eq' => 33 ]);
26
+        $queryBuilderFactory->setFields(['id']);
27
+        $queryBuilderFactory->setFilters(['id|eq' => 33]);
28 28
         $queryBuilderFactory->createQueryBuilder(MySimpleEntity::class, 'e');
29 29
         $queryBuilderFactory->filter();
30 30
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
     public function testSampleQueryMakedWithQueryBuilderFactory()
41 41
     {
42 42
         $queryBuilderFactory = new QueryBuilderFactory($this->manager);
43
-        $queryBuilderFactory->setFields([ 'id' ]);
44
-        $queryBuilderFactory->setFilters([ 'id|eq' => 33 ]);
43
+        $queryBuilderFactory->setFields(['id']);
44
+        $queryBuilderFactory->setFilters(['id|eq' => 33]);
45 45
         $queryBuilderFactory->createQueryBuilder(MySimpleEntity::class, 'e');
46 46
         $queryBuilderFactory->filter();
47 47
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
     public function testOneToManyQueryMakedHandly()
60 60
     {
61 61
         $queryBuilderFactory = new QueryBuilderFactory($this->manager);
62
-        $queryBuilderFactory->setFields([ 'id' ]);
63
-        $queryBuilderFactory->setRel([ 'group' ]);
62
+        $queryBuilderFactory->setFields(['id']);
63
+        $queryBuilderFactory->setRel(['group']);
64 64
         $queryBuilderFactory->setFilters([
65 65
             '_embedded.group.name|contains|1' => 'ad',
66 66
             '_embedded.group.name|contains|2' => 'ns',
Please login to merge, or discard this patch.
src/Mado/QueryBundle/Repositories/BaseRepository.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
         $this->fields = array_keys($this->getClassMetadata()->fieldMappings);
41 41
 
42
-        $entityName = explode('\\', strtolower($this->getEntityName()) );
43
-        $entityName = $entityName[count($entityName)-1];
42
+        $entityName = explode('\\', strtolower($this->getEntityName()));
43
+        $entityName = $entityName[count($entityName) - 1];
44 44
         $entityAlias = $entityName[0];
45 45
         $this->entityAlias = $entityAlias;
46 46
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         foreach ($orFilters as $key => $filter) {
123 123
             if (is_array($filter)) {
124 124
                 foreach ($filter as $keyInternal => $internal) {
125
-                    $filterOrCorrected[$keyInternal .'|' . $count] = $internal;
125
+                    $filterOrCorrected[$keyInternal . '|' . $count] = $internal;
126 126
                     $count = $count + 1;
127 127
                 }
128 128
             } else {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         foreach ($orFilters as $key => $filter) {
175 175
             if (is_array($filter)) {
176 176
                 foreach ($filter as $keyInternal => $internal) {
177
-                    $filterOrCorrected[$keyInternal .'|' . $count] = $internal;
177
+                    $filterOrCorrected[$keyInternal . '|' . $count] = $internal;
178 178
                     $count = $count + 1;
179 179
                 }
180 180
             } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         foreach ($orFilters as $key => $filter) {
222 222
             if (is_array($filter)) {
223 223
                 foreach ($filter as $keyInternal => $internal) {
224
-                    $filterOrCorrected[$keyInternal .'|' . $count] = $internal;
224
+                    $filterOrCorrected[$keyInternal . '|' . $count] = $internal;
225 225
                     $count = $count + 1;
226 226
                 }
227 227
             } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         $pagerAdapter = new DoctrineORMAdapter($queryBuilder);
279 279
 
280 280
         $query = $pagerAdapter->getQuery();
281
-        if(isset($this->use_result_cache) and $this->use_result_cache){
281
+        if (isset($this->use_result_cache) and $this->use_result_cache) {
282 282
             $query->useResultCache(true, 600);
283 283
         }
284 284
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             $params[$itemValue] = $this->queryOptions->get($itemValue);
318 318
         }
319 319
 
320
-        if(!isset($this->route_name)){
320
+        if (!isset($this->route_name)) {
321 321
             $this->route_name = $this->queryOptions->get('_route');
322 322
         }
323 323
 
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 
347 347
     public function getEntityAlias(string $entityName) : string
348 348
     {
349
-        $arrayEntityName = explode('\\', strtolower($entityName) );
350
-        return $arrayEntityName[count($arrayEntityName)-1];
349
+        $arrayEntityName = explode('\\', strtolower($entityName));
350
+        return $arrayEntityName[count($arrayEntityName) - 1];
351 351
     }
352 352
 
353 353
     protected function relationship($queryBuilder)
Please login to merge, or discard this patch.
tests/Mado/QueryBundle/Component/Meta/MapBuilderTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
             ->getMock();
48 48
         $this->factory->expects($this->once())
49 49
             ->method('getAllMetadata')
50
-            ->will($this->returnValue(function () {
50
+            ->will($this->returnValue(function() {
51 51
                 return [
52 52
                     'SomeBundle\Entity\ParentEntity' => [
53 53
                         'relations' => [
Please login to merge, or discard this patch.
src/Mado/QueryBundle/Component/Meta/JsonPathFinder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $this->mapper = $mapper;
47 47
         $this->logger = $logger;
48 48
 
49
-        $this->appendRootEntityToSubject =  function($subject, $rootEntity) {
49
+        $this->appendRootEntityToSubject = function($subject, $rootEntity) {
50 50
             $subject[] = $rootEntity;
51 51
             return $subject;
52 52
         };
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
 
271 271
     public function findAllPathsTo(string $dest)
272 272
     {
273
-        for ($stay = true;;) {
273
+        for ($stay = true; ;) {
274 274
             try {
275 275
                 $this->getPathToEntity($dest);
276 276
                 $entities = $this->getEntitiesPath();
277 277
                 $lastEntityFound = end($entities);
278 278
                 $this->removeStep($lastEntityFound);
279
-            } catch(\Mado\QueryBundle\Component\Meta\Exceptions\UnexpectedValueException $e) {
279
+            } catch (\Mado\QueryBundle\Component\Meta\Exceptions\UnexpectedValueException $e) {
280 280
                 $stay = false;
281 281
             }
282 282
 
Please login to merge, or discard this patch.