@@ -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); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public static function getPrimaryKeyVars() |
| 174 | 174 | { |
| 175 | - return !is_array(static::$primaryKey) ? [ static::$primaryKey ] : static::$primaryKey; |
|
| 175 | + return !is_array(static::$primaryKey) ? [static::$primaryKey] : static::$primaryKey; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $em = EM::getInstance(static::class); |
| 317 | 317 | $getter = $em->getNamer()->getMethodName('get' . ucfirst($attribute), self::$namingSchemeMethods); |
| 318 | 318 | |
| 319 | - if (method_exists($this, $getter) && is_callable([ $this, $getter ])) { |
|
| 319 | + if (method_exists($this, $getter) && is_callable([$this, $getter])) { |
|
| 320 | 320 | return $this->$getter(); |
| 321 | 321 | } else { |
| 322 | 322 | $col = static::getColumnName($attribute); |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $em = EM::getInstance(static::class); |
| 342 | 342 | $getter = $em->getNamer()->getMethodName('get' . ucfirst($attribute), self::$namingSchemeMethods); |
| 343 | 343 | |
| 344 | - if (method_exists($this, $getter) && is_callable([ $this, $getter ])) { |
|
| 344 | + if (method_exists($this, $getter) && is_callable([$this, $getter])) { |
|
| 345 | 345 | return $this->$getter() !== null; |
| 346 | 346 | } else { |
| 347 | 347 | $col = static::getColumnName($attribute); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $em = EM::getInstance(static::class); |
| 379 | 379 | $setter = $em->getNamer()->getMethodName('set' . ucfirst($attribute), self::$namingSchemeMethods); |
| 380 | 380 | |
| 381 | - if (method_exists($this, $setter) && is_callable([ $this, $setter ])) { |
|
| 381 | + if (method_exists($this, $setter) && is_callable([$this, $setter])) { |
|
| 382 | 382 | $oldValue = $this->__get($attribute); |
| 383 | 383 | $md5OldData = md5(serialize($this->data)); |
| 384 | 384 | $this->$setter($value); |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | */ |
| 795 | 795 | public function serialize() |
| 796 | 796 | { |
| 797 | - return serialize([ $this->data, $this->relatedObjects ]); |
|
| 797 | + return serialize([$this->data, $this->relatedObjects]); |
|
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | /** |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $this->tableName = $entityManager->escapeIdentifier($class::getTableName()); |
| 65 | 65 | $this->alias = 't0'; |
| 66 | - $this->columns = [ 't0.*' ]; |
|
| 67 | - $this->modifier = [ 'DISTINCT' ]; |
|
| 66 | + $this->columns = ['t0.*']; |
|
| 67 | + $this->modifier = ['DISTINCT']; |
|
| 68 | 68 | |
| 69 | 69 | $this->classMapping['byClass'][$class] = 't0'; |
| 70 | 70 | $this->classMapping['byAlias']['t0'] = $class; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $alias = $this->alias; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - call_user_func([ $class, 'getRelation' ], $relation)->addJoin($this, $join, $alias); |
|
| 194 | + call_user_func([$class, 'getRelation'], $relation)->addJoin($this, $join, $alias); |
|
| 195 | 195 | return $this; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | public function count() |
| 290 | 290 | { |
| 291 | 291 | // set the columns and reset after get query |
| 292 | - $this->columns = [ 'COUNT(DISTINCT t0.*)' ]; |
|
| 292 | + $this->columns = ['COUNT(DISTINCT t0.*)']; |
|
| 293 | 293 | $this->modifier = []; |
| 294 | 294 | $query = $this->getQuery(); |
| 295 | - $this->columns = [ 't0.*' ]; |
|
| 296 | - $this->modifier = [ 'DISTINCT' ]; |
|
| 295 | + $this->columns = ['t0.*']; |
|
| 296 | + $this->modifier = ['DISTINCT']; |
|
| 297 | 297 | |
| 298 | 298 | return (int) $this->entityManager->getConnection()->query($query)->fetchColumn(); |
| 299 | 299 | } |
@@ -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; |