@@ -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 |
@@ -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 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $class->addProperty('updatedAtColumn', $this->behaviour->getUpdatedAtColumn()) |
52 | 52 | ->setVisibility('protected'); |
53 | 53 | |
54 | - if (! $class->hasMethod('init')) { |
|
54 | + if (!$class->hasMethod('init')) { |
|
55 | 55 | $class->addMethod('init')->setVisibility('public') |
56 | 56 | ->setBody('parent::init();' . PHP_EOL); |
57 | 57 | } |
@@ -121,7 +121,7 @@ |
||
121 | 121 | ->setVisibility('protected'); |
122 | 122 | |
123 | 123 | // add guard |
124 | - if (! $class->hasMethod('init')) { |
|
124 | + if (!$class->hasMethod('init')) { |
|
125 | 125 | $class->addMethod('init') |
126 | 126 | ->setVisibility(ClassType::VISIBILITY_PROTECTED) |
127 | 127 | ->setBody('parent::init();' . PHP_EOL); |
@@ -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)) { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | unset($this->lazyMappers[$name]); |
106 | 106 | } |
107 | 107 | |
108 | - if (! isset($this->mappers[$name]) || ! $this->mappers[$name]) { |
|
108 | + if (!isset($this->mappers[$name]) || !$this->mappers[$name]) { |
|
109 | 109 | throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name)); |
110 | 110 | } |
111 | 111 | |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | { |
139 | 139 | $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER]; |
140 | 140 | if ($this->has($foreignMapper)) { |
141 | - if (! $foreignMapper instanceof Mapper) { |
|
141 | + if (!$foreignMapper instanceof Mapper) { |
|
142 | 142 | $foreignMapper = $this->get($foreignMapper); |
143 | 143 | } |
144 | 144 | } |
145 | 145 | $type = $options[RelationConfig::TYPE]; |
146 | 146 | $relationClass = 'Sirius\\Orm\\Relation\\' . Str::className($type); |
147 | 147 | |
148 | - if (! class_exists($relationClass)) { |
|
148 | + if (!class_exists($relationClass)) { |
|
149 | 149 | throw new InvalidArgumentException("{$relationClass} does not exist"); |
150 | 150 | } |
151 | 151 | |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | $mapper = $this->mapperLocator->get($mapperConfigOrFactory); |
169 | 169 | } |
170 | 170 | |
171 | - if (! $mapper) { |
|
171 | + if (!$mapper) { |
|
172 | 172 | throw new InvalidArgumentException( |
173 | 173 | 'The mapper could not be generated/retrieved.' |
174 | 174 | ); |
175 | 175 | } |
176 | 176 | |
177 | - if (! $mapper instanceof Mapper) { |
|
177 | + if (!$mapper instanceof Mapper) { |
|
178 | 178 | throw new InvalidArgumentException( |
179 | 179 | 'The mapper generated from the factory is not a valid `Mapper` instance.' |
180 | 180 | ); |
@@ -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 | } |