Completed
Push — master ( a7b476...58257b )
by Adrian
01:51
created
src/Helpers/QueryHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 {
8 8
     public static function reference($table, $tableAlias)
9 9
     {
10
-        if (! $tableAlias || $table == $tableAlias) {
10
+        if (!$tableAlias || $table == $tableAlias) {
11 11
             return $table;
12 12
         }
13 13
 
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
     public static function joinCondition($firsTable, $firstColumns, $secondTable, $secondColumns)
18 18
     {
19
-        $firstColumns = (array) $firstColumns;
20
-        $secondColumns = (array) $secondColumns;
19
+        $firstColumns = (array)$firstColumns;
20
+        $secondColumns = (array)$secondColumns;
21 21
 
22 22
         $parts = [];
23 23
         foreach ($firstColumns as $k => $col) {
Please login to merge, or discard this patch.
src/Query.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 
85 85
     public function joinWith($name): Query
86 86
     {
87
-        if (! $this->mapper->hasRelation($name)) {
87
+        if (!$this->mapper->hasRelation($name)) {
88 88
             throw new \InvalidArgumentException(
89 89
                 sprintf("Relation %s, not defined for %s", $name, $this->mapper->getTable())
90 90
             );
Please login to merge, or discard this patch.
src/CastingManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     public function bool($value)
68 68
     {
69
-        return ! ! $value;
69
+        return !!$value;
70 70
     }
71 71
 
72 72
     // phpcs:ignore
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     public function float($value)
84 84
     {
85
-        return $value === null ? null : (float) $value;
85
+        return $value === null ? null : (float)$value;
86 86
     }
87 87
 
88 88
     public function decimal($value, $digits)
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function json($value)
94 94
     {
95
-        if (! $value) {
95
+        if (!$value) {
96 96
             return new \ArrayObject();
97 97
         }
98 98
         if (is_array($value)) {
Please login to merge, or discard this patch.
src/Relation/OneToOne.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     protected function addActionOnDelete(BaseAction $action)
31 31
     {
32 32
         // no cascade delete? treat it as a save
33
-        if (! $this->isCascade()) {
33
+        if (!$this->isCascade()) {
34 34
             $this->addActionOnSave($action);
35 35
         } else {
36 36
             $nativeEntity  = $action->getEntity();
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     protected function addActionOnSave(BaseAction $action)
50 50
     {
51
-        if (! $this->relationWasChanged($action->getEntity())) {
51
+        if (!$this->relationWasChanged($action->getEntity())) {
52 52
             return;
53 53
         }
54 54
         $foreignEntity = $this->nativeMapper->getEntityAttribute($action->getEntity(), $this->name);
Please login to merge, or discard this patch.
src/Relation/OneToMany.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@
 block discarded – undo
47 47
     {
48 48
         $tableRef = $this->foreignMapper->getTableAlias(true);
49 49
         $subselect = $query->subSelectForJoinWith()
50
-                           ->columns($this->foreignMapper->getTable() . '.*')
51
-                           ->from($this->foreignMapper->getTable())
52
-                           ->as($reference);
50
+                            ->columns($this->foreignMapper->getTable() . '.*')
51
+                            ->from($this->foreignMapper->getTable())
52
+                            ->as($reference);
53 53
 
54 54
         $subselect = $this->applyQueryCallback($subselect);
55 55
 
Please login to merge, or discard this patch.
src/Relation/ManyToOne.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
     {
30 30
         $tableRef = $this->foreignMapper->getTableAlias(true);
31 31
         $subselect = $query->subSelectForJoinWith()
32
-                           ->from($this->foreignMapper->getTable())
33
-                           ->columns($this->foreignMapper->getTable() . '.*')
34
-                           ->as($reference);
32
+                            ->from($this->foreignMapper->getTable())
33
+                            ->columns($this->foreignMapper->getTable() . '.*')
34
+                            ->as($reference);
35 35
 
36 36
         $subselect = $this->applyQueryCallback($subselect);
37 37
 
Please login to merge, or discard this patch.
src/Relation/ManyToMany.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             ->newQuery();
58 58
 
59 59
         $query = $this->joinWithThroughTable($query)
60
-                      ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
60
+                        ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks);
61 61
 
62 62
         $query = $this->applyQueryCallback($query);
63 63
 
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $tableRef  = $this->foreignMapper->getTableAlias(true);
112 112
         $subselect = $query->subSelectForJoinWith()
113
-                           ->from($this->foreignMapper->getTable())
114
-                           ->columns($this->foreignMapper->getTable() . '.*')
115
-                           ->as($reference);
113
+                            ->from($this->foreignMapper->getTable())
114
+                            ->columns($this->foreignMapper->getTable() . '.*')
115
+                            ->as($reference);
116 116
 
117 117
         $subselect = $this->joinWithThroughTable($subselect);
118 118
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
         $this->setOptionIfMissing(RelationConfig::THROUGH_COLUMNS_PREFIX, 'pivot_');
21 21
 
22 22
         $foreignKey = $this->foreignMapper->getPrimaryKey();
23
-        if (! isset($this->options[RelationConfig::FOREIGN_KEY])) {
23
+        if (!isset($this->options[RelationConfig::FOREIGN_KEY])) {
24 24
             $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey;
25 25
         }
26 26
 
27 27
         $nativeKey = $this->foreignMapper->getPrimaryKey();
28
-        if (! isset($this->options[RelationConfig::NATIVE_KEY])) {
28
+        if (!isset($this->options[RelationConfig::NATIVE_KEY])) {
29 29
             $this->options[RelationConfig::NATIVE_KEY] = $nativeKey;
30 30
         }
31 31
 
32
-        if (! isset($this->options[RelationConfig::THROUGH_TABLE])) {
32
+        if (!isset($this->options[RelationConfig::THROUGH_TABLE])) {
33 33
             $tables = [$this->foreignMapper->getTable(), $this->nativeMapper->getTable()];
34 34
             sort($tables);
35 35
             $this->options[RelationConfig::THROUGH_TABLE] = implode('_', $tables);
36 36
         }
37 37
 
38
-        if (! isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
38
+        if (!isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) {
39 39
             $prefix = Inflector::singularize($this->nativeMapper->getTableAlias(true));
40 40
 
41 41
             $this->options[RelationConfig::THROUGH_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey);
42 42
         }
43 43
 
44
-        if (! isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
44
+        if (!isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) {
45 45
             $prefix = Inflector::singularize($this->foreignMapper->getTableAlias(true));
46 46
 
47 47
             $this->options[RelationConfig::THROUGH_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS);
93 93
         $throughName  = $throughAlias ?? $through;
94 94
 
95
-        if (! empty($throughColumns)) {
95
+        if (!empty($throughColumns)) {
96 96
             $prefix = $this->getOption(RelationConfig::THROUGH_COLUMNS_PREFIX);
97 97
             foreach ($throughColumns as $col) {
98 98
                 $query->columns("{$throughName}.{$col} AS {$prefix}{$col}");
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         if ($this->entityHasRelationLoaded($nativeEntity)) {
151 151
             /** @var Collection $collection */
152 152
             $collection = $this->nativeMapper->getEntityAttribute($nativeEntity, $this->name);
153
-            if (! $collection->contains($foreignEntity)) {
153
+            if (!$collection->contains($foreignEntity)) {
154 154
                 $collection->add($foreignEntity);
155 155
             }
156 156
         } else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $remainingRelations = $this->getRemainingRelations($action->getOption('relations'));
198 198
 
199 199
         // no cascade delete? treat as save so we can process the changes
200
-        if (! $this->isCascade()) {
200
+        if (!$this->isCascade()) {
201 201
             $this->addActionOnSave($action);
202 202
         } else {
203 203
             // retrieve them again from the DB since the related collection might not have everything
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
         /** @var Collection $foreignEntities */
221 221
         $foreignEntities = $this->nativeMapper->getEntityAttribute($action->getEntity(), $this->name);
222
-        if (! $foreignEntities) {
222
+        if (!$foreignEntities) {
223 223
             return;
224 224
         }
225 225
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         // save the entities still in the collection
229 229
         foreach ($foreignEntities as $foreignEntity) {
230
-            if (! empty($foreignEntity->getChanges())) {
230
+            if (!empty($foreignEntity->getChanges())) {
231 231
                 $saveAction = $this->foreignMapper
232 232
                     ->newSaveAction($foreignEntity, [
233 233
                         'relations' => $remainingRelations
Please login to merge, or discard this patch.