Passed
Push — dev_2x ( d7ecbe...3e8772 )
by Adrian
01:43
created
src/Blueprint/Relation.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $errors = [];
51 51
 
52
-        if (! $this->name) {
52
+        if (!$this->name) {
53 53
             $errors[] = "Unknown relation name";
54 54
         }
55 55
 
56
-        if (! $this->type) {
56
+        if (!$this->type) {
57 57
             $errors[] = "Unknown relation type";
58 58
         }
59 59
 
60
-        if (! $this->nativeKey) {
60
+        if (!$this->nativeKey) {
61 61
             $errors[] = "Missing native key column";
62 62
         }
63 63
 
64
-        if (! $this->foreignMapper) {
64
+        if (!$this->foreignMapper) {
65 65
             $errors[] = "Missing foreign mapper name";
66 66
         }
67 67
 
68
-        if (! $this->foreignKey) {
68
+        if (!$this->foreignKey) {
69 69
             $errors[] = "Missing foreign key";
70 70
         }
71 71
 
72 72
         $strategies = [RelationConfig::LOAD_LAZY, RelationConfig::LOAD_EAGER, RelationConfig::LOAD_NONE];
73
-        if (! in_array($this->loadStrategy, $strategies)) {
73
+        if (!in_array($this->loadStrategy, $strategies)) {
74 74
             $errors[] = sprintf("Relation loading strategy is not valid (allowed values: %s)", implode(', ', $strategies));
75 75
         }
76 76
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                 $value !== 0 &&
206 206
                 $value !== '' &&
207 207
                 $value !== [] &&
208
-                ! is_object($value)) {
208
+                !is_object($value)) {
209 209
                 $result[Str::underscore($prop)] = $value;
210 210
             }
211 211
             if (is_object($value) && is_callable($value)) {
Please login to merge, or discard this patch.
src/Blueprint/ClassMethod.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
     {
33 33
         $errors = [];
34 34
 
35
-        if (! $this->name) {
35
+        if (!$this->name) {
36 36
             $errors[] = 'Method requires a name';
37 37
         }
38 38
 
39
-        if (! in_array($this->visibility, [ClassType::VISIBILITY_PUBLIC, ClassType::VISIBILITY_PROTECTED])) {
39
+        if (!in_array($this->visibility, [ClassType::VISIBILITY_PUBLIC, ClassType::VISIBILITY_PROTECTED])) {
40 40
             $errors[] = 'Wrong method visilibity type. Only `public` and `protected` are allowed.';
41 41
         }
42 42
 
Please login to merge, or discard this patch.
src/Query.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             return $this;
139 139
         }
140 140
 
141
-        if (! $this->mapper->hasRelation($name)) {
141
+        if (!$this->mapper->hasRelation($name)) {
142 142
             throw new \InvalidArgumentException(
143 143
                 sprintf("Relation %s, not defined for %s", $name, $this->mapper->getConfig()->getTable())
144 144
             );
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
             return null;
201 201
         }
202 202
 
203
-        $receivedTracker = ! ! $tracker;
204
-        if (! $tracker) {
203
+        $receivedTracker = !!$tracker;
204
+        if (!$tracker) {
205 205
             $receivedTracker = false;
206 206
             $tracker         = new Tracker([$data]);
207 207
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $this->injectAggregates($entity, $tracker, $load);
212 212
         $entity->setState(StateEnum::SYNCHRONIZED);
213 213
 
214
-        if (! $receivedTracker) {
214
+        if (!$receivedTracker) {
215 215
             $tracker->replaceRows([$entity]);
216 216
         }
217 217
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             $queryCallback = $eagerLoad[$name] ?? null;
263 263
             $nextLoad      = Arr::getChildren($eagerLoad, $name);
264 264
 
265
-            if (! $tracker->hasRelation($name)) {
265
+            if (!$tracker->hasRelation($name)) {
266 266
                 $tracker->setRelation($name, $relation, $queryCallback, $nextLoad);
267 267
             }
268 268
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
     {
279 279
         foreach ($this->mapper->getRelations() as $name) {
280 280
             $relation = $this->mapper->getRelation($name);
281
-            if (! method_exists($relation, 'getAggregates')) {
281
+            if (!method_exists($relation, 'getAggregates')) {
282 282
                 continue;
283 283
             }
284 284
             $aggregates = $relation->getAggregates();
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      */
308 308
     public function chunk(int $size, callable $callback, int $limit = 100000)
309 309
     {
310
-        if (! $this->orderBy->build()) {
310
+        if (!$this->orderBy->build()) {
311 311
             $this->orderBy(...(array)$this->mapper->getConfig()->getPrimaryKey());
312 312
         }
313 313
 
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.