@@ -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 | } |
@@ -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 | } |
@@ -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 | |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | |
| 89 | 89 | public function isLazyLoad() |
| 90 | 90 | { |
| 91 | - return ! isset($this->options[RelationConfig::LOAD_STRATEGY]) || |
|
| 91 | + return !isset($this->options[RelationConfig::LOAD_STRATEGY]) || |
|
| 92 | 92 | $this->options[RelationConfig::LOAD_STRATEGY] == RelationConfig::LOAD_LAZY; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | protected function ensureHydratedElement($element) |
| 42 | 42 | { |
| 43 | - if (! $this->hydrator) { |
|
| 43 | + if (!$this->hydrator) { |
|
| 44 | 44 | return $element; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function add($element) |
| 79 | 79 | { |
| 80 | 80 | $element = $this->ensureHydratedElement($element); |
| 81 | - if (! $this->contains($element)) { |
|
| 81 | + if (!$this->contains($element)) { |
|
| 82 | 82 | $this->change('added', $element); |
| 83 | 83 | |
| 84 | 84 | return $this->collection->add($element); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function removeElement($element) |
| 103 | 103 | { |
| 104 | 104 | $element = $this->ensureHydratedElement($element); |
| 105 | - if (! $this->contains($element)) { |
|
| 105 | + if (!$this->contains($element)) { |
|
| 106 | 106 | return true; |
| 107 | 107 | } |
| 108 | 108 | $removed = $this->collection->removeElement($this->findByPk($this->hydrator->getPk($element))); |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function pluck($names) |
| 129 | 129 | { |
| 130 | - return $this->map(function ($item) use ($names) { |
|
| 131 | - if (! is_array($names)) { |
|
| 130 | + return $this->map(function($item) use ($names) { |
|
| 131 | + if (!is_array($names)) { |
|
| 132 | 132 | return $this->hydrator->get($item, $names); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - return ! ! $value; |
|
| 73 | + return !!$value; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // phpcs:ignore |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | return $value; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return json_decode((string) $value, true); |
|
| 106 | + return json_decode((string)$value, true); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function json($value) |
| 110 | 110 | { |
| 111 | - if (! $value) { |
|
| 111 | + if (!$value) { |
|
| 112 | 112 | return new \ArrayObject(); |
| 113 | 113 | } |
| 114 | 114 | if (is_array($value)) { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // phpcs:ignore |
| 127 | 127 | public function json_for_db($value) |
| 128 | 128 | { |
| 129 | - if (! $value) { |
|
| 129 | + if (!$value) { |
|
| 130 | 130 | return null; |
| 131 | 131 | } |
| 132 | 132 | if (is_array($value)) { |
@@ -172,7 +172,7 @@ |
||
| 172 | 172 | |
| 173 | 173 | public function getRelation(string $name): Relation |
| 174 | 174 | { |
| 175 | - if (! $this->hasRelation($name)) { |
|
| 175 | + if (!$this->hasRelation($name)) { |
|
| 176 | 176 | throw new \InvalidArgumentException("Relation named {$name} is not registered for this mapper"); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $mapper->getHydrator()->set($action->getEntity(), $this->updateColumn, $now); |
| 46 | 46 | } |
| 47 | 47 | if ($action instanceof Update && $this->updateColumn) { |
| 48 | - if (! empty($action->getEntity()->getChanges())) { |
|
| 48 | + if (!empty($action->getEntity()->getChanges())) { |
|
| 49 | 49 | $action->addColumns([$this->updateColumn => $now]); |
| 50 | 50 | $mapper->getHydrator()->set($action->getEntity(), $this->updateColumn, $now); |
| 51 | 51 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $this->relations[$name] = $relation; |
| 65 | 65 | $this->relationCallback[$name] = $callback; |
| 66 | - if (! empty($nextLoad)) { |
|
| 66 | + if (!empty($nextLoad)) { |
|
| 67 | 67 | $this->relationNextLoad[$name] = $nextLoad; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function getResultsForRelation($name) |
| 77 | 77 | { |
| 78 | - if (! isset($this->relations[$name])) { |
|
| 78 | + if (!isset($this->relations[$name])) { |
|
| 79 | 79 | return []; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $result = []; |
| 113 | 113 | foreach ($this->rows as $row) { |
| 114 | 114 | $value = $this->getColumnsFromRow($row, $columns, $hydrator); |
| 115 | - if ($value && ! in_array($value, $result)) { |
|
| 115 | + if ($value && !in_array($value, $result)) { |
|
| 116 | 116 | $result[] = $value; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | public function getLazyAggregate(Aggregate $aggregate) |
| 144 | 144 | { |
| 145 | 145 | $name = $aggregate->getName(); |
| 146 | - if (! isset($this->lazyAggregates[$name])) { |
|
| 146 | + if (!isset($this->lazyAggregates[$name])) { |
|
| 147 | 147 | $this->lazyAggregates[$name] = new LazyAggregate($this, $aggregate); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public function getLazyRelation(Relation $relation) |
| 154 | 154 | { |
| 155 | 155 | $name = $relation->getOption('name'); |
| 156 | - if (! isset($this->lazyRelations[$name])) { |
|
| 156 | + if (!isset($this->lazyRelations[$name])) { |
|
| 157 | 157 | $this->lazyRelations[$name] = new LazyRelation($this, $relation); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $queryNextLoad = $this->relationNextLoad[$name] ?? []; |
| 192 | - if ($queryNextLoad && ! empty($queryNextLoad)) { |
|
| 192 | + if ($queryNextLoad && !empty($queryNextLoad)) { |
|
| 193 | 193 | foreach ($queryNextLoad as $next => $callback) { |
| 194 | 194 | $query = $query->load([$next => $callback]); |
| 195 | 195 | } |