Passed
Push — dev_2x ( 20ede0...c439ba )
by Adrian
07:41
created
src/CodeGenerator/QueryBaseGenerator.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     private function addFirstMethod()
65 65
     {
66 66
         $method = $this->class->addMethod('first')
67
-                              ->setReturnNullable(true)
68
-                              ->setReturnType($this->mapper->getEntityClass());
67
+                                ->setReturnNullable(true)
68
+                                ->setReturnType($this->mapper->getEntityClass());
69 69
         $method->setBody('return parent::first();');
70 70
     }
71 71
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         $this->namespace->addUse(Collection::class);
75 75
         $method = $this->class->addMethod('get')
76
-                              ->setReturnType('Collection');
76
+                                ->setReturnType('Collection');
77 77
         $method->setBody('return parent::get();');
78 78
         $method->addComment(sprintf('@return Collection|%s[]', $this->mapper->getEntityClass()));
79 79
     }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $this->namespace->addUse(PaginatedCollection::class);
84 84
         $method = $this->class->addMethod('paginate')
85
-                              ->setReturnType('PaginatedCollection');
85
+                                ->setReturnType('PaginatedCollection');
86 86
         $method->addParameter('perPage')->setType('int');
87 87
         $method->addParameter('page', 1)->setType('int');
88 88
         $method->setBody('return parent::paginate($perPage, $page);');
Please login to merge, or discard this patch.
src/Relation/Relation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
     protected function setOptionIfMissing($name, $value)
