@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | static::$tableName, |
439 | 439 | join(',', $set), |
440 | 440 | ], |
441 | - [static::class,'handleError'] |
|
441 | + [static::class, 'handleError'] |
|
442 | 442 | ); |
443 | 443 | |
444 | 444 | $this->_record[static::$primaryKey ? static::$primaryKey : 'ID'] = DB::insertID(); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), |
454 | 454 | $this->getPrimaryKeyValue(), |
455 | 455 | ], |
456 | - [static::class,'handleError'] |
|
456 | + [static::class, 'handleError'] |
|
457 | 457 | ); |
458 | 458 | |
459 | 459 | $this->_isUpdated = true; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | static::$tableName, |
522 | 522 | static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), |
523 | 523 | $id, |
524 | - ], [static::class,'handleError']); |
|
524 | + ], [static::class, 'handleError']); |
|
525 | 525 | |
526 | 526 | return DB::affectedRows() > 0; |
527 | 527 | } |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | |
588 | 588 | if ($cacheIndex) { |
589 | 589 | $key = sprintf('%s/%s:%s', static::$tableName, $field, $value); |
590 | - return DB::oneRecordCached($key, $query, $params, [static::class,'handleError']); |
|
590 | + return DB::oneRecordCached($key, $query, $params, [static::class, 'handleError']); |
|
591 | 591 | } else { |
592 | - return DB::oneRecord($query, $params, [static::class,'handleError']); |
|
592 | + return DB::oneRecord($query, $params, [static::class, 'handleError']); |
|
593 | 593 | } |
594 | 594 | } |
595 | 595 | |
@@ -623,13 +623,13 @@ discard block |
||
623 | 623 | $order ? 'ORDER BY '.join(',', $order) : '', |
624 | 624 | ], |
625 | 625 | |
626 | - [static::class,'handleError'] |
|
626 | + [static::class, 'handleError'] |
|
627 | 627 | ); |
628 | 628 | } |
629 | 629 | |
630 | 630 | public static function getByQuery($query, $params = []) |
631 | 631 | { |
632 | - return static::instantiateRecord(DB::oneRecord($query, $params, [static::class,'handleError'])); |
|
632 | + return static::instantiateRecord(DB::oneRecord($query, $params, [static::class, 'handleError'])); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | public static function getAllByClass($className = false, $options = []) |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | } |
725 | 725 | |
726 | 726 | // build query |
727 | - $query = 'SELECT %1$s `%3$s`.*'; |
|
727 | + $query = 'SELECT %1$s `%3$s`.*'; |
|
728 | 728 | |
729 | 729 | if (!empty($options['extraColumns'])) { |
730 | 730 | if (is_array($options['extraColumns'])) { |
@@ -732,14 +732,14 @@ discard block |
||
732 | 732 | $query .= ', '.$value.' AS '.$key; |
733 | 733 | } |
734 | 734 | } else { |
735 | - $query .= ', ' . $options['extraColumns']; |
|
735 | + $query .= ', '.$options['extraColumns']; |
|
736 | 736 | } |
737 | 737 | } |
738 | 738 | $query .= ' FROM `%2$s` AS `%3$s` %4$s'; |
739 | 739 | $query .= ' WHERE (%5$s)'; |
740 | 740 | |
741 | 741 | if (!empty($options['having'])) { |
742 | - $query .= ' HAVING (' . (is_array($options['having']) ? join(') AND (', static::_mapConditions($options['having'])) : $options['having']) . ')'; |
|
742 | + $query .= ' HAVING ('.(is_array($options['having']) ? join(') AND (', static::_mapConditions($options['having'])) : $options['having']).')'; |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | $params = [ |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | |
754 | 754 | |
755 | 755 | if ($options['order']) { |
756 | - $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order'])); |
|
756 | + $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order'])); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | if ($options['limit']) { |
@@ -761,9 +761,9 @@ discard block |
||
761 | 761 | } |
762 | 762 | |
763 | 763 | if ($options['indexField']) { |
764 | - return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']); |
|
764 | + return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']); |
|
765 | 765 | } else { |
766 | - return DB::allRecords($query, $params, [static::class,'handleError']); |
|
766 | + return DB::allRecords($query, $params, [static::class, 'handleError']); |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | ]; |
789 | 789 | |
790 | 790 | if ($options['order']) { |
791 | - $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order'])); |
|
791 | + $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order'])); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | if ($options['limit']) { |
@@ -796,20 +796,20 @@ discard block |
||
796 | 796 | } |
797 | 797 | |
798 | 798 | if ($options['indexField']) { |
799 | - return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']); |
|
799 | + return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']); |
|
800 | 800 | } else { |
801 | - return DB::allRecords($query, $params, [static::class,'handleError']); |
|
801 | + return DB::allRecords($query, $params, [static::class, 'handleError']); |
|
802 | 802 | } |
803 | 803 | } |
804 | 804 | |
805 | 805 | public static function getAllByQuery($query, $params = []) |
806 | 806 | { |
807 | - return static::instantiateRecords(DB::allRecords($query, $params, [static::class,'handleError'])); |
|
807 | + return static::instantiateRecords(DB::allRecords($query, $params, [static::class, 'handleError'])); |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | public static function getTableByQuery($keyField, $query, $params = []) |
811 | 811 | { |
812 | - return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class,'handleError'])); |
|
812 | + return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class, 'handleError'])); |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | { |
913 | 913 | static::init(); |
914 | 914 | if (!static::fieldExists($field)) { |
915 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
915 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | case 'boolean': |
1244 | 1244 | { |
1245 | 1245 | if (!isset($this->_convertedValues[$field])) { |
1246 | - $this->_convertedValues[$field] = (boolean)$value; |
|
1246 | + $this->_convertedValues[$field] = (boolean) $value; |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | return $this->_convertedValues[$field]; |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | |
1325 | 1325 | case 'boolean': |
1326 | 1326 | { |
1327 | - $value = (boolean)$value; |
|
1327 | + $value = (boolean) $value; |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | case 'decimal': |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | foreach ($order as $key => $value) { |
1520 | 1520 | if (is_string($key)) { |
1521 | 1521 | $columnName = static::_cn($key); |
1522 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
1522 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
1523 | 1523 | } else { |
1524 | 1524 | $columnName = static::_cn($value); |
1525 | 1525 | $direction = 'ASC'; |
@@ -2,6 +2,6 @@ |
||
2 | 2 | use \Divergence\App as App; |
3 | 3 | |
4 | 4 | return [ |
5 | - 'debug' => file_exists(App::$ApplicationPath . '/.debug'), |
|
6 | - 'environment' => (file_exists(App::$ApplicationPath . '/.dev') ? 'dev' : 'production'), |
|
5 | + 'debug' => file_exists(App::$ApplicationPath.'/.debug'), |
|
6 | + 'environment' => (file_exists(App::$ApplicationPath.'/.dev') ? 'dev' : 'production'), |
|
7 | 7 | ]; |