Passed
Push — master ( a67e20...527622 )
by Henry
02:03
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/SQL.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
          * Keep it. We don't need a database connection to escape strings.
34 34
          */
35 35
         return str_replace(
36
-            ["\\",  "\x00", "\n",  "\r",  "'",  '"', "\x1a"],
37
-            ["\\\\","\\0","\\n", "\\r", "\'", '\"', "\\Z"],
36
+            ["\\", "\x00", "\n", "\r", "'", '"', "\x1a"],
37
+            ["\\\\", "\\0", "\\n", "\\r", "\'", '\"', "\\Z"],
38 38
             $str
39 39
         );
40 40
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             case 'integer':
143 143
                 return 'int'.($field['unsigned'] ? ' unsigned' : '').(!empty($field['zerofill']) ? ' zerofill' : '');
144 144
             case 'decimal':
145
-                return sprintf('decimal(%s)', $field['length']).(!empty($field['unsigned']) ? ' unsigned' : '').(!empty($field['zerofill']) ? ' zerofill' : '');;
145
+                return sprintf('decimal(%s)', $field['length']).(!empty($field['unsigned']) ? ' unsigned' : '').(!empty($field['zerofill']) ? ' zerofill' : ''); ;
146 146
             case 'float':
147 147
                 return 'float';
148 148
             case 'double':
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
                 return 'year';
173 173
 
174 174
             case 'enum':
175
-                return sprintf('enum("%s")', join('","', array_map([static::class,'escape'], $field['values'])));
175
+                return sprintf('enum("%s")', join('","', array_map([static::class, 'escape'], $field['values'])));
176 176
 
177 177
             case 'set':
178
-                return sprintf('set("%s")', join('","', array_map([static::class,'escape'], $field['values'])));
178
+                return sprintf('set("%s")', join('","', array_map([static::class, 'escape'], $field['values'])));
179 179
 
180 180
             default:
181 181
                 throw new Exception("getSQLType: unhandled type $field[type]");
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/ActiveRecord.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,9 +86,9 @@
 block discarded – undo
86 86
     
87 87
     
88 88
     /**
89
-    * Validation checks
90
-    * @var array
91
-    */
89
+     * Validation checks
90
+     * @var array
91
+     */
92 92
     public static $validators = [];
93 93
 
94 94
     /**
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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';
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.