Completed
Push — master ( c556e7...28f445 )
by Henry
02:33
created
src/Models/ActiveRecord.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
                         static::$tableName,
723 723
                         join(',', $set),
724 724
                     ],
725
-                    [static::class,'handleError']
725
+                    [static::class, 'handleError']
726 726
                 );
727 727
 
728 728
                 $this->_record[static::$primaryKey ? static::$primaryKey : 'ID'] = DB::insertID();
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
                         static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'),
738 738
                         $this->getPrimaryKeyValue(),
739 739
                     ],
740
-                    [static::class,'handleError']
740
+                    [static::class, 'handleError']
741 741
                 );
742 742
 
743 743
                 $this->_isUpdated = true;
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
             static::$tableName,
798 798
             static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'),
799 799
             $id,
800
-        ], [static::class,'handleError']);
800
+        ], [static::class, 'handleError']);
801 801
 
802 802
         return DB::affectedRows() > 0;
803 803
     }
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
 
886 886
         if ($cacheIndex) {
887 887
             $key = sprintf('%s/%s:%s', static::$tableName, $field, $value);
888
-            return DB::oneRecordCached($key, $query, $params, [static::class,'handleError']);
888
+            return DB::oneRecordCached($key, $query, $params, [static::class, 'handleError']);
889 889
         } else {
890
-            return DB::oneRecord($query, $params, [static::class,'handleError']);
890
+            return DB::oneRecord($query, $params, [static::class, 'handleError']);
891 891
         }
892 892
     }
893 893
 
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                 $order ? 'ORDER BY '.join(',', $order) : '',
936 936
             ],
937 937
 
938
-            [static::class,'handleError']
938
+            [static::class, 'handleError']
939 939
         );
940 940
     }
941 941
 
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
      */
949 949
     public static function getByQuery($query, $params = [])
950 950
     {
951
-        return static::instantiateRecord(DB::oneRecord($query, $params, [static::class,'handleError']));
951
+        return static::instantiateRecord(DB::oneRecord($query, $params, [static::class, 'handleError']));
952 952
     }
953 953
 
954 954
     /**
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
                     return ', '.$value.' AS '.$key;
1032 1032
                 }
1033 1033
             } else {
1034
-                return ', ' . $columns;
1034
+                return ', '.$columns;
1035 1035
             }
1036 1036
         }
1037 1037
     }
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
     public static function buildHaving($having)
1046 1046
     {
1047 1047
         if (!empty($having)) {
1048
-            return ' HAVING (' . (is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having) . ')';
1048
+            return ' HAVING ('.(is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having).')';
1049 1049
         }
1050 1050
     }
1051 1051
 
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
         ];
1096 1096
 
1097 1097
         if ($options['order']) {
1098
-            $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order']));
1098
+            $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order']));
1099 1099
         }
1100 1100
 
1101 1101
         if ($options['limit']) {
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
         }
1104 1104
 
1105 1105
         if ($options['indexField']) {
1106
-            return DB::table(static::_cn($options['indexField']), $query, $params, null, [static::class,'handleError']);
1106
+            return DB::table(static::_cn($options['indexField']), $query, $params, null, [static::class, 'handleError']);
1107 1107
         } else {
1108
-            return DB::allRecords($query, $params, [static::class,'handleError']);
1108
+            return DB::allRecords($query, $params, [static::class, 'handleError']);
1109 1109
         }
1110 1110
     }
1111 1111
 
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
         ];
1143 1143
 
1144 1144
         if ($options['order']) {
1145
-            $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order']));
1145
+            $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order']));
1146 1146
         }
1147 1147
 
1148 1148
         if ($options['limit']) {
@@ -1150,9 +1150,9 @@  discard block
 block discarded – undo
1150 1150
         }
1151 1151
 
1152 1152
         if ($options['indexField']) {
1153
-            return DB::table(static::_cn($options['indexField']), $query, $params, null, [static::class,'handleError']);
1153
+            return DB::table(static::_cn($options['indexField']), $query, $params, null, [static::class, 'handleError']);
1154 1154
         } else {
1155
-            return DB::allRecords($query, $params, [static::class,'handleError']);
1155
+            return DB::allRecords($query, $params, [static::class, 'handleError']);
1156 1156
         }
1157 1157
     }
1158 1158
 
@@ -1165,12 +1165,12 @@  discard block
 block discarded – undo
1165 1165
      */
1166 1166
     public static function getAllByQuery($query, $params = [])
1167 1167
     {
1168
-        return static::instantiateRecords(DB::allRecords($query, $params, [static::class,'handleError']));
1168
+        return static::instantiateRecords(DB::allRecords($query, $params, [static::class, 'handleError']));
1169 1169
     }
1170 1170
 
1171 1171
     public static function getTableByQuery($keyField, $query, $params = [])
1172 1172
     {
1173
-        return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class,'handleError']));
1173
+        return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class, 'handleError']));
1174 1174
     }
1175 1175
 
1176 1176
 
@@ -1303,7 +1303,7 @@  discard block
 block discarded – undo
1303 1303
     {
1304 1304
         static::init();
1305 1305
         if (!static::fieldExists($field)) {
1306
-            throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field);
1306
+            throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field);
1307 1307
         }
1308 1308
 
1309 1309
         return static::$_classFields[get_called_class()][$field]['columnName'];
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 
1407 1407
         if ($deep) {
1408 1408
             // validate relationship objects
1409
-            if(!empty(static::$_classRelationships[get_called_class()])) {
1409
+            if (!empty(static::$_classRelationships[get_called_class()])) {
1410 1410
                 foreach (static::$_classRelationships[get_called_class()] as $relationship => $options) {
1411 1411
                     if (empty($this->_relatedObjects[$relationship])) {
1412 1412
                         continue;
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
                 case 'boolean':
1739 1739
                 {
1740 1740
                     if (!isset($this->_convertedValues[$field])) {
1741
-                        $this->_convertedValues[$field] = (boolean)$value;
1741
+                        $this->_convertedValues[$field] = (boolean) $value;
1742 1742
                     }
1743 1743
 
1744 1744
                     return $this->_convertedValues[$field];
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
 
1778 1778
     protected function _setBooleanValue($value)
1779 1779
     {
1780
-        return (boolean)$value;
1780
+        return (boolean) $value;
1781 1781
     }
1782 1782
 
1783 1783
     protected function _setDecimalValue($value)
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
             foreach ($order as $key => $value) {
2018 2018
                 if (is_string($key)) {
2019 2019
                     $columnName = static::_cn($key);
2020
-                    $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC';
2020
+                    $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC';
2021 2021
                 } else {
2022 2022
                     $columnName = static::_cn($value);
2023 2023
                     $direction = 'ASC';
@@ -2034,7 +2034,7 @@  discard block
 block discarded – undo
2034 2034
     {
2035 2035
         foreach ($conditions as $field => &$condition) {
2036 2036
             if (is_string($field)) {
2037
-                if(isset(static::$_classFields[get_called_class()][$field])) {
2037
+                if (isset(static::$_classFields[get_called_class()][$field])) {
2038 2038
                     $fieldOptions = static::$_classFields[get_called_class()][$field];
2039 2039
                 }
2040 2040
 
Please login to merge, or discard this patch.