Passed
Push — master ( a39fbe...df2b14 )
by Iakov
03:38
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.
Tests/DependencyInjection/ConfigurationTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 class ConfigurationTest extends TestCase
10 10
 {
11
-    public function testCanByConstructed ()
11
+    public function testCanByConstructed()
12 12
     {
13 13
         $configuration = new Configuration();
14 14
         $treeBuilder = $configuration->getConfigTreeBuilder();
Please login to merge, or discard this patch.
RequestProcessor/Step/Filter/FilterStep.php 1 patch
Spacing   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             /** @var \ReflectionClass $reflection */
69 69
             $reflection = $this->getArtifact('reflection');
70 70
 
71
-            if(strpos($config['property'], '.')) {
71
+            if (strpos($config['property'], '.')) {
72 72
                 $this->applyFilterToRelation($config, $reflection, $queryBuilder, '_'.$index);
73 73
             } else {
74 74
                 $this->applyRegularFilter($config, $reflection, $queryBuilder, '_'.$index);
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
                 $this->checkAccessForRelatedProperty($reflection, $propertyRelatedModel);
120 120
                 $config['property'] = Inflector::camelize($propertyRelatedModel);
121 121
                 $shortcut = Inflector::camelize($relatedModelName);
122
-                if($queryBuilder->getDQLPart('join')){
122
+                if ($queryBuilder->getDQLPart('join')) {
123 123
                     $joins = $queryBuilder->getDQLPart('join')['e'];
124
-                    foreach ($joins as $join){
125
-                        if($join->getAlias() != $relatedModelName) {
124
+                    foreach ($joins as $join) {
125
+                        if ($join->getAlias() != $relatedModelName) {
126 126
                             $queryBuilder->leftJoin(sprintf('e.%s', $relatedModelName), $relatedModelName);
127 127
                         }
128 128
                     }
129
-                } else{
129
+                } else {
130 130
                     $queryBuilder->leftJoin(sprintf('e.%s', $relatedModelName), $relatedModelName);
131 131
                 }
132 132
                 call_user_func([$this, sprintf('apply%sFilter', $config['type'])], $config, $queryBuilder, $shortcut, $index);
@@ -150,10 +150,7 @@  discard block
 block discarded – undo
150 150
     protected function getRelationAnnotation(\ReflectionProperty $property): Annotation
151 151
     {
152 152
         /** @var Annotation $annotation */
153
-        $annotation = $this->reader->getPropertyAnnotation($property, OneToOne::class) ?:
154
-            $this->reader->getPropertyAnnotation($property, OneToMany::class) ?:
155
-                $this->reader->getPropertyAnnotation($property, ManyToMany::class) ?:
156
-                    $this->reader->getPropertyAnnotation($property, ManyToOne::class);
153
+        $annotation = $this->reader->getPropertyAnnotation($property, OneToOne::class) ?: $this->reader->getPropertyAnnotation($property, OneToMany::class) ?: $this->reader->getPropertyAnnotation($property, ManyToMany::class) ?: $this->reader->getPropertyAnnotation($property, ManyToOne::class);
157 154
         if (!$annotation) {
158 155
             throw new BadRequestHttpException(sprintf('Property %s is not configured for filtering', $property->getName()));
159 156
         }
Please login to merge, or discard this patch.