Passed
Push — master ( 645c70...33acbc )
by Iakov
02:45
created
RequestProcessor/Step/Filter/FilterStep.php 1 patch
Spacing   +10 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,29 +40,26 @@
 block discarded – undo
40 40
 
41 41
         foreach ($filters as $filter) {
42 42
             $queryModel = 'e';
43
-            if(strripos($filter['property'], '.')){
43
+            if (strripos($filter['property'], '.')) {
44 44
                 $filtr = explode('.', $filter['property']);
45
-                if($reflection->hasProperty(Inflector::camelize($filtr[0]))){
45
+                if ($reflection->hasProperty(Inflector::camelize($filtr[0]))) {
46 46
                     $property = $reflection->getProperty(Inflector::camelize($filtr[0]));
47
-                    $ann = $this->reader->getPropertyAnnotation($property, OneToOne::class)?:
48
-                            $this->reader->getPropertyAnnotation($property, OneToMany::class)?:
49
-                            $this->reader->getPropertyAnnotation($property, ManyToMany::class)?:
50
-                            $this->reader->getPropertyAnnotation($property, ManyToOne::class)?:null;
51
-                    if($ann){
47
+                    $ann = $this->reader->getPropertyAnnotation($property, OneToOne::class) ?: $this->reader->getPropertyAnnotation($property, OneToMany::class) ?: $this->reader->getPropertyAnnotation($property, ManyToMany::class) ?: $this->reader->getPropertyAnnotation($property, ManyToOne::class) ?: null;
48
+                    if ($ann) {
52 49
                         $reflection = new \ReflectionClass($ann->targetEntity);
53
-                        if($reflection->hasProperty(Inflector::camelize($filtr[1]))){
50
+                        if ($reflection->hasProperty(Inflector::camelize($filtr[1]))) {
54 51
                             $property = $reflection->getProperty(Inflector::camelize($filtr[1]));
55 52
                             $filter['property'] = Inflector::camelize($filtr[1]);
56 53
                             $queryBuilder->leftJoin(sprintf('e.%s', $filtr[0]), $filtr[0]{0});
57 54
                             $queryModel = Inflector::camelize($filtr[0]{0});
58 55
                         } else {
59
-                            throw new BadRequestHttpException('Related property ' . $filtr[1] . ' not found in related model ' . $filtr[0] . ' in filter field');
56
+                            throw new BadRequestHttpException('Related property '.$filtr[1].' not found in related model '.$filtr[0].' in filter field');
60 57
                         }
61
-                    }else{
62
-                        throw new BadRequestHttpException('Property ' . $filtr[0] . ' isn\'t related model in filter field');
58
+                    } else {
59
+                        throw new BadRequestHttpException('Property '.$filtr[0].' isn\'t related model in filter field');
63 60
                     }
64
-                } else{
65
-                    throw new BadRequestHttpException('Related property ' . $filtr[0] . ' not found in filter field');
61
+                } else {
62
+                    throw new BadRequestHttpException('Related property '.$filtr[0].' not found in filter field');
66 63
                 }
67 64
             }
68 65
 
Please login to merge, or discard this patch.