@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | static::$tableName, |
| 450 | 450 | join(',', $set), |
| 451 | 451 | ], |
| 452 | - [static::class,'handleError'] |
|
| 452 | + [static::class, 'handleError'] |
|
| 453 | 453 | ); |
| 454 | 454 | |
| 455 | 455 | $this->_record[static::$primaryKey ? static::$primaryKey : 'ID'] = DB::insertID(); |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), |
| 465 | 465 | $this->getPrimaryKeyValue(), |
| 466 | 466 | ], |
| 467 | - [static::class,'handleError'] |
|
| 467 | + [static::class, 'handleError'] |
|
| 468 | 468 | ); |
| 469 | 469 | |
| 470 | 470 | $this->_isUpdated = true; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | static::$tableName, |
| 514 | 514 | static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), |
| 515 | 515 | $id, |
| 516 | - ], [static::class,'handleError']); |
|
| 516 | + ], [static::class, 'handleError']); |
|
| 517 | 517 | |
| 518 | 518 | return DB::affectedRows() > 0; |
| 519 | 519 | } |
@@ -579,9 +579,9 @@ discard block |
||
| 579 | 579 | |
| 580 | 580 | if ($cacheIndex) { |
| 581 | 581 | $key = sprintf('%s/%s:%s', static::$tableName, $field, $value); |
| 582 | - return DB::oneRecordCached($key, $query, $params, [static::class,'handleError']); |
|
| 582 | + return DB::oneRecordCached($key, $query, $params, [static::class, 'handleError']); |
|
| 583 | 583 | } else { |
| 584 | - return DB::oneRecord($query, $params, [static::class,'handleError']); |
|
| 584 | + return DB::oneRecord($query, $params, [static::class, 'handleError']); |
|
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | 587 | |
@@ -615,13 +615,13 @@ discard block |
||
| 615 | 615 | $order ? 'ORDER BY '.join(',', $order) : '', |
| 616 | 616 | ], |
| 617 | 617 | |
| 618 | - [static::class,'handleError'] |
|
| 618 | + [static::class, 'handleError'] |
|
| 619 | 619 | ); |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | public static function getByQuery($query, $params = []) |
| 623 | 623 | { |
| 624 | - return static::instantiateRecord(DB::oneRecord($query, $params, [static::class,'handleError'])); |
|
| 624 | + return static::instantiateRecord(DB::oneRecord($query, $params, [static::class, 'handleError'])); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | public static function getAllByClass($className = false, $options = []) |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | // build query |
| 687 | - $query = 'SELECT %1$s `%3$s`.*'; |
|
| 687 | + $query = 'SELECT %1$s `%3$s`.*'; |
|
| 688 | 688 | |
| 689 | 689 | if (!empty($options['extraColumns'])) { |
| 690 | 690 | if (is_array($options['extraColumns'])) { |
@@ -692,14 +692,14 @@ discard block |
||
| 692 | 692 | $query .= ', '.$value.' AS '.$key; |
| 693 | 693 | } |
| 694 | 694 | } else { |
| 695 | - $query .= ', ' . $options['extraColumns']; |
|
| 695 | + $query .= ', '.$options['extraColumns']; |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | $query .= ' FROM `%2$s` AS `%3$s`'; |
| 699 | 699 | $query .= ' WHERE (%4$s)'; |
| 700 | 700 | |
| 701 | 701 | if (!empty($options['having'])) { |
| 702 | - $query .= ' HAVING (' . (is_array($options['having']) ? join(') AND (', static::_mapConditions($options['having'])) : $options['having']) . ')'; |
|
| 702 | + $query .= ' HAVING ('.(is_array($options['having']) ? join(') AND (', static::_mapConditions($options['having'])) : $options['having']).')'; |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | $params = [ |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | ]; |
| 711 | 711 | |
| 712 | 712 | if ($options['order']) { |
| 713 | - $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order'])); |
|
| 713 | + $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order'])); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | if ($options['limit']) { |
@@ -718,9 +718,9 @@ discard block |
||
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | if ($options['indexField']) { |
| 721 | - return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']); |
|
| 721 | + return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']); |
|
| 722 | 722 | } else { |
| 723 | - return DB::allRecords($query, $params, [static::class,'handleError']); |
|
| 723 | + return DB::allRecords($query, $params, [static::class, 'handleError']); |
|
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | 726 | |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | ]; |
| 746 | 746 | |
| 747 | 747 | if ($options['order']) { |
| 748 | - $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order'])); |
|
| 748 | + $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order'])); |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | if ($options['limit']) { |
@@ -753,20 +753,20 @@ discard block |
||
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | if ($options['indexField']) { |
| 756 | - return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']); |
|
| 756 | + return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']); |
|
| 757 | 757 | } else { |
| 758 | - return DB::allRecords($query, $params, [static::class,'handleError']); |
|
| 758 | + return DB::allRecords($query, $params, [static::class, 'handleError']); |
|
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | public static function getAllByQuery($query, $params = []) |
| 763 | 763 | { |
| 764 | - return static::instantiateRecords(DB::allRecords($query, $params, [static::class,'handleError'])); |
|
| 764 | + return static::instantiateRecords(DB::allRecords($query, $params, [static::class, 'handleError'])); |
|
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | public static function getTableByQuery($keyField, $query, $params = []) |
| 768 | 768 | { |
| 769 | - return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class,'handleError'])); |
|
| 769 | + return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class, 'handleError'])); |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | { |
| 865 | 865 | static::init(); |
| 866 | 866 | if (!static::fieldExists($field)) { |
| 867 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
| 867 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | case 'boolean': |
| 1226 | 1226 | { |
| 1227 | 1227 | if (!isset($this->_convertedValues[$field])) { |
| 1228 | - $this->_convertedValues[$field] = (boolean)$value; |
|
| 1228 | + $this->_convertedValues[$field] = (boolean) $value; |
|
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | return $this->_convertedValues[$field]; |
@@ -1264,7 +1264,7 @@ discard block |
||
| 1264 | 1264 | |
| 1265 | 1265 | protected function _setBooleanValue($value) |
| 1266 | 1266 | { |
| 1267 | - return (boolean)$value; |
|
| 1267 | + return (boolean) $value; |
|
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | protected function _setDecimalValue($value) |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | foreach ($order as $key => $value) { |
| 1505 | 1505 | if (is_string($key)) { |
| 1506 | 1506 | $columnName = static::_cn($key); |
| 1507 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
| 1507 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
| 1508 | 1508 | } else { |
| 1509 | 1509 | $columnName = static::_cn($value); |
| 1510 | 1510 | $direction = 'ASC'; |