Passed
Push — master ( 6dc854...55eca8 )
by Henry
01:59
created
config/app.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
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
 ];
Please login to merge, or discard this patch.
src/IO/Database/MySQL.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     protected static $LastStatement;
23 23
     protected static $Config;
24 24
     
25
-    public static function getConnection($label=null)
25
+    public static function getConnection($label = null)
26 26
     {
27 27
         if (!$label) {
28 28
             $label = static::getDefaultLabel();
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
             
39 39
             if ($config['socket']) {
40 40
                 // socket connection
41
-                $DSN = 'mysql:unix_socket=' . $config['socket'] . ';dbname=' . $config['database'];
41
+                $DSN = 'mysql:unix_socket='.$config['socket'].';dbname='.$config['database'];
42 42
             } else {
43 43
                 // tcp connection
44
-                $DSN = 'mysql:host=' . $config['host'] . ';port=' . $config['port'] .';dbname=' . $config['database'];
44
+                $DSN = 'mysql:host='.$config['host'].';port='.$config['port'].';dbname='.$config['database'];
45 45
             }
46 46
             
47 47
             try {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         if (is_string($data)) {
66 66
             $data = static::getConnection()->quote($data);
67
-            $data = substr($data, 1, strlen($data)-2);
67
+            $data = substr($data, 1, strlen($data) - 2);
68 68
             return $data;
69 69
         } elseif (is_array($data)) {
70 70
             foreach ($data as $key=>$string) {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         $error = static::getConnection()->errorInfo();
284 284
         $message = $error[2];
285 285
         
286
-        if (App::$Config['environment']=='dev') {
286
+        if (App::$Config['environment'] == 'dev') {
287 287
             $Handler = \Divergence\App::$whoops->popHandler();
288 288
             
289 289
             $Handler->addDataTable("Query Information", [
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     
318 318
     protected static function startQueryLog($query)
319 319
     {
320
-        if (App::$Config['environment']!='dev') {
320
+        if (App::$Config['environment'] != 'dev') {
321 321
             return false;
322 322
         }
323 323
         
Please login to merge, or discard this patch.
src/Models/RecordValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 
99 99
         // check validator
100 100
         if (!is_callable($validator)) {
101
-            throw new Exception('Validator for field ' . $options['id'] . ' is not callable');
101
+            throw new Exception('Validator for field '.$options['id'].' is not callable');
102 102
         }
103 103
 
104 104
 
Please login to merge, or discard this patch.
src/Models/Relations.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         
69 69
         if ($options['type'] == 'one-one') {
70 70
             if (empty($options['local'])) {
71
-                $options['local'] = $relationship . 'ID';
71
+                $options['local'] = $relationship.'ID';
72 72
             }
73 73
                 
74 74
             if (empty($options['foreign'])) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             }
81 81
                     
82 82
             if (empty($options['foreign'])) {
83
-                $options['foreign'] =  $classShortName. 'ID';
83
+                $options['foreign'] = $classShortName.'ID';
84 84
             }
85 85
                 
86 86
             if (!isset($options['indexField'])) {
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
             }
143 143
                 
144 144
             if (empty($options['linkLocal'])) {
145
-                $options['linkLocal'] = $classShortName . 'ID';
145
+                $options['linkLocal'] = $classShortName.'ID';
146 146
             }
147 147
         
148 148
             if (empty($options['linkForeign'])) {
149 149
                 $foreignShortname = basename(str_replace('\\', '/', $options['class']::$rootClass));
150
-                $options['linkForeign'] =  $foreignShortname . 'ID';
150
+                $options['linkForeign'] = $foreignShortname.'ID';
151 151
             }
152 152
         
153 153
             if (empty($options['local'])) {
Please login to merge, or discard this patch.
src/Models/Versioning.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         ];
67 67
         
68 68
         if ($options['order']) {
69
-            $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order']));
69
+            $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order']));
70 70
         }
71 71
         
72 72
         if ($options['limit']) {
Please login to merge, or discard this patch.
src/Controllers/RequestHandler.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
         }
32 32
     
33 33
         switch ($responseMode ? $responseMode : static::$responseMode) {
34
-            case 'json':
35
-                JSON::translateAndRespond($responseData);
34
+            case 'json' : JSON::translateAndRespond($responseData);
36 35
                 break;
37 36
             case 'jsonp':
38 37
                 JSONP::translateAndRespond($responseData);
Please login to merge, or discard this patch.
src/Helpers/JSONP.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
             throw new \Exception(json_last_error_msg());
12 12
         }
13 13
         header('Content-type: application/javascript; charset=utf-8', true);
14
-        echo 'var data = ' . $JSON;
14
+        echo 'var data = '.$JSON;
15 15
     }
16 16
     
17 17
     public static function translateAndRespond($data)
Please login to merge, or discard this patch.
src/App.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
     
21 21
     public static function config($Label)
22 22
     {
23
-        $Config = static::$ApplicationPath . '/config/' . $Label . '.php';
23
+        $Config = static::$ApplicationPath.'/config/'.$Label.'.php';
24 24
         if (!file_exists($Config)) {
25
-            throw new \Exception($Config . ' not found in '.static::class.'::config()');
25
+            throw new \Exception($Config.' not found in '.static::class.'::config()');
26 26
         }
27 27
         return require $Config;
28 28
     }
Please login to merge, or discard this patch.
src/Models/ActiveRecord.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@
 block discarded – undo
84 84
     
85 85
     
86 86
     /**
87
-    * @var array $validators Validation checks
88
-    */
87
+     * @var array $validators Validation checks
88
+     */
89 89
     public static $validators = [];
90 90
 
91 91
     /**
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 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, [static::class,'handleError']);
1106
+            return DB::table(static::_cn($options['indexField']), $query, $params, [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, [static::class,'handleError']);
1153
+            return DB::table(static::_cn($options['indexField']), $query, $params, [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'];
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
                 case 'boolean':
1717 1717
                 {
1718 1718
                     if (!isset($this->_convertedValues[$field])) {
1719
-                        $this->_convertedValues[$field] = (boolean)$value;
1719
+                        $this->_convertedValues[$field] = (boolean) $value;
1720 1720
                     }
1721 1721
 
1722 1722
                     return $this->_convertedValues[$field];
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
 
1756 1756
     protected function _setBooleanValue($value)
1757 1757
     {
1758
-        return (boolean)$value;
1758
+        return (boolean) $value;
1759 1759
     }
1760 1760
 
1761 1761
     protected function _setDecimalValue($value)
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
             foreach ($order as $key => $value) {
1996 1996
                 if (is_string($key)) {
1997 1997
                     $columnName = static::_cn($key);
1998
-                    $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC';
1998
+                    $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC';
1999 1999
                 } else {
2000 2000
                     $columnName = static::_cn($value);
2001 2001
                     $direction = 'ASC';
Please login to merge, or discard this patch.