@@ -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 = []) |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | } |
718 | 718 | |
719 | 719 | // build query |
720 | - $query = 'SELECT %1$s `%3$s`.*'; |
|
720 | + $query = 'SELECT %1$s `%3$s`.*'; |
|
721 | 721 | |
722 | 722 | if (!empty($options['extraColumns'])) { |
723 | 723 | if (is_array($options['extraColumns'])) { |
@@ -725,14 +725,14 @@ discard block |
||
725 | 725 | $query .= ', '.$value.' AS '.$key; |
726 | 726 | } |
727 | 727 | } else { |
728 | - $query .= ', ' . $options['extraColumns']; |
|
728 | + $query .= ', '.$options['extraColumns']; |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | $query .= ' FROM `%2$s` AS `%3$s` %4$s'; |
732 | 732 | $query .= ' WHERE (%5$s)'; |
733 | 733 | |
734 | 734 | if (!empty($options['having'])) { |
735 | - $query .= ' HAVING (' . (is_array($options['having']) ? join(') AND (', static::_mapConditions($options['having'])) : $options['having']) . ')'; |
|
735 | + $query .= ' HAVING ('.(is_array($options['having']) ? join(') AND (', static::_mapConditions($options['having'])) : $options['having']).')'; |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | $params = [ |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | |
747 | 747 | |
748 | 748 | if ($options['order']) { |
749 | - $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order'])); |
|
749 | + $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order'])); |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | if ($options['limit']) { |
@@ -754,9 +754,9 @@ discard block |
||
754 | 754 | } |
755 | 755 | |
756 | 756 | if ($options['indexField']) { |
757 | - return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']); |
|
757 | + return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']); |
|
758 | 758 | } else { |
759 | - return DB::allRecords($query, $params, [static::class,'handleError']); |
|
759 | + return DB::allRecords($query, $params, [static::class, 'handleError']); |
|
760 | 760 | } |
761 | 761 | } |
762 | 762 | |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | ]; |
782 | 782 | |
783 | 783 | if ($options['order']) { |
784 | - $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order'])); |
|
784 | + $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order'])); |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | if ($options['limit']) { |
@@ -789,20 +789,20 @@ discard block |
||
789 | 789 | } |
790 | 790 | |
791 | 791 | if ($options['indexField']) { |
792 | - return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']); |
|
792 | + return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']); |
|
793 | 793 | } else { |
794 | - return DB::allRecords($query, $params, [static::class,'handleError']); |
|
794 | + return DB::allRecords($query, $params, [static::class, 'handleError']); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
798 | 798 | public static function getAllByQuery($query, $params = []) |
799 | 799 | { |
800 | - return static::instantiateRecords(DB::allRecords($query, $params, [static::class,'handleError'])); |
|
800 | + return static::instantiateRecords(DB::allRecords($query, $params, [static::class, 'handleError'])); |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | public static function getTableByQuery($keyField, $query, $params = []) |
804 | 804 | { |
805 | - return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class,'handleError'])); |
|
805 | + return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class, 'handleError'])); |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | { |
901 | 901 | static::init(); |
902 | 902 | if (!static::fieldExists($field)) { |
903 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
903 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
904 | 904 | } |
905 | 905 | |
906 | 906 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | case 'boolean': |
1262 | 1262 | { |
1263 | 1263 | if (!isset($this->_convertedValues[$field])) { |
1264 | - $this->_convertedValues[$field] = (boolean)$value; |
|
1264 | + $this->_convertedValues[$field] = (boolean) $value; |
|
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | return $this->_convertedValues[$field]; |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | |
1301 | 1301 | protected function _setBooleanValue($value) |
1302 | 1302 | { |
1303 | - return (boolean)$value; |
|
1303 | + return (boolean) $value; |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | protected function _setDecimalValue($value) |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | foreach ($order as $key => $value) { |
1541 | 1541 | if (is_string($key)) { |
1542 | 1542 | $columnName = static::_cn($key); |
1543 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
1543 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
1544 | 1544 | } else { |
1545 | 1545 | $columnName = static::_cn($value); |
1546 | 1546 | $direction = 'ASC'; |