Passed
Push — dev_2x ( fa57a5...f00e1a )
by Adrian
01:48
created
src/CodeGenerator/MapperBaseGenerator.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $this->namespace->addUse($this->mapper->getEntityNamespace() . '\\' . $this->mapper->getEntityClass());
147 147
         $method = $this->class->addMethod('find')
148
-                              ->setReturnNullable(true)
149
-                              ->setReturnType($this->mapper->getEntityClass());
148
+                                ->setReturnNullable(true)
149
+                                ->setReturnType($this->mapper->getEntityClass());
150 150
         $method->addParameter('pk');
151 151
         $method->addParameter('load', [])->setType('array');
152 152
         $method->setBody('return $this->newQuery()->find($pk, $load);');
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     protected function addNewQueryMethod()
156 156
     {
157 157
         $method = $this->class->addMethod('newQuery')
158
-                              ->setReturnType($this->mapper->getQueryClass());
158
+                                ->setReturnType($this->mapper->getQueryClass());
159 159
         $method->addBody(sprintf('$query = new %s($this->getReadConnection(), $this);', $this->mapper->getQueryClass()));
160 160
         $method->addBody('return $this->behaviours->apply($this, __FUNCTION__, $query);');
161 161
     }
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
     protected function addNewSubselectQueryMethod()
