Completed
Push — master ( 7aea32...5f552d )
by Henry
02:20
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
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                         static::$tableName,
532 532
                         join(',', $set),
533 533
                     ],
534
-                    [static::class,'handleError']
534
+                    [static::class, 'handleError']
535 535
                 );
536 536
                 
537 537
                 $this->_record[static::$primaryKey ? static::$primaryKey : 'ID'] = DB::insertID();
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                         static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'),
547 547
                         $this->getPrimaryKeyValue(),
548 548
                     ],
549
-                    [static::class,'handleError']
549
+                    [static::class, 'handleError']
550 550
                 );
551 551
                 
552 552
                 $this->_isUpdated = true;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
             static::$tableName,
596 596
             static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'),
597 597
             $id,
598
-        ], [static::class,'handleError']);
598
+        ], [static::class, 'handleError']);
599 599
         
600 600
         return DB::affectedRows() > 0;
601 601
     }
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
     
662 662
         if ($cacheIndex) {
663 663
             $key = sprintf('%s/%s:%s', static::$tableName, $field, $value);
664
-            return DB::oneRecordCached($key, $query, $params, [static::class,'handleError']);
664
+            return DB::oneRecordCached($key, $query, $params, [static::class, 'handleError']);
665 665
         } else {
666
-            return DB::oneRecord($query, $params, [static::class,'handleError']);
666
+            return DB::oneRecord($query, $params, [static::class, 'handleError']);
667 667
         }
668 668
     }
669 669
     
@@ -697,13 +697,13 @@  discard block
 block discarded – undo
697 697
                 $order ? 'ORDER BY '.join(',', $order) : '',
698 698
             ],
699 699
         
700
-            [static::class,'handleError']
700
+            [static::class, 'handleError']
701 701
         );
702 702
     }
703 703
     
704 704
     public static function getByQuery($query, $params = [])
705 705
     {
706
-        return static::instantiateRecord(DB::oneRecord($query, $params, [static::class,'handleError']));
706
+        return static::instantiateRecord(DB::oneRecord($query, $params, [static::class, 'handleError']));
707 707
     }
708 708
 
709 709
     public static function getAllByClass($className = false, $options = [])
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
                     return ', '.$value.' AS '.$key;
751 751
                 }
752 752
             } else {
753
-                return ', ' . $columns;
753
+                return ', '.$columns;
754 754
             }
755 755
         }
756 756
     }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
     public static function buildHaving($having)
759 759
     {
760 760
         if (!empty($having)) {
761
-            return ' HAVING (' . (is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having) . ')';
761
+            return ' HAVING ('.(is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having).')';
762 762
         }
763 763
     }
764 764
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
         ];
802 802
         
803 803
         if ($options['order']) {
804
-            $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order']));
804
+            $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order']));
805 805
         }
806 806
         
807 807
         if ($options['limit']) {
@@ -809,9 +809,9 @@  discard block
 block discarded – undo
809 809
         }
810 810
         
811 811
         if ($options['indexField']) {
812
-            return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']);
812
+            return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']);
813 813
         } else {
814
-            return DB::allRecords($query, $params, [static::class,'handleError']);
814
+            return DB::allRecords($query, $params, [static::class, 'handleError']);
815 815
         }
816 816
     }
817 817
     
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
         ];
837 837
         
838 838
         if ($options['order']) {
839
-            $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order']));
839
+            $query .= ' ORDER BY '.join(',', static::_mapFieldOrder($options['order']));
840 840
         }
841 841
         
842 842
         if ($options['limit']) {
@@ -844,20 +844,20 @@  discard block
 block discarded – undo
844 844
         }
845 845
 
846 846
         if ($options['indexField']) {
847
-            return DB::table(static::_cn($options['indexField']), $query, $params, [static::class,'handleError']);
847
+            return DB::table(static::_cn($options['indexField']), $query, $params, [static::class, 'handleError']);
848 848
         } else {
849
-            return DB::allRecords($query, $params, [static::class,'handleError']);
849
+            return DB::allRecords($query, $params, [static::class, 'handleError']);
850 850
         }
851 851
     }
852 852
     
853 853
     public static function getAllByQuery($query, $params = [])
854 854
     {
855
-        return static::instantiateRecords(DB::allRecords($query, $params, [static::class,'handleError']));
855
+        return static::instantiateRecords(DB::allRecords($query, $params, [static::class, 'handleError']));
856 856
     }
857 857
 
858 858
     public static function getTableByQuery($keyField, $query, $params = [])
859 859
     {
860
-        return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class,'handleError']));
860
+        return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class, 'handleError']));
861 861
     }
862 862
 
863 863
     
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
     {
956 956
         static::init();
957 957
         if (!static::fieldExists($field)) {
958
-            throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field);
958
+            throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field);
959 959
         }
960 960
         
961 961
         return static::$_classFields[get_called_class()][$field]['columnName'];
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
                 case 'boolean':
1317 1317
                 {
1318 1318
                     if (!isset($this->_convertedValues[$field])) {
1319
-                        $this->_convertedValues[$field] = (boolean)$value;
1319
+                        $this->_convertedValues[$field] = (boolean) $value;
1320 1320
                     }
1321 1321
                     
1322 1322
                     return $this->_convertedValues[$field];
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 
1356 1356
     protected function _setBooleanValue($value)
1357 1357
     {
1358
-        return (boolean)$value;
1358
+        return (boolean) $value;
1359 1359
     }
1360 1360
 
1361 1361
     protected function _setDecimalValue($value)
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
             foreach ($order as $key => $value) {
1596 1596
                 if (is_string($key)) {
1597 1597
                     $columnName = static::_cn($key);
1598
-                    $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC';
1598
+                    $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC';
1599 1599
                 } else {
1600 1600
                     $columnName = static::_cn($value);
1601 1601
                     $direction = 'ASC';
Please login to merge, or discard this patch.