Completed
Branch dev_2x (79898e)
by Adrian
09:26
created
src/Definition/Relation/OneToOne.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@
 block discarded – undo
14 14
 
15 15
     public function setMapper(Mapper $mapper): Relation
16 16
     {
17
-        if ($mapper && ! $this->foreignKey) {
17
+        if ($mapper && !$this->foreignKey) {
18 18
             $this->foreignKey = Inflector::singularize($mapper->getName()) . '_id';
19 19
         }
20 20
 
21
-        if ($mapper && ! $this->nativeKey) {
21
+        if ($mapper && !$this->nativeKey) {
22 22
             $this->nativeKey = $mapper->getPrimaryKey();
23 23
         }
24 24
 
Please login to merge, or discard this patch.
src/Definition/Relation/ManyToOne.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
     public function setForeignMapper($foreignMapper)
18 18
     {
19
-        if ($foreignMapper && ! $this->nativeKey) {
19
+        if ($foreignMapper && !$this->nativeKey) {
20 20
             $this->nativeKey = Inflector::singularize($foreignMapper) . '_id';
21 21
         }
22 22
 
Please login to merge, or discard this patch.
src/Definition/Relation/ManyToMany.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     protected function maybeSetAdditionalProperties()
49 49
     {
50
-        if ( ! $this->mapper || ! $this->foreignMapper) {
50
+        if (!$this->mapper || !$this->foreignMapper) {
51 51
             return;
52 52
         }
53 53
 
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
             $this->throughTableAlias = implode('_', $tables);
65 65
         }
66 66
 
67
-        if ( ! $this->throughNativeColumn) {
67
+        if (!$this->throughNativeColumn) {
68 68
             $this->throughNativeColumn = Inflector::singularize($this->mapper->getName()) . '_id';
69 69
         }
70 70
 
71
-        if ( ! $this->throughForeignColumn) {
71
+        if (!$this->throughForeignColumn) {
72 72
             $this->throughForeignColumn = Inflector::singularize($this->foreignMapper) . '_id';
73 73
         }
74 74
     }
Please login to merge, or discard this patch.
src/Definition/Orm.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,27 +39,27 @@
 block discarded – undo
39 39
     {
40 40
         $errors = [];
41 41
 
42
-        if ( ! $this->entityNamespace) {
42
+        if (!$this->entityNamespace) {
43 43
             $errors[] = 'Missing entity namespace property';
44 44
         }
45 45
 
46
-        if ( ! $this->entityDestination) {
46
+        if (!$this->entityDestination) {
47 47
             $errors[] = 'Missing entity destination property';
48
-        } elseif ( ! is_dir($this->entityDestination)) {
48
+        } elseif (!is_dir($this->entityDestination)) {
49 49
             $errors[] = sprintf('%s is not a valid directory', $this->entityDestination);
50
-        } elseif ( ! is_writable($this->entityDestination)) {
50
+        } elseif (!is_writable($this->entityDestination)) {
51 51
             $errors[] = sprintf('%s is not writable', $this->entityDestination);
52 52
         }
53 53
 
54
-        if ( ! $this->mapperNamespace) {
54
+        if (!$this->mapperNamespace) {
55 55
             $errors[] = 'Missing mapper namespace property';
56 56
         }
57 57
 
58
-        if ( ! $this->mapperDestination) {
58
+        if (!$this->mapperDestination) {
59 59
             $errors[] = 'Missing entity destination property';
60
-        } elseif ( ! is_dir($this->mapperDestination)) {
60
+        } elseif (!is_dir($this->mapperDestination)) {
61 61
             $errors[] = sprintf('%s is not a valid directory', $this->mapperDestination);
62
-        } elseif ( ! is_writable($this->mapperDestination)) {
62
+        } elseif (!is_writable($this->mapperDestination)) {
63 63
             $errors[] = sprintf('%s is not writable', $this->mapperDestination);
64 64
         }
65 65
 
Please login to merge, or discard this patch.
src/Definition/Behaviour/SoftDelete.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         if ($this->deletedAtColumn && ! array_key_exists($this->deletedAtColumn, $columns)) {
48 48
             $mapper->addColumn(Column::datetime($this->deletedAtColumn)
49
-                                     ->setNullable(true));
49
+                                        ->setNullable(true));
50 50
         }
51 51
 
52 52
         return $this;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $class->getNamespace()->addUse(\Sirius\Orm\Action\Delete::class, 'DeleteAction');
59 59
         $class->getNamespace()->addUse(\Sirius\Orm\Action\Update::class, 'UpdateAction');
60 60
         $class->addProperty('deletedAtColumn', $this->deletedAtColumn)
61
-              ->setVisibility('protected');
61
+                ->setVisibility('protected');
62 62
 
63 63
         //
64 64
         $method = $class->addMethod('newDeleteAction');
@@ -123,21 +123,21 @@  discard block
 block discarded – undo
123 123
     public function observeBaseQueryClass(ClassType $class): ClassType
124 124
     {
125 125
         $class->addProperty('deletedAtColumn', $this->deletedAtColumn)
126
-              ->setVisibility('protected');
126
+                ->setVisibility('protected');
127 127
 
128 128
         // add guard
129 129
         if ( ! $class->hasMethod('init')) {
130 130
             $class->addMethod('init')
131
-                  ->setVisibility(ClassType::VISIBILITY_PROTECTED)
132
-                  ->setBody('parent::init();' . PHP_EOL);
131
+                    ->setVisibility(ClassType::VISIBILITY_PROTECTED)
132
+                    ->setBody('parent::init();' . PHP_EOL);
133 133
         }
134 134
         $init = $class->getMethod('init');
135 135
         $init->addBody('$this->guards[] = $this->deletedAtColumn . \' IS NULL\';' . PHP_EOL);
136 136
 
137 137
         // add withTrashed()
138 138
         $class->addMethod('withTrashed')
139
-              ->setVisibility(ClassType::VISIBILITY_PUBLIC)
140
-              ->setBody('
139
+                ->setVisibility(ClassType::VISIBILITY_PUBLIC)
140
+                ->setBody('
141 141
 $guards = [];
142 142
 foreach ($this->guards as $k => $v) {
143 143
     if ($v != $this->deletedAtColumn . \' IS NULL\') {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
         $columns = $mapper->getColumns();
46 46
 
47
-        if ($this->deletedAtColumn && ! array_key_exists($this->deletedAtColumn, $columns)) {
47
+        if ($this->deletedAtColumn && !array_key_exists($this->deletedAtColumn, $columns)) {
48 48
             $mapper->addColumn(Column::datetime($this->deletedAtColumn)
49 49
                                      ->setNullable(true));
50 50
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
               ->setVisibility('protected');
127 127
 
128 128
         // add guard
129
-        if ( ! $class->hasMethod('init')) {
129
+        if (!$class->hasMethod('init')) {
130 130
             $class->addMethod('init')
131 131
                   ->setVisibility(ClassType::VISIBILITY_PROTECTED)
132 132
                   ->setBody('parent::init();' . PHP_EOL);
Please login to merge, or discard this patch.
src/Definition/Behaviour/Timestamps.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
     static public function make($createdAtColumn = 'created_at', $updatedAtColumn = 'updated_at')
20 20
     {
21 21
         return parent::make()
22
-                     ->setCreatedAtColumn($createdAtColumn)
23
-                     ->setUpdatedAtColumn($updatedAtColumn);
22
+                        ->setCreatedAtColumn($createdAtColumn)
23
+                        ->setUpdatedAtColumn($updatedAtColumn);
24 24
     }
25 25
 
26 26
     function getName(): string
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 
61 61
         if ($this->createdAtColumn && ! array_key_exists($this->createdAtColumn, $columns)) {
62 62
             $mapper->addColumn(Column::datetime($this->createdAtColumn)
63
-                                     ->setNullable(true));
63
+                                        ->setNullable(true));
64 64
         }
65 65
 
66 66
         if ($this->updatedAtColumn && ! array_key_exists($this->updatedAtColumn, $columns)) {
67 67
             $mapper->addColumn(Column::datetime($this->updatedAtColumn)
68
-                                     ->setNullable(true)
69
-                                     ->setAfter($this->createdAtColumn));
68
+                                        ->setNullable(true)
69
+                                        ->setAfter($this->createdAtColumn));
70 70
         }
71 71
 
72 72
         return $this;
@@ -75,35 +75,35 @@  discard block
 block discarded – undo
75 75
     public function observeBaseQueryClass(ClassType $class): ClassType
76 76
     {
77 77
         $class->addProperty('createdAtColumn', $this->createdAtColumn)
78
-              ->setVisibility('protected');
78
+                ->setVisibility('protected');
79 79
         $class->addProperty('updatedAtColumn', $this->updatedAtColumn)
80
-              ->setVisibility('protected');
80
+                ->setVisibility('protected');
81 81
 
82 82
         // add methods
83 83
         $class->addMethod('orderByFirstCreated')
84
-              ->setVisibility('public')
85
-              ->setBody('
84
+                ->setVisibility('public')
85
+                ->setBody('
86 86
 $this->orderBy($this->createdAtColumn . \' ASC\');
87 87
 
88 88
 return $this;            
89 89
             ');
90 90
         $class->addMethod('orderByLastCreated')
91
-              ->setVisibility('public')
92
-              ->setBody('
91
+                ->setVisibility('public')
92
+                ->setBody('
93 93
 $this->orderBy($this->createdAtColumn . \' DESC\');
94 94
 
95 95
 return $this;            
96 96
             ');
97 97
         $class->addMethod('orderByFirstUpdated')
98
-              ->setVisibility('public')
99
-              ->setBody('
98
+                ->setVisibility('public')
99
+                ->setBody('
100 100
 $this->orderBy($this->updatedAtColumn . \' ASC\');
101 101
 
102 102
 return $this;            
103 103
             ');
104 104
         $class->addMethod('orderByLastCreated')
105
-              ->setVisibility('public')
106
-              ->setBody('
105
+                ->setVisibility('public')
106
+                ->setBody('
107 107
 $this->orderBy($this->updatedAtColumn . \' DESC\');
108 108
 
109 109
 return $this;            
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         if ( ! $class->hasMethod('init')) {
121 121
             $class->addMethod('init')->setVisibility('public')
122
-                  ->setBody('parent::init();' . PHP_EOL);
122
+                    ->setBody('parent::init();' . PHP_EOL);
123 123
         }
124 124
         $class->getNamespace()->addUse(\Sirius\Orm\Behaviour\Timestamps::class);
125 125
         $method = $class->getMethod('init');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
         $columns = $mapper->getColumns();
60 60
 
61
-        if ($this->createdAtColumn && ! array_key_exists($this->createdAtColumn, $columns)) {
61
+        if ($this->createdAtColumn && !array_key_exists($this->createdAtColumn, $columns)) {
62 62
             $mapper->addColumn(Column::datetime($this->createdAtColumn)
63 63
                                      ->setNullable(true));
64 64
         }
65 65
 
66
-        if ($this->updatedAtColumn && ! array_key_exists($this->updatedAtColumn, $columns)) {
66
+        if ($this->updatedAtColumn && !array_key_exists($this->updatedAtColumn, $columns)) {
67 67
             $mapper->addColumn(Column::datetime($this->updatedAtColumn)
68 68
                                      ->setNullable(true)
69 69
                                      ->setAfter($this->createdAtColumn));
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $class->addProperty('createdAtColumn', $this->createdAtColumn)->setVisibility('protected');
118 118
         $class->addProperty('updatedAtColumn', $this->updatedAtColumn)->setVisibility('protected');
119 119
 
120
-        if ( ! $class->hasMethod('init')) {
120
+        if (!$class->hasMethod('init')) {
121 121
             $class->addMethod('init')->setVisibility('public')
122 122
                   ->setBody('parent::init();' . PHP_EOL);
123 123
         }
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
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             return $this;
141 141
         }
142 142
 
143
-        if ( ! $this->mapper->hasRelation($name)) {
143
+        if (!$this->mapper->hasRelation($name)) {
144 144
             throw new \InvalidArgumentException(
145 145
                 sprintf("Relation %s, not defined for %s", $name, $this->mapper->getConfig()->getTable())
146 146
             );
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
             return null;
203 203
         }
204 204
 
205
-        $receivedTracker = ! ! $tracker;
206
-        if ( ! $tracker) {
205
+        $receivedTracker = !!$tracker;
206
+        if (!$tracker) {
207 207
             $receivedTracker = false;
208 208
             $tracker         = new Tracker([$data]);
209 209
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         $this->injectAggregates($entity, $tracker, $load);
214 214
         $entity->setState(StateEnum::SYNCHRONIZED);
215 215
 
216
-        if ( ! $receivedTracker) {
216
+        if (!$receivedTracker) {
217 217
             $tracker->replaceRows([$entity]);
218 218
         }
219 219
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             $queryCallback = $eagerLoad[$name] ?? null;
266 266
             $nextLoad      = Arr::getChildren($eagerLoad, $name);
267 267
 
268
-            if ( ! $tracker->hasRelation($name)) {
268
+            if (!$tracker->hasRelation($name)) {
269 269
                 $tracker->setRelation($name, $relation, $queryCallback, $nextLoad);
270 270
             }
271 271
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     {
282 282
         foreach ($this->mapper->getRelations() as $name) {
283 283
             $relation = $this->mapper->getRelation($name);
284
-            if ( ! method_exists($relation, 'getAggregates')) {
284
+            if (!method_exists($relation, 'getAggregates')) {
285 285
                 continue;
286 286
             }
287 287
             $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/Action/Insert.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
         $insertSql = new \Sirius\Sql\Insert($connection);
31 31
         $insertSql->into($this->mapper->getConfig()->getTable())
32
-                  ->columns($columns);
32
+                    ->columns($columns);
33 33
         $insertSql->perform();
34 34
 
35 35
         /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
     public function revert()
46 46
     {
47
-        if ( ! $this->hasRun) {
47
+        if (!$this->hasRun) {
48 48
             return;
49 49
         }
50 50
         $this->entityHydrator->setPk($this->entity, $this->entityId);
Please login to merge, or discard this patch.
src/Action/SoftDelete.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
 
24 24
         $update = new \Sirius\Sql\Update($this->mapper->getWriteConnection());
25 25
         $update->table($this->mapper->getConfig()->getTable())
26
-               ->columns([
27
-                   $this->getOption('deleted_at_column') => $this->now
28
-               ])
29
-               ->where('id', $entityId);
26
+                ->columns([
27
+                    $this->getOption('deleted_at_column') => $this->now
28
+                ])
29
+                ->where('id', $entityId);
30 30
         $update->perform();
31 31
     }
32 32
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     protected function execute()
16 16
     {
17 17
         $entityId = $this->entityHydrator->getPk($this->entity);
18
-        if ( ! $entityId) {
18
+        if (!$entityId) {
19 19
             return;
20 20
         }
21 21
 
Please login to merge, or discard this patch.