Completed
Push — master ( fd737c...3c6dfc )
by Iakov
03:12
created
RequestProcessor/Step/Common/PersistStep.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     {
28 28
         $entity = $this->getArtifact('entity');
29 29
 
30
-        if(true !== $this->getArtifact('validation')) {
30
+        if (true !== $this->getArtifact('validation')) {
31 31
             return new ArtifactCollection();
32 32
         }
33 33
 
Please login to merge, or discard this patch.
Tests/RequestProcessor/Step/Filter/ValidateFiltersTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,6 +23,6 @@
 block discarded – undo
23 23
 
24 24
         $response = $step->execute($request);
25 25
         $this->assertInstanceOf(ArtifactCollection::class, $response);
26
-        $this->assertEquals([0 => ['type' => 'eq','property' => 'title','value' => 'test']], $response->get('filters')->getValue());
26
+        $this->assertEquals([0 => ['type' => 'eq', 'property' => 'title', 'value' => 'test']], $response->get('filters')->getValue());
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
Stenographer/Stenographer.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,9 @@
 block discarded – undo
216 216
                 $annotation instanceof OneToMany ||
217 217
                 $annotation instanceof ManyToOne ||
218 218
                 $annotation instanceof ManyToMany
219
-            ) $targetEntity = $annotation->targetEntity;
219
+            ) {
220
+                $targetEntity = $annotation->targetEntity;
221
+            }
220 222
         }
221 223
 
222 224
         return str_replace('_', '-', Inflector::tableize(substr($targetEntity, strripos($targetEntity, '\\') + 1)));
Please login to merge, or discard this patch.
Spacing   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     private function getReturnedParams($route, $anonymousClass, $canAccessClass)
178 178
     {
179 179
         $reflection = $this->getEntityReflection($route->getDefault('_entity'));
180
-        $availableParams = $reflection->getName() . "\n";
180
+        $availableParams = $reflection->getName()."\n";
181 181
 
182 182
         foreach ($reflection->getProperties() as $property) {
183 183
             $anonymous = $this->reader->getPropertyAnnotation($property, $anonymousClass);
@@ -189,10 +189,9 @@  discard block
 block discarded – undo
189 189
                 $availableAccess = $access ? $access->roles : $availableAccess;
190 190
                 $availableAccess = implode(', ', $availableAccess);
191 191
 
192
-                $availableParams .= Inflector::tableize($property->getName()) . ':';
193
-                $availableParams .= $relation ? '<a href="#operations-tag-'.$this->getRelatedPropertyModelName($property).'">Related model</a>' :
194
-                    ($column ? $column->type : 'Unknown');
195
-                $availableParams .= ', Access: ' . $availableAccess . "\n";
192
+                $availableParams .= Inflector::tableize($property->getName()).':';
193
+                $availableParams .= $relation ? '<a href="#operations-tag-'.$this->getRelatedPropertyModelName($property).'">Related model</a>' : ($column ? $column->type : 'Unknown');
194
+                $availableParams .= ', Access: '.$availableAccess."\n";
196 195
             }
197 196
         }
198 197
 
@@ -246,8 +245,7 @@  discard block
 block discarded – undo
246 245
 
247 246
                 $param['description'] = $relation ?
248 247
                     '<a href="#operations-tag-'.$this->getRelatedPropertyModelName($property).'">'.
249
-                    'Related model description</a><pre>Access: ' . $availableAccess . '</pre>' :
250
-                    '<pre>Access: ' . $availableAccess . '</pre>';
248
+                    'Related model description</a><pre>Access: '.$availableAccess.'</pre>' : '<pre>Access: '.$availableAccess.'</pre>';
251 249
 
252 250
                 $availableParams[] = $param;
253 251
             }
@@ -259,8 +257,8 @@  discard block
 block discarded – undo
259 257
     private function getRelatedPropertyModelName($property)
