Completed
Branch dev_2x (79898e)
by Adrian
09:26
created
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   +6 added lines, -6 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
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $remainingRelations = $this->getRemainingRelations($relations);
101 101
 
102 102
         // no cascade delete? treat as save so we can process the changes
103
-        if ( ! $this->isCascade()) {
103
+        if (!$this->isCascade()) {
104 104
             $this->addActionOnSave($action);
105 105
         } elseif ($relations === true || in_array($this->name, (array)$relations)) {
106 106
             // retrieve them again from the DB since the related collection might not have everything
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 
120 120
     protected function addActionOnSave(BaseAction $action)
121 121
     {
122
-        if ( ! $this->relationWasChanged($action->getEntity())) {
122
+        if (!$this->relationWasChanged($action->getEntity())) {
123 123
             return;
124 124
         }
125 125
 
126
-        if ( ! $action->includesRelation($this->name)) {
126
+        if (!$action->includesRelation($this->name)) {
127 127
             return;
128 128
         }
129 129
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         // save the entities still in the collection
138 138
         foreach ($foreignEntities as $foreignEntity) {
139
-            if ( ! empty($foreignEntity->getChanges())) {
139
+            if (!empty($foreignEntity->getChanges())) {
140 140
                 $saveAction = $this->foreignMapper
141 141
                     ->newSaveAction($foreignEntity, ['relations' => $remainingRelations]);
142 142
                 $saveAction->addColumns($this->getExtraColumnsForAction());
Please login to merge, or discard this patch.
src/Relation/ManyToOne.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     public function joinSubselect(Query $query, string $reference)
28 28
     {
29 29
         $subselect = $query->subSelectForJoinWith($this->foreignMapper)
30
-                           ->as($reference);
30
+                            ->as($reference);
31 31
 
32 32
         $subselect = $this->applyQueryCallback($subselect);
33 33
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
         parent::applyDefaults();
15 15
 
16 16
         $foreignKey = $this->foreignMapper->getConfig()->getPrimaryKey();
17
-        if ( ! isset($this->options[RelationConfig::FOREIGN_KEY])) {
17
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
18 18
             $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey;
19 19
         }
20 20
 
21
-        if ( ! isset($this->options[RelationConfig::NATIVE_KEY])) {
21
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
22 22
             $nativeKey                                 = $this->getKeyColumn($this->name, $foreignKey);
23 23
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
24 24
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     protected function addActionOnDelete(BaseAction $action)
99 99
     {
100 100
         // no cascade delete? treat it as a save
101
-        if ( ! $this->isCascade()) {
101
+        if (!$this->isCascade()) {
102 102
             $this->addActionOnSave($action);
103 103
         } else {
104 104
             $foreignEntity = $this->nativeEntityHydrator->get($action->getEntity(), $this->name);
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 
116 116
     protected function addActionOnSave(BaseAction $action)
117 117
     {
118
-        if ( ! $this->relationWasChanged($action->getEntity())) {
118
+        if (!$this->relationWasChanged($action->getEntity())) {
119 119
             return;
120 120
         }
121 121
 
122
-        if ( ! $action->includesRelation($this->name)) {
122
+        if (!$action->includesRelation($this->name)) {
123 123
             return;
124 124
         }
125 125
         
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   +12 added lines, -12 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);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS);
94 94
         $throughName  = $throughAlias ?? $through;
95 95
 
96
-        if ( ! empty($throughColumns)) {
96
+        if (!empty($throughColumns)) {
97 97
             foreach ($throughColumns as $col => $alias) {
98 98
                 $query->columns("{$throughName}.{$col} AS {$alias}");
99 99
             }
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 
154 154
         $found = $result[$nativeId] ?? [];
155 155
 
156
-        if ( ! empty($found) && $this->entityHasRelationLoaded($nativeEntity)) {
156
+        if (!empty($found) && $this->entityHasRelationLoaded($nativeEntity)) {
157 157
             /** @var Collection $collection */
158 158
             $collection = $this->nativeEntityHydrator->get($nativeEntity, $this->name);
159 159
             foreach ($found as $foreignEntity) {
160
-                if ( ! $collection->contains($foreignEntity)) {
160
+                if (!$collection->contains($foreignEntity)) {
161 161
                     $collection->add($foreignEntity);
162 162
                 }
163 163
             }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $remainingRelations = $this->getRemainingRelations($action->getOption('relations'));
208 208
 
209 209
         // no cascade delete? treat as save so we can process the changes
210
-        if ( ! $this->isCascade()) {
210
+        if (!$this->isCascade()) {
211 211
             $this->addActionOnSave($action);
212 212
         } else {
213 213
             // retrieve them again from the DB since the related collection might not have everything
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
     protected function addActionOnSave(BaseAction $action)
229 229
     {
230
-        if ( ! $action->includesRelation($this->name)) {
230
+        if (!$action->includesRelation($this->name)) {
231 231
             return;
232 232
         }
233 233
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
         /** @var Collection $foreignEntities */
237 237
         $foreignEntities = $this->nativeEntityHydrator->get($action->getEntity(), $this->name);
238
-        if ( ! $foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
238
+        if (!$foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
239 239
             return;
240 240
         }
241 241
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
         // save the entities still in the collection
245 245
         foreach ($foreignEntities as $foreignEntity) {
246
-            if ( ! empty($foreignEntity->getChanges())) {
246
+            if (!empty($foreignEntity->getChanges())) {
247 247
                 $saveAction = $this->foreignMapper
248 248
                     ->newSaveAction($foreignEntity, [
249 249
                         'relations' => $remainingRelations
Please login to merge, or discard this patch.
src/Orm.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             unset($this->lazyMappers[$name]);
91 91
         }
92 92
 
93
-        if ( ! isset($this->mappers[$name]) || ! $this->mappers[$name]) {
93
+        if (!isset($this->mappers[$name]) || !$this->mappers[$name]) {
94 94
             throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name));
95 95
         }
96 96
 
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER];
123 123
         if ($this->has($foreignMapper)) {
124
-            if ( ! $foreignMapper instanceof Mapper) {
124
+            if (!$foreignMapper instanceof Mapper) {
125 125
                 $foreignMapper = $this->get($foreignMapper);
126 126
             }
127 127
         }
128 128
         $type          = $options[RelationConfig::TYPE];
129 129
         $relationClass = 'Sirius\\Orm\\Relation\\' . Str::className($type);
130 130
 
131
-        if ( ! class_exists($relationClass)) {
131
+        if (!class_exists($relationClass)) {
132 132
             throw new InvalidArgumentException("{$relationClass} does not exist");
133 133
         }
134 134
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         }
150 150
 
151 151
         $mapper = $mapperConfigOrFactory($this);
152
-        if ( ! $mapper instanceof Mapper) {
152
+        if (!$mapper instanceof Mapper) {
153 153
             throw new InvalidArgumentException(
154 154
                 'The mapper generated from the factory is not a valid `Mapper` instance'
155 155
             );
Please login to merge, or discard this patch.
src/Behaviour/Timestamps.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             }
44 44
         }
45 45
         if ($action instanceof Update && $this->updateColumn) {
46
-            if ( ! empty($action->getEntity()->getChanges())) {
46
+            if (!empty($action->getEntity()->getChanges())) {
47 47
                 $action->addColumns([$this->updateColumn => $now]);
48 48
             }
49 49
         }
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/Entity/GenericEntity.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,16 +70,16 @@
 block discarded – undo
70 70
         $this->preventChangesIfDeleted();
71 71
 
72 72
         $value = $this->castAttribute($attribute, $value);
73
-        if ( ! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) {
73
+        if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) {
74 74
             $this->markChanged($attribute);
75
-            $this->state               = StateEnum::CHANGED;
75
+            $this->state = StateEnum::CHANGED;
76 76
         }
77 77
         $this->attributes[$attribute] = $value;
78 78
     }
79 79
 
80 80
     protected function get($attribute)
81 81
     {
82
-        if ( ! $attribute) {
82
+        if (!$attribute) {
83 83
             return null;
84 84
         }
85 85
 
Please login to merge, or discard this patch.