80 80
     {
81
-        if ( ! isset($this->options[$name])) {
81
+        if (!isset($this->options[$name])) {
82 82
             $this->options[$name] = $value;
83 83
         }
84 84
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
     protected function getKeyColumn($name, $column)
119 119
     {
120
-        if ( ! is_array($column)) {
120
+        if (!is_array($column)) {
121 121
             return $name . '_' . $column;
122 122
         }
123 123
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
         foreach ($entities as $entity) {
180 180
             $entityId = $this->getEntityId($this->foreignMapper, $entity, array_values($this->keyPairs));
181
-            if ( ! isset($result[$entityId])) {
181
+            if (!isset($result[$entityId])) {
182 182
                 $result[$entityId] = [];
183 183
             }
184 184
             $result[$entityId][] = $entity;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     protected function getRemainingRelations($relations)
227 227
     {
228
-        if ( ! is_array($relations)) {
228
+        if (!is_array($relations)) {
229 229
             return $relations;
230 230
         }
231 231
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         if (is_array($guards)) {
247 247
             foreach ($guards as $col => $val) {
248 248
                 // guards that are strings (eg: 'deleted_at is null') can't be used as extra columns
249
-                if ( ! is_int($col)) {
249
+                if (!is_int($col)) {
250 250
                     $cols[$col] = $val;
251 251
                 }
252 252
             }
Please login to merge, or discard this patch.
src/Relation/HasAggregates.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
         $aggregates     = [];
17 17
         $aggregatesList = $this->getOption(RelationConfig::AGGREGATES);
18
-        if ( ! is_array($aggregatesList) || empty($aggregatesList)) {
18
+        if (!is_array($aggregatesList) || empty($aggregatesList)) {
19 19
             $this->aggregates = $aggregates;
20 20
 
21 21
             return;
Please login to merge, or discard this patch.
src/Relation/OneToMany.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     public function joinSubselect(Query $query, string $reference)
49 49
     {
50 50
         $subselect = $query->subSelectForJoinWith($this->foreignMapper)
51
-                           ->as($reference);
51
+                            ->as($reference);
52 52
 
53 53
         $subselect = $this->applyQueryCallback($subselect);
54 54
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
     protected function applyDefaults(): void
18 18
     {
19 19
         $nativeKey = $this->nativeMapper->getConfig()->getPrimaryKey();
20
-        if ( ! isset($this->options[RelationConfig::NATIVE_KEY])) {
20
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
21 21
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
22 22
         }
23 23
 
24
-        if ( ! isset($this->options[RelationConfig::FOREIGN_KEY])) {
24
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
25 25
             $prefix                                     = Inflector::singularize($this->nativeMapper->getConfig()->getTable());
26 26
             $this->options[RelationConfig::FOREIGN_KEY] = $this->getKeyColumn($prefix, $nativeKey);
27 27
         }
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 
96 96
     protected function addActionOnDelete(BaseAction $action)
97 97
     {
98
-        $relations          = $action->getOption('relations');
98
+        $relations = $action->getOption('relations');
99 99
 
100 100
         // no cascade delete? treat as save so we can process the changes
101
-        if ( ! $this->isCascade()) {
101
+        if (!$this->isCascade()) {
102 102
             $this->addActionOnSave($action);
103 103
         } elseif ($relations === true || in_array($this->name, (array)$relations)) {
104 104
             $nativeEntity       = $action->getEntity();
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 
121 121
     protected function addActionOnSave(BaseAction $action)
122 122
     {
123
-        if ( ! $this->relationWasChanged($action->getEntity())) {
123
+        if (!$this->relationWasChanged($action->getEntity())) {
124 124
             return;
125 125
         }
126 126
 
127
-        if ( ! $action->includesRelation($this->name)) {
127
+        if (!$action->includesRelation($this->name)) {
128 128
             return;
129 129
         }
130 130
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
         // save the entities still in the collection
139 139
         foreach ($foreignEntities as $foreignEntity) {
140
-            if ( ! empty($foreignEntity->getChanges())) {
140
+            if (!empty($foreignEntity->getChanges())) {
141 141
                 $saveAction = $this->foreignMapper
142 142
                     ->newSaveAction($foreignEntity, ['relations' => $remainingRelations]);
143 143
                 $saveAction->addColumns($this->getExtraColumnsForAction());
Please login to merge, or discard this patch.
src/Relation/Aggregate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
 
89 89
     public function isLazyLoad()
90 90
     {
91
-        return ! isset($this->options[RelationConfig::LOAD_STRATEGY]) ||
91
+        return !isset($this->options[RelationConfig::LOAD_STRATEGY]) ||
92 92
                $this->options[RelationConfig::LOAD_STRATEGY] == RelationConfig::LOAD_LAZY;
93 93
     }
94 94
 
Please login to merge, or discard this patch.
src/Relation/ManyToMany.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             ->newQuery();
59 59
 
60 60
         $query = $this->joinWithThroughTable($query)
61
-                      ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
61
+                        ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
62 62
 
63 63
         $query = $this->applyQueryCallback($query);
64 64
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $subselect = $this->foreignMapper->newQuery();
112 112
         $subselect = $query->subSelectForJoinWith($this->foreignMapper)
113
-                           ->as($reference);
113
+                            ->as($reference);
114 114
         #$subselect->resetGuards();
115 115
         #$subselect->setGuards($this->foreignMapper->getConfig()->getGuards());
116 116
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,28 +21,28 @@  discard block
 block discarded – undo
21 21
         parent::applyDefaults();
22 22
 
23 23
         $foreignKey = $this->foreignMapper->getConfig()->getPrimaryKey();
24
-        if ( ! isset($this->options[RelationConfig::FOREIGN_KEY])) {
24
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
25 25
             $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey;
26 26
         }
27 27
 
28 28
         $nativeKey = $this->foreignMapper->getConfig()->getPrimaryKey();
29
-        if ( ! isset($this->options[RelationConfig::NATIVE_KEY])) {
29
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
30 30
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
31 31
         }
32 32
 
33
-        if ( ! isset($this->options[RelationConfig::THROUGH_TABLE])) {
33
+        if (!isset($this->options[RelationConfig::THROUGH_TABLE])) {
34 34
             $tables = [$this->foreignMapper->getConfig()->getTable(), $this->nativeMapper->getConfig()->getTable()];
35 35
             sort($tables);
36 36
             $this->options[RelationConfig::THROUGH_TABLE] = implode('_', $tables);
37 37
         }
38 38
 
39
-        if ( ! isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
39
+        if (!isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
40 40
             $prefix = Inflector::singularize($this->nativeMapper->getConfig()->getTableAlias(true));
41 41
 
42 42
             $this->options[RelationConfig::THROUGH_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey);
43 43
         }
44 44
 
45
-        if ( ! isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
45
+        if (!isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
46 46
             $prefix = Inflector::singularize($this->foreignMapper->getConfig()->getTableAlias(true));
47 47
 
48 48
             $this->options[RelationConfig::THROUGH_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS);
96 96
         $throughName  = $throughAlias ?? $through;
97 97
 
98
-        if ( ! empty($throughColumns)) {
98
+        if (!empty($throughColumns)) {
99 99
             foreach ($throughColumns as $col => $alias) {
100 100
                 $query->columns("{$throughName}.{$col} AS {$alias}");
101 101
             }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
     protected function addActionOnDelete(BaseAction $action)
205 205
     {
206
-        $nativeEntity       = $action->getEntity();
206
+        $nativeEntity = $action->getEntity();
207 207
 
208 208
         // retrieve them again from the DB since the related collection might not have everything
209 209
         // for example due to a relation query callback
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
     protected function addActionOnSave(BaseAction $action)
220 220
     {
221
-        if ( ! $action->includesRelation($this->name)) {
221
+        if (!$action->includesRelation($this->name)) {
222 222
             return;
223 223
         }
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
         /** @var Collection $foreignEntities */
228 228
         $foreignEntities = $this->nativeEntityHydrator->get($action->getEntity(), $this->name);
229
-        if ( ! $foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
229
+        if (!$foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
230 230
             return;
231 231
         }
232 232
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
         // save the entities still in the collection
236 236
         foreach ($foreignEntities as $foreignEntity) {
237
-            if ( ! empty($foreignEntity->getChanges())) {
237
+            if (!empty($foreignEntity->getChanges())) {
238 238
                 $saveAction = $this->foreignMapper
239 239
                     ->newSaveAction($foreignEntity, [
240 240
                         'relations' => $remainingRelations
Please login to merge, or discard this patch.
src/Entity/BaseEntityTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
         $changes = $this->changed;
77 77
         foreach ($this->attributes as $name => $value) {
78 78
             if (is_object($value) && method_exists($value, 'getChanges')) {
79
-                if ( ! empty($value->getChanges())) {
79
+                if (!empty($value->getChanges())) {
80 80
                     $changes[$name] = true;
81 81
                 }
82 82
             }
Please login to merge, or discard this patch.
src/Entity/Tracker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $this->relations[$name]        = $relation;
64 64
         $this->relationCallback[$name] = $callback;
65
-        if ( ! empty($nextLoad)) {
65
+        if (!empty($nextLoad)) {
66 66
             $this->relationNextLoad[$name] = $nextLoad;
67 67
         }
68 68
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function getResultsForRelation($name)
76 76
     {
77
-        if ( ! isset($this->relations[$name])) {
77
+        if (!isset($this->relations[$name])) {
78 78
             return [];
79 79
         }
80 80
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $result = [];
112 112
         foreach ($this->rows as $row) {
113 113
             $value = $this->getColumnsFromRow($row, $columns);
114
-            if ($value && ! in_array($value, $result)) {
114
+            if ($value && !in_array($value, $result)) {
115 115
                 $result[] = $value;
116 116
             }
117 117
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     public function getLazyAggregate(Aggregate $aggregate)
143 143
     {
144 144
         $name = $aggregate->getName();
145
-        if ( ! isset($this->lazyAggregates[$name])) {
145
+        if (!isset($this->lazyAggregates[$name])) {
146 146
             $this->lazyAggregates[$name] = new LazyAggregate($this, $aggregate);
147 147
         }
148 148
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     public function getLazyRelation(Relation $relation)
153 153
     {
154 154
         $name = $relation->getOption('name');
155
-        if ( ! isset($this->lazyRelations[$name])) {
155
+        if (!isset($this->lazyRelations[$name])) {
156 156
             $this->lazyRelations[$name] = new LazyRelation($this, $relation);
157 157
         }
158 158
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         }
189 189
 
190 190
         $queryNextLoad = $this->relationNextLoad[$name] ?? [];
191
-        if ($queryNextLoad && ! empty($queryNextLoad)) {
191
+        if ($queryNextLoad && !empty($queryNextLoad)) {
192 192
             foreach ($queryNextLoad as $next => $callback) {
193 193
                 $query = $query->load([$next => $callback]);
194 194
             }
Please login to merge, or discard this patch.
src/CodeGenerator/ClassGenerator.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
         return [
73 73
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
74 74
             'contents' => $this->classPrinter->printFile($file)
75
-                          . PHP_EOL
76
-                          . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
77
-                          . $this->classPrinter->printClass($class)
75
+                            . PHP_EOL
76
+                            . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
77
+                            . $this->classPrinter->printClass($class)
78 78
         ];
79 79
     }
80 80
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
         return [
94 94
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
95 95
             'contents' => $this->classPrinter->printFile($file)
96
-                          . PHP_EOL
97
-                          . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
98
-                          . $this->classPrinter->printClass($class)
96
+                            . PHP_EOL
97
+                            . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
98
+                            . $this->classPrinter->printClass($class)
99 99
         ];
100 100
 
101 101
     }
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
         return [
111 111
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
112 112
             'contents' => $this->classPrinter->printFile($file)
113
-                          . PHP_EOL
114
-                          . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
115
-                          . $this->classPrinter->printClass($class)
113
+                            . PHP_EOL
114
+                            . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
115
+                            . $this->classPrinter->printClass($class)
116 116
         ];
117 117
     }
118 118
 
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
         return [
133 133
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
134 134
             'contents' => $this->classPrinter->printFile($file)
135
-                          . PHP_EOL
136
-                          . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
137
-                          . $this->classPrinter->printClass($class)
135
+                            . PHP_EOL
136
+                            . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
137
+                            . $this->classPrinter->printClass($class)
138 138
         ];
139 139
     }
140 140
 
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
         return [
153 153
             'path'     => $mapper->getEntityDestination() . $class->getName() . '.php',
154 154
             'contents' => $this->classPrinter->printFile($file)
155
-                          . PHP_EOL
156
-                          . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
157
-                          . $this->classPrinter->printClass($class)
155
+                            . PHP_EOL
156
+                            . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
157
+                            . $this->classPrinter->printClass($class)
158 158
         ];
159 159
     }
160 160
 
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
         return [
175 175
             'path'     => $mapper->getEntityDestination() . $class->getName() . '.php',
176 176
             'contents' => $this->classPrinter->printFile($file)
177
-                          . PHP_EOL
178
-                          . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
179
-                          . $this->classPrinter->printClass($class)
177
+                            . PHP_EOL
178
+                            . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '')
179
+                            . $this->classPrinter->printClass($class)
180 180
         ];
181 181
 
182 182
     }
Please login to merge, or discard this patch.