@@ -331,14 +331,14 @@ |
||
| 331 | 331 | public function getQuery() |
| 332 | 332 | { |
| 333 | 333 | return 'SELECT ' |
| 334 | - . (!empty($this->modifier) ? implode(' ', $this->modifier) . ' ' : '') |
|
| 335 | - . ($this->columns ? implode(',', $this->columns) : '*') |
|
| 336 | - . ' FROM ' . $this->tableName . ($this->alias ? ' AS ' . $this->alias : '') |
|
| 337 | - . (!empty($this->joins) ? ' ' . implode(' ', $this->joins) : '') |
|
| 338 | - . (!empty($this->where) ? ' WHERE ' . implode(' ', $this->where) : '') |
|
| 339 | - . (!empty($this->groupBy) ? ' GROUP BY ' . implode(',', $this->groupBy) : '') |
|
| 340 | - . (!empty($this->orderBy) ? ' ORDER BY ' . implode(',', $this->orderBy) : '') |
|
| 341 | - . ($this->limit ? ' LIMIT ' . $this->limit . ($this->offset ? ' OFFSET ' . $this->offset : '') : ''); |
|
| 334 | + . (!empty($this->modifier) ? implode(' ', $this->modifier) . ' ' : '') |
|
| 335 | + . ($this->columns ? implode(',', $this->columns) : '*') |
|
| 336 | + . ' FROM ' . $this->tableName . ($this->alias ? ' AS ' . $this->alias : '') |
|
| 337 | + . (!empty($this->joins) ? ' ' . implode(' ', $this->joins) : '') |
|
| 338 | + . (!empty($this->where) ? ' WHERE ' . implode(' ', $this->where) : '') |
|
| 339 | + . (!empty($this->groupBy) ? ' GROUP BY ' . implode(',', $this->groupBy) : '') |
|
| 340 | + . (!empty($this->orderBy) ? ' ORDER BY ' . implode(',', $this->orderBy) : '') |
|
| 341 | + . ($this->limit ? ' LIMIT ' . $this->limit . ($this->offset ? ' OFFSET ' . $this->offset : '') : ''); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** {@inheritdoc} */ |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if (!is_array($args)) { |
| 109 | - $args = [ $args ]; |
|
| 109 | + $args = [$args]; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $parts = explode('?', $expression); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $operator = $operator ?: $this->getDefaultOperator($value); |
| 168 | 168 | $expression = $column . ' ' . $operator; |
| 169 | 169 | |
| 170 | - if (in_array(strtoupper($operator), [ 'IN', 'NOT IN' ]) && is_array($value)) { |
|
| 170 | + if (in_array(strtoupper($operator), ['IN', 'NOT IN']) && is_array($value)) { |
|
| 171 | 171 | $expression .= ' (?' . str_repeat(',?', count($value) - 1) . ')'; |
| 172 | 172 | } else { |
| 173 | 173 | $expression .= ' ?'; |
@@ -234,19 +234,19 @@ discard block |
||
| 234 | 234 | . ($alias ? ' AS ' . $alias : ''); |
| 235 | 235 | |
| 236 | 236 | if (preg_match('/^[A-Za-z_]+$/', $expression)) { |
| 237 | - $join .= ' USING (' . $expression . ')'; |
|
| 237 | + $join .= ' USING (' . $expression . ')'; |
|
| 238 | 238 | $this->joins[] = $join; |
| 239 | 239 | } elseif ($expression) { |
| 240 | 240 | $expression = $this->convertPlaceholders($expression, $args); |
| 241 | 241 | |
| 242 | - $join .= ' ON ' . $expression; |
|
| 242 | + $join .= ' ON ' . $expression; |
|
| 243 | 243 | $this->joins[] = $join; |
| 244 | 244 | } elseif ($empty) { |
| 245 | 245 | $this->joins[] = $join; |
| 246 | 246 | } else { |
| 247 | 247 | return new Parenthesis( |
| 248 | 248 | function (ParenthesisInterface $parenthesis) use ($join) { |
| 249 | - $join .= ' ON ' . $parenthesis->getExpression(); |
|
| 249 | + $join .= ' ON ' . $parenthesis->getExpression(); |
|
| 250 | 250 | $this->joins[] = $join; |
| 251 | 251 | return $this; |
| 252 | 252 | }, |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $statement = 'INSERT INTO ' . $table . ' (' . implode(',', $cols) . ') ' . |
| 143 | - 'VALUES (' . implode('),(', $associations) . ')'; |
|
| 143 | + 'VALUES (' . implode('),(', $associations) . ')'; |
|
| 144 | 144 | $entityManager->getConnection()->query($statement); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $where[] = $entityManager->escapeIdentifier($fkCol) . ' = ' . |
| 165 | - $entityManager->escapeValue($value); |
|
| 165 | + $entityManager->escapeValue($value); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | foreach ($entities as $entity) { |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $condition[] = $entityManager->escapeIdentifier($fkCol) . ' = ' . |
| 182 | - $entityManager->escapeValue($value); |
|
| 182 | + $entityManager->escapeValue($value); |
|
| 183 | 183 | } |
| 184 | 184 | $where[] = implode(' AND ', $condition); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $statement = 'DELETE FROM ' . $table . ' WHERE ' . array_shift($where) . ' ' . |
| 188 | - 'AND (' . implode(' OR ', $where) . ')'; |
|
| 188 | + 'AND (' . implode(' OR ', $where) . ')'; |
|
| 189 | 189 | $entityManager->getConnection()->query($statement); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $table . '.' . $fetcher->getEntityManager()->escapeIdentifier($col); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - call_user_func([ $fetcher, $join ], $table, implode(' AND ', $expression), null, [], true); |
|
| 208 | + call_user_func([$fetcher, $join], $table, implode(' AND ', $expression), null, [], true); |
|
| 209 | 209 | |
| 210 | 210 | $expression = []; |
| 211 | 211 | foreach ($this->getOpponent()->getReference() as $hisVar => $col) { |
@@ -213,6 +213,6 @@ discard block |
||
| 213 | 213 | ' = ' . $this->name . '.' . $hisVar; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - call_user_func([ $fetcher, $join ], $this->class, implode(' AND ', $expression), $this->name, [], true); |
|
| 216 | + call_user_func([$fetcher, $join], $this->class, implode(' AND ', $expression), $this->name, [], true); |
|
| 217 | 217 | } |
| 218 | 218 | } |
@@ -18,12 +18,12 @@ |
||
| 18 | 18 | public function validate($value) |
| 19 | 19 | { |
| 20 | 20 | if (!is_string($value)) { |
| 21 | - return new NoString([ 'type' => 'set' ]); |
|
| 21 | + return new NoString(['type' => 'set']); |
|
| 22 | 22 | } else { |
| 23 | 23 | $values = explode(',', $value); |
| 24 | 24 | foreach ($values as $value) { |
| 25 | 25 | if (!in_array($value, $this->allowedValues)) { |
| 26 | - return new NotAllowed([ 'value' => $value, 'type' => 'set' ]); |
|
| 26 | + return new NotAllowed(['value' => $value, 'type' => 'set']); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | public function validate($value) |
| 42 | 42 | { |
| 43 | 43 | if (!is_string($value)) { |
| 44 | - return new NoString([ 'type' => 'enum' ]); |
|
| 44 | + return new NoString(['type' => 'enum']); |
|
| 45 | 45 | } elseif (!in_array($value, $this->allowedValues)) { |
| 46 | - return new NotAllowed([ 'value' => $value, 'type' => 'enum' ]); |
|
| 46 | + return new NotAllowed(['value' => $value, 'type' => 'enum']); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return true; |
@@ -575,7 +575,7 @@ |
||
| 575 | 575 | if (!empty($attribute)) { |
| 576 | 576 | $col = static::getColumnName($attribute); |
| 577 | 577 | return (isset($this->data[$col]) ? $this->data[$col] : null) !== |
| 578 | - (isset($this->originalData[$col]) ? $this->originalData[$col] : null); |
|
| 578 | + (isset($this->originalData[$col]) ? $this->originalData[$col] : null); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | ksort($this->data); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public static function getPrimaryKeyVars() |
| 191 | 191 | { |
| 192 | - return !is_array(static::$primaryKey) ? [ static::$primaryKey ] : static::$primaryKey; |
|
| 192 | + return !is_array(static::$primaryKey) ? [static::$primaryKey] : static::$primaryKey; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $em = EM::getInstance(static::class); |
| 256 | 256 | $getter = $em->getNamer()->getMethodName('get' . ucfirst($attribute), self::$namingSchemeMethods); |
| 257 | 257 | |
| 258 | - if (method_exists($this, $getter) && is_callable([ $this, $getter ])) { |
|
| 258 | + if (method_exists($this, $getter) && is_callable([$this, $getter])) { |
|
| 259 | 259 | return $this->$getter(); |
| 260 | 260 | } else { |
| 261 | 261 | $col = static::getColumnName($attribute); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $em = EM::getInstance(static::class); |
| 281 | 281 | $getter = $em->getNamer()->getMethodName('get' . ucfirst($attribute), self::$namingSchemeMethods); |
| 282 | 282 | |
| 283 | - if (method_exists($this, $getter) && is_callable([ $this, $getter ])) { |
|
| 283 | + if (method_exists($this, $getter) && is_callable([$this, $getter])) { |
|
| 284 | 284 | return $this->$getter() !== null; |
| 285 | 285 | } else { |
| 286 | 286 | $col = static::getColumnName($attribute); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $em = EM::getInstance(static::class); |
| 330 | 330 | $setter = $em->getNamer()->getMethodName('set' . ucfirst($attribute), self::$namingSchemeMethods); |
| 331 | 331 | |
| 332 | - if (method_exists($this, $setter) && is_callable([ $this, $setter ])) { |
|
| 332 | + if (method_exists($this, $setter) && is_callable([$this, $setter])) { |
|
| 333 | 333 | $oldValue = $this->__get($attribute); |
| 334 | 334 | $md5OldData = md5(serialize($this->data)); |
| 335 | 335 | $this->$setter($value); |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | return $this->getAttribute($attribute); |
| 613 | 613 | }, $attributes); |
| 614 | 614 | |
| 615 | - $result = (array)array_combine($attributes, $values); |
|
| 615 | + $result = (array) array_combine($attributes, $values); |
|
| 616 | 616 | |
| 617 | 617 | if ($includeRelations) { |
| 618 | 618 | foreach ($this->relatedObjects as $relation => $relatedObject) { |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | */ |
| 638 | 638 | public function serialize() |
| 639 | 639 | { |
| 640 | - return serialize([ $this->data, $this->relatedObjects ]); |
|
| 640 | + return serialize([$this->data, $this->relatedObjects]); |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | /** |
@@ -305,7 +305,7 @@ |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | $array = substr($accessor, -1) === '*' ? |
| 308 | - array_slice($array, $from) : [ $array[$from] ]; |
|
| 308 | + array_slice($array, $from) : [$array[$from]]; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | return implode($glue, $array); |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function __construct(Column $column) |
| 21 | 21 | { |
| 22 | - parent::__construct([ 'column' => $column->name ]); |
|
| 22 | + parent::__construct(['column' => $column->name]); |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -24,9 +24,9 @@ |
||
| 24 | 24 | public function validate($value) |
| 25 | 25 | { |
| 26 | 26 | if (!is_string($value)) { |
| 27 | - return new NoString([ 'type' => 'json' ]); |
|
| 27 | + return new NoString(['type' => 'json']); |
|
| 28 | 28 | } elseif ($value !== 'null' && json_decode($value) === null) { |
| 29 | - return new InvalidJson([ 'value' => (string) $value ]); |
|
| 29 | + return new InvalidJson(['value' => (string) $value]); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | return true; |
@@ -48,9 +48,9 @@ |
||
| 48 | 48 | public function validate($value) |
| 49 | 49 | { |
| 50 | 50 | if (!is_string($value)) { |
| 51 | - return new NoString([ 'type' => $this->type ]); |
|
| 51 | + return new NoString(['type' => $this->type]); |
|
| 52 | 52 | } elseif ($this->maxLength !== 0 && mb_strlen($value) > $this->maxLength) { |
| 53 | - return new TooLong([ 'value' => $value, 'max' => $this->maxLength ]); |
|
| 53 | + return new TooLong(['value' => $value, 'max' => $this->maxLength]); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return true; |