@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public static function underscore($str) |
17 | 17 | { |
18 | - if (! isset(static::$cache['underscore'][$str])) { |
|
18 | + if (!isset(static::$cache['underscore'][$str])) { |
|
19 | 19 | $str = strtolower($str); |
20 | 20 | $str = preg_replace("/[^a-z0-9]+/", ' ', $str); |
21 | 21 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public static function methodName($str, $verb) |
29 | 29 | { |
30 | 30 | $key = $verb . $str; |
31 | - if (! isset(static::$cache['methodName'][$key])) { |
|
31 | + if (!isset(static::$cache['methodName'][$key])) { |
|
32 | 32 | static::$cache['methodName'][$key] = strtolower($verb) . static::className($str); |
33 | 33 | } |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public static function variableName($str) |
39 | 39 | { |
40 | - if (! isset(static::$cache['variableName'][$str])) { |
|
40 | + if (!isset(static::$cache['variableName'][$str])) { |
|
41 | 41 | $class = static::className($str); |
42 | 42 | |
43 | 43 | static::$cache['variableName'][$str] = strtolower(substr($class, 0, 1)) . substr($class, 1); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public static function className($str) |
50 | 50 | { |
51 | - if (! isset(static::$cache['className'][$str])) { |
|
51 | + if (!isset(static::$cache['className'][$str])) { |
|
52 | 52 | $str = strtolower($str); |
53 | 53 | $str = preg_replace("/[^a-z0-9]+/", ' ', $str); |
54 | 54 | $str = ucwords($str); |
@@ -77,7 +77,7 @@ |
||
77 | 77 | /** @var ArrayCollection $changeCollection */ |
78 | 78 | $changeCollection = $this->changes[$t]; |
79 | 79 | if ($t == $type) { |
80 | - if (! $changeCollection->contains($element)) { |
|
80 | + if (!$changeCollection->contains($element)) { |
|
81 | 81 | $changeCollection->add($element); |
82 | 82 | } |
83 | 83 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function setRelation($name, Relation $relation, $callback, $overwrite = false) |
47 | 47 | { |
48 | - if ($overwrite || ! isset($this->relations[$name])) { |
|
48 | + if ($overwrite || !isset($this->relations[$name])) { |
|
49 | 49 | $this->relations[$name] = $relation; |
50 | 50 | $this->relationCallbacks[$name] = $callback; |
51 | 51 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function getRelationResults($name) |
65 | 65 | { |
66 | - if (! isset($this->relations[$name])) { |
|
66 | + if (!isset($this->relations[$name])) { |
|
67 | 67 | return null; |
68 | 68 | } |
69 | 69 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | if ($action instanceof Update && $this->updateColumn) { |
45 | - if (! empty($action->getEntity()->getChanges())) { |
|
45 | + if (!empty($action->getEntity()->getChanges())) { |
|
46 | 46 | $action->addColumns([$this->updateColumn => time()]); |
47 | 47 | } |
48 | 48 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | public function register($name, callable $func) |
11 | 11 | { |
12 | - if (! $name) { |
|
12 | + if (!$name) { |
|
13 | 13 | return; // ignore |
14 | 14 | } |
15 | 15 | $this->casts[$name] = $func; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function bool($value) |
38 | 38 | { |
39 | - return ! ! $value; |
|
39 | + return !!$value; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function int($value) |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public static function getInstance() |
18 | 18 | { |
19 | - if (! static::$instance) { |
|
19 | + if (!static::$instance) { |
|
20 | 20 | static::$instance = new static; |
21 | 21 | } |
22 | 22 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | protected function getQueryClass(Mapper $mapper) |
34 | 34 | { |
35 | 35 | $mapperClass = get_class($mapper); |
36 | - if (! isset($this->queryClasses[$mapperClass])) { |
|
36 | + if (!isset($this->queryClasses[$mapperClass])) { |
|
37 | 37 | $queryClass = $mapperClass . 'Query'; |
38 | 38 | if (class_exists($queryClass)) { |
39 | 39 | $this->queryClasses[$mapperClass] = $queryClass; |
@@ -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 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | $value = $this->castAttribute($attribute, $value); |
101 | - if (! isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
101 | + if (!isset($this->attributes[$attribute]) || $value != $this->attributes[$attribute]) { |
|
102 | 102 | $this->changed[$attribute] = true; |
103 | 103 | $this->state = StateEnum::CHANGED; |
104 | 104 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | public function get($attribute) |
111 | 111 | { |
112 | - if (! $attribute) { |
|
112 | + if (!$attribute) { |
|
113 | 113 | return null; |
114 | 114 | } |
115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | public function getPersistenceState() |
122 | 122 | { |
123 | - if (! empty($this->changed)) { |
|
123 | + if (!empty($this->changed)) { |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $this->state; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $changes = $this->changed; |
151 | 151 | foreach ($this->attributes as $name => $value) { |
152 | 152 | if (is_object($value) && method_exists($value, 'getChanges')) { |
153 | - if (! empty($value->getChanges())) { |
|
153 | + if (!empty($value->getChanges())) { |
|
154 | 154 | $changes[$name] = true; |
155 | 155 | } |
156 | 156 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | ->newQuery(); |
57 | 57 | |
58 | 58 | $query = $this->joinWithThroughTable($query) |
59 | - ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks); |
|
59 | + ->where($this->options[RelationConfig::THROUGH_NATIVE_COLUMN], $nativePks); |
|
60 | 60 | |
61 | 61 | if ($this->getOption(RelationConfig::QUERY_CALLBACK) && |
62 | 62 | is_callable($this->getOption(RelationConfig::QUERY_CALLBACK))) { |
@@ -19,28 +19,28 @@ discard block |
||
19 | 19 | $this->setOptionIfMissing(RelationConfig::THROUGH_COLUMNS_PREFIX, 'pivot_'); |
20 | 20 | |
21 | 21 | $foreignKey = $this->foreignMapper->getPrimaryKey(); |
22 | - if (! isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
22 | + if (!isset($this->options[RelationConfig::FOREIGN_KEY])) { |
|
23 | 23 | $this->options[RelationConfig::FOREIGN_KEY] = $foreignKey; |
24 | 24 | } |
25 | 25 | |
26 | 26 | $nativeKey = $this->foreignMapper->getPrimaryKey(); |
27 | - if (! isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
27 | + if (!isset($this->options[RelationConfig::NATIVE_KEY])) { |
|
28 | 28 | $this->options[RelationConfig::NATIVE_KEY] = $nativeKey; |
29 | 29 | } |
30 | 30 | |
31 | - if (! isset($this->options[RelationConfig::THROUGH_TABLE])) { |
|
31 | + if (!isset($this->options[RelationConfig::THROUGH_TABLE])) { |
|
32 | 32 | $tables = [$this->foreignMapper->getTable(), $this->nativeMapper->getTable()]; |
33 | 33 | sort($tables); |
34 | 34 | $this->options[RelationConfig::THROUGH_TABLE] = implode('_', $tables); |
35 | 35 | } |
36 | 36 | |
37 | - if (! isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) { |
|
37 | + if (!isset($this->options[RelationConfig::THROUGH_NATIVE_COLUMN])) { |
|
38 | 38 | $prefix = Inflector::singularize($this->nativeMapper->getTableAlias(true)); |
39 | 39 | |
40 | 40 | $this->options[RelationConfig::THROUGH_NATIVE_COLUMN] = $this->getKeyColumn($prefix, $nativeKey); |
41 | 41 | } |
42 | 42 | |
43 | - if (! isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) { |
|
43 | + if (!isset($this->options[RelationConfig::THROUGH_FOREIGN_COLUMN])) { |
|
44 | 44 | $prefix = Inflector::singularize($this->foreignMapper->getTableAlias(true)); |
45 | 45 | |
46 | 46 | $this->options[RelationConfig::THROUGH_FOREIGN_COLUMN] = $this->getKeyColumn($prefix, $foreignKey); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $throughAlias = $this->getOption(RelationConfig::THROUGH_TABLE_ALIAS); |
101 | 101 | $throughName = $throughAlias ?? $through; |
102 | 102 | |
103 | - if (! empty($throughColumns)) { |
|
103 | + if (!empty($throughColumns)) { |
|
104 | 104 | $prefix = $this->getOption(RelationConfig::THROUGH_COLUMNS_PREFIX); |
105 | 105 | foreach ($throughColumns as $col) { |
106 | 106 | $query->columns("{$throughName}.{$col} AS {$prefix}{$col}"); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $remainingRelations = $this->getRemainingRelations($action->getOption('relations')); |
187 | 187 | |
188 | 188 | // no cascade delete? treat as save so we can process the changes |
189 | - if (! $this->isCascade()) { |
|
189 | + if (!$this->isCascade()) { |
|
190 | 190 | $this->addActionOnSave($action); |
191 | 191 | } else { |
192 | 192 | // retrieve them again from the DB since the related collection might not have everything |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | /** @var Collection $foreignEntities */ |
210 | 210 | $foreignEntities = $this->nativeMapper->getEntityAttribute($action->getEntity(), $this->name); |
211 | - if (! $foreignEntities) { |
|
211 | + if (!$foreignEntities) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | // save the entities still in the collection |
218 | 218 | foreach ($foreignEntities as $foreignEntity) { |
219 | - if (! empty($foreignEntity->getChanges())) { |
|
219 | + if (!empty($foreignEntity->getChanges())) { |
|
220 | 220 | $saveAction = $this->foreignMapper |
221 | 221 | ->newSaveAction($foreignEntity, [ |
222 | 222 | 'relations' => $remainingRelations |