260 258
     {
261 259
         $annotations = $this->reader->getPropertyAnnotations($property);
262
-        foreach ($annotations as $annotation){
263
-            if(
260
+        foreach ($annotations as $annotation) {
261
+            if (
264 262
                 $annotation instanceof OneToOne ||
265 263
                 $annotation instanceof OneToMany ||
266 264
                 $annotation instanceof ManyToOne ||
Please login to merge, or discard this patch.
RequestProcessor/Step/Common/SortStep.php 1 patch
Spacing   +9 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,23 +50,20 @@
 block discarded – undo
50 50
         $reflection = $this->getArtifact('reflection');
51 51
         $query = 'e.%s';
52 52
 
53
-        if(strripos($sort, '.')){
53
+        if (strripos($sort, '.')) {
54 54
             $sort = explode('.', $sort);
55
-            if($reflection->hasProperty(Inflector::camelize($sort[0]))){
55
+            if ($reflection->hasProperty(Inflector::camelize($sort[0]))) {
56 56
                 $property = $reflection->getProperty(Inflector::camelize($sort[0]));
57
-                $ann = $this->reader->getPropertyAnnotation($property, OneToOne::class)?:
58
-                    $this->reader->getPropertyAnnotation($property, OneToMany::class)?:
59
-                        $this->reader->getPropertyAnnotation($property, ManyToMany::class)?:
60
-                            $this->reader->getPropertyAnnotation($property, ManyToOne::class)?:null;
61
-                if($ann){
57
+                $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;
58
+                if ($ann) {
62 59
                     $reflection = new \ReflectionClass($ann->targetEntity);
63
-                    $query = $sort[0] . '.%s';
60
+                    $query = $sort[0].'.%s';
64 61
                     $sort = Inflector::camelize(($sort[1]));
65
-                } else{
66
-                    throw new BadRequestHttpException('Related property ' . Inflector::camelize($sort[0]) . ' isn\'t related model in sort field');
62
+                } else {
63
+                    throw new BadRequestHttpException('Related property '.Inflector::camelize($sort[0]).' isn\'t related model in sort field');
67 64
                 }
68
-            } else{
69
-                throw new BadRequestHttpException('Related property ' . Inflector::camelize($sort[0]) . ' not found in sort field');
65
+            } else {
66
+                throw new BadRequestHttpException('Related property '.Inflector::camelize($sort[0]).' not found in sort field');
70 67
             }
71 68
         }
72 69
 
Please login to merge, or discard this patch.
RequestProcessor/Step/Filter/FilterStep.php 2 patches
Spacing   +10 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,28 +40,25 @@
 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
                             $queryModel = Inflector::camelize($filtr[0]);
57 54
                         } else {
58
-                            throw new BadRequestHttpException('Related property ' . $filtr[1] . ' not found in related model ' . $filtr[0] . ' in filter field');
55
+                            throw new BadRequestHttpException('Related property '.$filtr[1].' not found in related model '.$filtr[0].' in filter field');
59 56
                         }
60
-                    }else{
61
-                        throw new BadRequestHttpException('Property ' . $filtr[0] . ' isn\'t related model in filter field');
57
+                    } else {
58
+                        throw new BadRequestHttpException('Property '.$filtr[0].' isn\'t related model in filter field');
62 59
                     }
63
-                } else{
64
-                    throw new BadRequestHttpException('Related property ' . $filtr[0] . ' not found in filter field');
60
+                } else {
61
+                    throw new BadRequestHttpException('Related property '.$filtr[0].' not found in filter field');
65 62
                 }
66 63
             }
67 64
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
                         } else {
58 58
                             throw new BadRequestHttpException('Related property ' . $filtr[1] . ' not found in related model ' . $filtr[0] . ' in filter field');
59 59
                         }
60
-                    }else{
60
+                    } else{
61 61
                         throw new BadRequestHttpException('Property ' . $filtr[0] . ' isn\'t related model in filter field');
62 62
                     }
63 63
                 } else{
Please login to merge, or discard this patch.