@@ -10,7 +10,7 @@ |
||
10 | 10 | public static function new(...$args) |
11 | 11 | { |
12 | 12 | if ($args[0] instanceof Connection) { |
13 | - return new ConnectionLocator(function () use ($args) { |
|
13 | + return new ConnectionLocator(function() use ($args) { |
|
14 | 14 | return $args[0]; |
15 | 15 | }); |
16 | 16 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function getTableAlias($fallbackToTable = false) |
151 | 151 | { |
152 | - return ( ! $this->tableAlias && $fallbackToTable) ? $this->table : $this->tableAlias; |
|
152 | + return (!$this->tableAlias && $fallbackToTable) ? $this->table : $this->tableAlias; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | |
220 | 220 | public function getTableReference() |
221 | 221 | { |
222 | - if ( ! $this->tableReference) { |
|
222 | + if (!$this->tableReference) { |
|
223 | 223 | $this->tableReference = QueryHelper::reference($this->table, $this->tableAlias); |
224 | 224 | } |
225 | 225 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public static function underscore(string $str): string |
17 | 17 | { |
18 | - if ( ! isset(static::$cache['underscore'][$str])) { |
|
18 | + if (!isset(static::$cache['underscore'][$str])) { |
|
19 | 19 | $str = preg_replace("/([A-Z]+)/", ' $1', $str); |
20 | 20 | $str = strtolower($str); |
21 | 21 | $str = preg_replace("/[^a-z0-9]+/", ' ', $str); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public static function methodName(string $str, string $verb): string |
30 | 30 | { |
31 | 31 | $key = $verb . $str; |
32 | - if ( ! isset(static::$cache['methodName'][$key])) { |
|
32 | + if (!isset(static::$cache['methodName'][$key])) { |
|
33 | 33 | static::$cache['methodName'][$key] = strtolower($verb) . static::className($str); |
34 | 34 | } |
35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | public static function variableName(string $str): string |
40 | 40 | { |
41 | - if ( ! isset(static::$cache['variableName'][$str])) { |
|
41 | + if (!isset(static::$cache['variableName'][$str])) { |
|
42 | 42 | $class = static::className($str); |
43 | 43 | |
44 | 44 | static::$cache['variableName'][$str] = strtolower(substr($class, 0, 1)) . substr($class, 1); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public static function className(string $str): string |
51 | 51 | { |
52 | - if ( ! isset(static::$cache['className'][$str])) { |
|
52 | + if (!isset(static::$cache['className'][$str])) { |
|
53 | 53 | $str = strtolower($str); |
54 | 54 | $str = preg_replace("/[^a-z0-9]+/", ' ', $str); |
55 | 55 | $str = ucwords($str); |
@@ -7,7 +7,7 @@ |
||
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 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | if (strpos($key, $separator)) { |
27 | 27 | $parents = static::getParents($key, $separator); |
28 | 28 | foreach ($parents as $parent) { |
29 | - if ( ! isset($arr[$parent])) { |
|
29 | + if (!isset($arr[$parent])) { |
|
30 | 30 | $arr[$parent] = null; |
31 | 31 | } |
32 | 32 | } |
@@ -140,7 +140,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -29,7 +29,7 @@ |
||
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 | /** |
@@ -44,7 +44,7 @@ |
||
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); |
@@ -23,10 +23,10 @@ |
||
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 |
@@ -15,7 +15,7 @@ |
||
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 |
@@ -122,8 +122,8 @@ |
||
122 | 122 | |
123 | 123 | $insert = new \Sirius\Sql\Insert($conn); |
124 | 124 | $insert->into($throughTable) |
125 | - ->columns($insertColumns) |
|
126 | - ->perform(); |
|
125 | + ->columns($insertColumns) |
|
126 | + ->perform(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | protected function getNativeEntityHydrator() |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | protected function maybeUpdatePivotRow() |
77 | 77 | { |
78 | - if ( ! $this->relation instanceof ManyToMany) { |
|
78 | + if (!$this->relation instanceof ManyToMany) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $delete->where($throughForeignColumns[$k], $foreignKey[$k]); |
96 | 96 | } |
97 | 97 | foreach ((array)$this->relation->getOption(RelationConfig::THROUGH_GUARDS) as $col => $value) { |
98 | - if ( ! is_int($col)) { |
|
98 | + if (!is_int($col)) { |
|
99 | 99 | $delete->where($col, $value); |
100 | 100 | } else { |
101 | 101 | $delete->where($value); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | foreach ((array)$this->relation->getOption(RelationConfig::THROUGH_GUARDS) as $col => $value) { |
118 | - if ( ! is_int($col)) { |
|
118 | + if (!is_int($col)) { |
|
119 | 119 | $insertColumns[$col] = $value; |
120 | 120 | } |
121 | 121 | } |