164 164
     {
165 165
         $method = $this->class->addMethod('newSubselectQuery')
166
-                              ->setReturnType($this->mapper->getQueryClass());
166
+                                ->setReturnType($this->mapper->getQueryClass());
167 167
         $this->class->getNamespace()->addUse(Connection::class, null, $connectionAlias);
168 168
         $method->addParameter('connection')
169
-               ->setType($connectionAlias);
169
+                ->setType($connectionAlias);
170 170
         $this->class->getNamespace()->addUse(Bindings::class, null, $bindingsAlias);
171 171
         $method->addParameter('bindings')
172
-               ->setType($bindingsAlias);
172
+                ->setType($bindingsAlias);
173 173
         $method->addParameter('indent')
174
-               ->setType('string');
174
+                ->setType('string');
175 175
         $method->addBody(sprintf('$query = new %s($this->getReadConnection(), $this, $bindings, $indent);', $this->mapper->getQueryClass()));
176 176
         $method->addBody('return $this->behaviours->apply($this, __FUNCTION__, $query);');
177 177
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         $this->namespace->addUse(StateEnum::class);
184 184
 
185 185
         $method = $this->class->addMethod('save')
186
-                              ->setReturnType('bool');
186
+                                ->setReturnType('bool');
187 187
         $method->addParameter('entity')->setType($this->mapper->getEntityClass());
188 188
         $method->addParameter('withRelations', false);
189 189
         $method->setBody('
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     protected function addDeleteMethod()
222 222
     {
223 223
         $method = $this->class->addMethod('delete')
224
-                              ->setReturnType('bool');
224
+                                ->setReturnType('bool');
225 225
         $method->addParameter('entity')->setType($this->mapper->getEntityClass());
226 226
         $method->addParameter('withRelations', false);
227 227
         $method->setBody('
Please login to merge, or discard this patch.
src/Orm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             unset($this->lazyMappers[$name]);
100 100
         }
101 101
 
102
-        if (! isset($this->mappers[$name]) || ! $this->mappers[$name]) {
102
+        if (!isset($this->mappers[$name]) || !$this->mappers[$name]) {
103 103
             throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name));
104 104
         }
105 105
 
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
             $mapper = $this->mapperLocator->get($mapperConfigOrFactory);
131 131
         }
132 132
 
133
-        if (! $mapper) {
133
+        if (!$mapper) {
134 134
             throw new InvalidArgumentException(
135 135
                 'The mapper could not be generated/retrieved.'
136 136
             );
137 137
         }
138 138
 
139
-        if (! $mapper instanceof Mapper) {
139
+        if (!$mapper instanceof Mapper) {
140 140
             throw new InvalidArgumentException(
141 141
                 'The mapper generated from the factory is not a valid `Mapper` instance.'
142 142
             );
Please login to merge, or discard this patch.
src/Action/AttachEntities.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@
 block discarded – undo
115 115
 
116 116
         $insert = new \Sirius\Sql\Insert($conn);
117 117
         $insert->into($pivotTable)
118
-               ->columns($insertColumns)
119
-               ->perform();
118
+                ->columns($insertColumns)
119
+                ->perform();
120 120
     }
121 121
 
122 122
     protected function getNativeEntityHydrator()
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     protected function maybeUpdatePivotRow()
70 70
     {
71
-        if (! $this->relation instanceof ManyToMany) {
71
+        if (!$this->relation instanceof ManyToMany) {
72 72
             return;
73 73
         }
74 74
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $delete->where($pivotForeignColumns[$k], $foreignKey[$k]);
89 89
         }
90 90
         foreach ((array)$this->relation->getOption(RelationConfig::PIVOT_GUARDS) as $col => $value) {
91
-            if (! is_int($col)) {
91
+            if (!is_int($col)) {
92 92
                 $delete->where($col, $value);
93 93
             } else {
94 94
                 $delete->where($value);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         foreach ((array)$this->relation->getOption(RelationConfig::PIVOT_GUARDS) as $col => $value) {
111
-            if (! is_int($col)) {
111
+            if (!is_int($col)) {
112 112
                 $insertColumns[$col] = $value;
113 113
             }
114 114
         }
Please login to merge, or discard this patch.
src/Action/DeletePivotRows.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $conditions = [];
76 76
 
77
-        $nativeEntityPk    = (array)$this->nativeMapper->getConfig()->getPrimaryKey();
77
+        $nativeEntityPk = (array)$this->nativeMapper->getConfig()->getPrimaryKey();
78 78
         $pivotThroughCols = (array)$this->relation->getOption(RelationConfig::PIVOT_NATIVE_COLUMN);
79 79
         foreach ($nativeEntityPk as $idx => $col) {
80 80
             $val = $this->nativeEntityHydrator->get($this->nativeEntity, $col);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             }
84 84
         }
85 85
 
86
-        $entityPk    = (array)$this->mapper->getConfig()->getPrimaryKey();
86
+        $entityPk = (array)$this->mapper->getConfig()->getPrimaryKey();
87 87
         $pivotColumns = (array)$this->relation->getOption(RelationConfig::PIVOT_FOREIGN_COLUMN);
88 88
         foreach ($entityPk as $idx => $col) {
89 89
             $val = $this->entityHydrator->get($this->entity, $col);
Please login to merge, or discard this patch.
src/Relation/RelationBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
     {
14 14
         $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER];
15 15
         if ($orm->has($foreignMapper)) {
16
-            if (! $foreignMapper instanceof Mapper) {
16
+            if (!$foreignMapper instanceof Mapper) {
17 17
                 $foreignMapper = $orm->get($foreignMapper);
18 18
             }
19 19
         }
20 20
         $type          = $options[RelationConfig::TYPE];
21 21
         $relationClass = 'Sirius\\Orm\\Relation\\' . Str::className($type);
22 22
 
23
-        if (! class_exists($relationClass)) {
23
+        if (!class_exists($relationClass)) {
24 24
             throw new InvalidArgumentException("{$relationClass} does not exist");
25 25
         }
26 26
 
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
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $query = $this->foreignMapper->newQuery();
62 62
 
63 63
         $query = $this->joinWithPivotTable($query)
64
-                      ->where($this->options[RelationConfig::PIVOT_NATIVE_COLUMN], $nativePks);
64
+                        ->where($this->options[RelationConfig::PIVOT_NATIVE_COLUMN], $nativePks);
65 65
 
66 66
         $query = $this->applyQueryCallback($query);
67 67
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $subselect = $this->foreignMapper->newQuery();
117 117
         $subselect = $query->subSelectForJoinWith($this->foreignMapper)
118
-                           ->as($reference);
118
+                            ->as($reference);
119 119
         #$subselect->resetGuards();
120 120
         #$subselect->setGuards($this->foreignMapper->getConfig()->getGuards());
121 121
 
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::PIVOT_TABLE])) {
33
+        if (!isset($this->options[RelationConfig::PIVOT_TABLE])) {
34 34
             $tables = [$this->foreignMapper->getConfig()->getTable(), $this->nativeMapper->getConfig()->getTable()];
35 35
             sort($tables);
36 36
             $this->options[RelationConfig::PIVOT_TABLE] = implode('_', $tables);
37 37
         }
38 38
 
39
-        if (! isset($this->options[RelationConfig::PIVOT_NATIVE_COLUMN])) {
39
+        if (!isset($this->options[RelationConfig::PIVOT_NATIVE_COLUMN])) {
40 40
             $prefix = Inflector::singularize($this->nativeMapper->getConfig()->getTableAlias(true));
41 41
 
42 42
             $this->options[RelationConfig::PIVOT_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey);
43 43
         }
44 44
 
45
-        if (! isset($this->options[RelationConfig::PIVOT_FOREIGN_COLUMN])) {
45
+        if (!isset($this->options[RelationConfig::PIVOT_FOREIGN_COLUMN])) {
46 46
             $prefix = Inflector::singularize($this->foreignMapper->getConfig()->getTableAlias(true));
47 47
 
48 48
             $this->options[RelationConfig::PIVOT_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $pivotTableAlias = $this->getOption(RelationConfig::PIVOT_TABLE_ALIAS);
99 99
         $pivotName       = $pivotTableAlias ?? $pivotTable;
100 100
 
101
-        if (! empty($pivotColumns)) {
101
+        if (!empty($pivotColumns)) {
102 102
             foreach ($pivotColumns as $col => $alias) {
103 103
                 $query->columns("{$pivotName}.{$col} AS {$alias}");
104 104
             }
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 
195 195
     protected function addActionOnSave(BaseAction $action)
196 196
     {
197
-        if (! $this->relationWasChanged($action->getEntity())) {
197
+        if (!$this->relationWasChanged($action->getEntity())) {
198 198
             return;
199 199
         }
200 200
 
201
-        if (! $action->includesRelation($this->name)) {
201
+        if (!$action->includesRelation($this->name)) {
202 202
             return;
203 203
         }
204 204
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
         /** @var Collection $foreignEntities */
208 208
         $foreignEntities = $this->nativeEntityHydrator->get($action->getEntity(), $this->name);
209
-        if (! $foreignEntities || ! $foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
209
+        if (!$foreignEntities || !$foreignEntities instanceof Collection || $foreignEntities->isEmpty()) {
210 210
             return;
211 211
         }
212 212
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
         // save the entities still in the collection
216 216
         foreach ($foreignEntities as $foreignEntity) {
217
-            if (! empty($foreignEntity->getChanges())) {
217
+            if (!empty($foreignEntity->getChanges())) {
218 218
                 $saveAction = $this->foreignMapper
219 219
                     ->newSaveAction($foreignEntity, [
220 220
                         'relations' => $remainingRelations
Please login to merge, or discard this patch.
src/Blueprint/Relation/ManyToMany.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 
59 59
     protected function maybeSetAdditionalProperties()
60 60
     {
61
-        if (! $this->mapper || ! $this->foreignMapper) {
61
+        if (!$this->mapper || !$this->foreignMapper) {
62 62
             return;
63 63
         }
64 64
 
65
-        if (! $this->pivotTable) {
65
+        if (!$this->pivotTable) {
66 66
             $tablePrefix = $this->mapper->getTableAlias() ?
67 67
                 str_replace($this->mapper->getTable(), '', $this->mapper->getTableAlias())
68 68
                 : '';
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
             }
78 78
         }
79 79
 
80
-        if (! $this->pivotNativeColumn) {
80
+        if (!$this->pivotNativeColumn) {
81 81
             $this->pivotNativeColumn = Inflector::singularize($this->mapper->getName()) . '_id';
82 82
         }
83 83
 
84
-        if (! $this->pivotForeignColumn) {
84
+        if (!$this->pivotForeignColumn) {
85 85
             $this->pivotForeignColumn = Inflector::singularize($this->foreignMapper) . '_id';
86 86
         }
87 87
     }
Please login to merge, or discard this patch.