| @@ -165,7 +165,7 @@ discard block | ||
| 165 | 165 | return DB::oneRecord( | 
| 166 | 166 |              (new Select())->setTable(static::$tableName)->where(join(') AND (', $conditions))->order($order ? join(',', $order) : '')->limit('1'), | 
| 167 | 167 | null, | 
| 168 | - [static::class,'handleError'] | |
| 168 | + [static::class, 'handleError'] | |
| 169 | 169 | ); | 
| 170 | 170 | } | 
| 171 | 171 | |
| @@ -178,7 +178,7 @@ discard block | ||
| 178 | 178 | */ | 
| 179 | 179 | public static function getByQuery($query, $params = []) | 
| 180 | 180 |      { | 
| 181 | - return static::instantiateRecord(DB::oneRecord($query, $params, [static::class,'handleError'])); | |
| 181 | + return static::instantiateRecord(DB::oneRecord($query, $params, [static::class, 'handleError'])); | |
| 182 | 182 | } | 
| 183 | 183 | |
| 184 | 184 | /** | 
| @@ -284,9 +284,9 @@ discard block | ||
| 284 | 284 |              $select->limit(sprintf('%u,%u', $options['offset'], $options['limit'])); | 
| 285 | 285 | } | 
| 286 | 286 |          if ($options['indexField']) { | 
| 287 | - return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class,'handleError']); | |
| 287 | + return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class, 'handleError']); | |
| 288 | 288 |          } else { | 
| 289 | - return DB::allRecords($select, null, [static::class,'handleError']); | |
| 289 | + return DB::allRecords($select, null, [static::class, 'handleError']); | |
| 290 | 290 | } | 
| 291 | 291 | } | 
| 292 | 292 | |
| @@ -299,12 +299,12 @@ discard block | ||
| 299 | 299 | */ | 
| 300 | 300 | public static function getAllByQuery($query, $params = []) | 
| 301 | 301 |      { | 
| 302 | - return static::instantiateRecords(DB::allRecords($query, $params, [static::class,'handleError'])); | |
| 302 | + return static::instantiateRecords(DB::allRecords($query, $params, [static::class, 'handleError'])); | |
| 303 | 303 | } | 
| 304 | 304 | |
| 305 | 305 | public static function getTableByQuery($keyField, $query, $params = []) | 
| 306 | 306 |      { | 
| 307 | - return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class,'handleError'])); | |
| 307 | + return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class, 'handleError'])); | |
| 308 | 308 | } | 
| 309 | 309 | |
| 310 | 310 | /** | 
| @@ -362,9 +362,9 @@ discard block | ||
| 362 | 362 | } | 
| 363 | 363 | |
| 364 | 364 |          if ($options['indexField']) { | 
| 365 | - return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class,'handleError']); | |
| 365 | + return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class, 'handleError']); | |
| 366 | 366 |          } else { | 
| 367 | - return DB::allRecords($select, null, [static::class,'handleError']); | |
| 367 | + return DB::allRecords($select, null, [static::class, 'handleError']); | |
| 368 | 368 | } | 
| 369 | 369 | } | 
| 370 | 370 | |
| @@ -434,7 +434,7 @@ discard block | ||
| 434 | 434 | return ', '.$value.' AS '.$key; | 
| 435 | 435 | } | 
| 436 | 436 |              } else { | 
| 437 | - return ', ' . $columns; | |
| 437 | + return ', '.$columns; | |
| 438 | 438 | } | 
| 439 | 439 | } | 
| 440 | 440 | } | 
| @@ -448,7 +448,7 @@ discard block | ||
| 448 | 448 | public static function buildHaving($having) | 
| 449 | 449 |      { | 
| 450 | 450 |          if (!empty($having)) { | 
| 451 | -            return ' (' . (is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having) . ')'; | |
| 451 | +            return ' ('.(is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having).')'; | |
| 452 | 452 | } | 
| 453 | 453 | } | 
| 454 | 454 | } | 
| @@ -722,14 +722,14 @@ discard block | ||
| 722 | 722 | |
| 723 | 723 | // create new or update existing | 
| 724 | 724 |              if ($this->_isPhantom) { | 
| 725 | - DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class,'handleError']); | |
| 725 | + DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class, 'handleError']); | |
| 726 | 726 | $this->_record[$this->getPrimaryKey()] = DB::insertID(); | 
| 727 | 727 | $this->_isPhantom = false; | 
| 728 | 728 | $this->_isNew = true; | 
| 729 | 729 |              } elseif (count($set)) { | 
| 730 | 730 | DB::nonQuery((new Update())->setTable(static::$tableName)->set($set)->where( | 
| 731 | 731 |                      sprintf('`%s` = %u', static::_cn($this->getPrimaryKey()), $this->getPrimaryKeyValue()) | 
| 732 | - ), null, [static::class,'handleError']); | |
| 732 | + ), null, [static::class, 'handleError']); | |
| 733 | 733 | |
| 734 | 734 | $this->_isUpdated = true; | 
| 735 | 735 | } | 
| @@ -761,7 +761,7 @@ discard block | ||
| 761 | 761 | $recordValues = $this->_prepareRecordValues(); | 
| 762 | 762 | $set = static::_mapValuesToSet($recordValues); | 
| 763 | 763 | |
| 764 | - DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class,'handleError']); | |
| 764 | + DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class, 'handleError']); | |
| 765 | 765 | } | 
| 766 | 766 | } | 
| 767 | 767 | |
| @@ -776,7 +776,7 @@ discard block | ||
| 776 | 776 | */ | 
| 777 | 777 | public static function delete($id) | 
| 778 | 778 |      { | 
| 779 | -        DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class,'handleError']); | |
| 779 | +        DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class, 'handleError']); | |
| 780 | 780 | |
| 781 | 781 | return DB::affectedRows() > 0; | 
| 782 | 782 | } | 
| @@ -829,7 +829,7 @@ discard block | ||
| 829 | 829 |      { | 
| 830 | 830 | static::init(); | 
| 831 | 831 |          if (!static::fieldExists($field)) { | 
| 832 | -            throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); | |
| 832 | +            throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); | |
| 833 | 833 | } | 
| 834 | 834 | |
| 835 | 835 | return static::$_classFields[get_called_class()][$field]['columnName']; | 
| @@ -1234,7 +1234,7 @@ discard block | ||
| 1234 | 1234 | case 'boolean': | 
| 1235 | 1235 |                  { | 
| 1236 | 1236 |                      if (!isset($this->_convertedValues[$field])) { | 
| 1237 | - $this->_convertedValues[$field] = (boolean)$value; | |
| 1237 | + $this->_convertedValues[$field] = (boolean) $value; | |
| 1238 | 1238 | } | 
| 1239 | 1239 | |
| 1240 | 1240 | return $this->_convertedValues[$field]; | 
| @@ -1462,7 +1462,7 @@ discard block | ||
| 1462 | 1462 |              foreach ($order as $key => $value) { | 
| 1463 | 1463 |                  if (is_string($key)) { | 
| 1464 | 1464 | $columnName = static::_cn($key); | 
| 1465 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; | |
| 1465 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; | |
| 1466 | 1466 |                  } else { | 
| 1467 | 1467 | $columnName = static::_cn($value); | 
| 1468 | 1468 | $direction = 'ASC'; | 
| @@ -153,7 +153,7 @@ | ||
| 153 | 153 | // save a copy to history table | 
| 154 | 154 | $recordValues = $this->_prepareRecordValues(); | 
| 155 | 155 | $set = static::_mapValuesToSet($recordValues); | 
| 156 | - DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class,'handleError']); | |
| 156 | + DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class, 'handleError']); | |
| 157 | 157 | } | 
| 158 | 158 | } | 
| 159 | 159 | } | 
| @@ -51,7 +51,7 @@ | ||
| 51 | 51 | |
| 52 | 52 | public function __toString(): string | 
| 53 | 53 |      { | 
| 54 | - $expression = ($this->calcFoundRows ? 'SQL_CALC_FOUND_ROWS ' : '') . $this->expression; | |
| 54 | + $expression = ($this->calcFoundRows ? 'SQL_CALC_FOUND_ROWS ' : '').$this->expression; | |
| 55 | 55 | |
| 56 | 56 |          if (isset($this->tableAlias)) { | 
| 57 | 57 |              $from = sprintf('`%s` AS `%s`', $this->table, $this->tableAlias); |