Completed
Push — master ( 604db9...9db94b )
by Alexey
07:34
created
system/Inji/ComposerCmd.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -58,6 +58,10 @@
 block discarded – undo
58 58
         self::command('install', false, $path);
59 59
     }
60 60
 
61
+    /**
62
+     * @param string $command
63
+     * @param string $path
64
+     */
61 65
     static function command($command, $needOutput = true, $path = null)
62 66
     {
63 67
         include_once 'composer/vendor/autoload.php';
Please login to merge, or discard this patch.
system/Inji/Log.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -90,6 +90,9 @@
 block discarded – undo
90 90
         echo '<tr><th>Memory</th><th>' . $this->convertSize(memory_get_peak_usage()) . ' of ' . ini_get('memory_limit') . '</th></tr></table></div>';
91 91
     }
92 92
 
93
+    /**
94
+     * @param integer $size
95
+     */
93 96
     function convertSize($size)
94 97
     {
95 98
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
                 echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>";
87 87
             }
88 88
         }
89
-        echo '<tr><th>Summary</th><th>' . round(( microtime(true) - $this->startTime), 5) . '</th></tr>';
89
+        echo '<tr><th>Summary</th><th>' . round((microtime(true) - $this->startTime), 5) . '</th></tr>';
90 90
         echo '<tr><th>Memory</th><th>' . $this->convertSize(memory_get_peak_usage()) . ' of ' . ini_get('memory_limit') . '</th></tr></table></div>';
91 91
     }
92 92
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -79,10 +79,12 @@  discard block
 block discarded – undo
79 79
             if (!empty($log['status'])) {
80 80
                 echo "<tr class = '{$log['status']}'><td>{$log['name']}</td><td>{$log['status']}</td></tr>";
81 81
             } else {
82
-                if (empty($log['end']))
83
-                    $log['end'] = microtime(true);
84
-                if (empty($log['start']))
85
-                    $log['start'] = microtime(true);
82
+                if (empty($log['end'])) {
83
+                                    $log['end'] = microtime(true);
84
+                }
85
+                if (empty($log['start'])) {
86
+                                    $log['start'] = microtime(true);
87
+                }
86 88
                 echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>";
87 89
             }
88 90
         }
@@ -93,12 +95,13 @@  discard block
 block discarded – undo
93 95
     function convertSize($size)
94 96
     {
95 97
 
96
-        if ($size < 1024)
97
-            return $size . "B";
98
-        elseif ($size < 1048576)
99
-            return round($size / 1024, 2) . "KB";
100
-        else
101
-            return round($size / 1048576, 2) . "MB";
98
+        if ($size < 1024) {
99
+                    return $size . "B";
100
+        } elseif ($size < 1048576) {
101
+                    return round($size / 1024, 2) . "KB";
102
+        } else {
103
+                    return round($size / 1048576, 2) . "MB";
104
+        }
102 105
     }
103 106
 
104 107
     function __destruct()
Please login to merge, or discard this patch.
system/Inji/Model.php 3 patches
Doc Comments   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
      * Check model relations path and load need relations
313 313
      * 
314 314
      * @param string $col
315
-     * @param strig $rootModel
315
+     * @param string $rootModel
316 316
      */
317 317
     static function checkForJoin(&$col, $rootModel)
318 318
     {
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     /**
357 357
      * Information extractor for col relations path
358 358
      * 
359
-     * @param string|array $info
359
+     * @param string $info
360 360
      * @return array
361 361
      */
362 362
     private static function parseColRecursion($info)
@@ -428,6 +428,9 @@  discard block
 block discarded – undo
428 428
         return Model::$cols[static::table()];
429 429
     }
430 430
 
431
+    /**
432
+     * @param string $colName
433
+     */
431 434
     static function genColParams($colName)
432 435
     {
433 436
         if (empty(static::$cols[$colName]) || static::$storage['type'] == 'moduleConfig') {
@@ -481,7 +484,7 @@  discard block
 block discarded – undo
481 484
      * Create new col in data base
482 485
      * 
483 486
      * @param string $colName
484
-     * @return boolean
487
+     * @return false|null
485 488
      */
486 489
     static function createCol($colName)
487 490
     {
@@ -566,7 +569,7 @@  discard block
 block discarded – undo
566 569
     /**
567 570
      * return relations list
568 571
      * 
569
-     * @return array
572
+     * @return string
570 573
      */
571 574
     static function relations()
572 575
     {
@@ -1062,7 +1065,7 @@  discard block
 block discarded – undo
1062 1065
      * 
1063 1066
      * @param array $params
1064 1067
      * @param array $where
1065
-     * @return boolean
1068
+     * @return false|null
1066 1069
      */
1067 1070
     static function update($params, $where = [])
1068 1071
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1035,7 +1035,7 @@
 block discarded – undo
1035 1035
         } else {
1036 1036
             $cols .= '*';
1037 1037
         }
1038
-        $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : '');
1038
+        $cols .= ') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : '');
1039 1039
         App::$cur->db->cols = $cols;
1040 1040
         if (!empty($options['group'])) {
1041 1041
             App::$cur->db->group($options['group']);
Please login to merge, or discard this patch.
Braces   +48 added lines, -36 removed lines patch added patch discarded remove patch
@@ -680,17 +680,21 @@  discard block
 block discarded – undo
680 680
     {
681 681
 
682 682
         $return = array();
683
-        if (!empty($options['where']))
684
-            App::$cur->db->where($options['where']);
683
+        if (!empty($options['where'])) {
684
+                    App::$cur->db->where($options['where']);
685
+        }
685 686
         if (!empty($options['group'])) {
686 687
             App::$cur->db->group($options['group']);
687 688
         }
688
-        if (!empty($options['order']))
689
-            App::$cur->db->order($options['order']);
690
-        if (!empty($options['join']))
691
-            App::$cur->db->join($options['join']);
692
-        if (!empty($options['distinct']))
693
-            App::$cur->db->distinct = $options['distinct'];
689
+        if (!empty($options['order'])) {
690
+                    App::$cur->db->order($options['order']);
691
+        }
692
+        if (!empty($options['join'])) {
693
+                    App::$cur->db->join($options['join']);
694
+        }
695
+        if (!empty($options['distinct'])) {
696
+                    App::$cur->db->distinct = $options['distinct'];
697
+        }
694 698
 
695 699
         foreach (static::$relJoins as $join) {
696 700
             App::$cur->db->join($join[0], $join[1]);
@@ -716,14 +720,14 @@  discard block
 block discarded – undo
716 720
         }
717 721
         static::$needJoin = [];
718 722
 
719
-        if (!empty($options['limit']))
720
-            $limit = (int) $options['limit'];
721
-        else {
723
+        if (!empty($options['limit'])) {
724
+                    $limit = (int) $options['limit'];
725
+        } else {
722 726
             $limit = 0;
723 727
         }
724
-        if (!empty($options['start']))
725
-            $start = (int) $options['start'];
726
-        else {
728
+        if (!empty($options['start'])) {
729
+                    $start = (int) $options['start'];
730
+        } else {
727 731
             $start = 0;
728 732
         }
729 733
         if ($limit || $start) {
@@ -980,21 +984,23 @@  discard block
 block discarded – undo
980 984
             static::fixPrefix($options['where'], 'first');
981 985
         }
982 986
         $return = array();
983
-        if (!empty($options['where']))
984
-            App::$cur->db->where($options['where']);
985
-        if (!empty($options['join']))
986
-            App::$cur->db->join($options['join']);
987
+        if (!empty($options['where'])) {
988
+                    App::$cur->db->where($options['where']);
989
+        }
990
+        if (!empty($options['join'])) {
991
+                    App::$cur->db->join($options['join']);
992
+        }
987 993
         if (!empty($options['order'])) {
988 994
             App::$cur->db->order($options['order']);
989 995
         }
990
-        if (!empty($options['limit']))
991
-            $limit = (int) $options['limit'];
992
-        else {
996
+        if (!empty($options['limit'])) {
997
+                    $limit = (int) $options['limit'];
998
+        } else {
993 999
             $limit = 0;
994 1000
         }
995
-        if (!empty($options['start']))
996
-            $start = (int) $options['start'];
997
-        else {
1001
+        if (!empty($options['start'])) {
1002
+                    $start = (int) $options['start'];
1003
+        } else {
998 1004
             $start = 0;
999 1005
         }
1000 1006
         if ($limit || $start) {
@@ -1072,11 +1078,13 @@  discard block
 block discarded – undo
1072 1078
 
1073 1079
         $values = array();
1074 1080
         foreach ($cols as $col => $param) {
1075
-            if (isset($params[$col]))
1076
-                $values[$col] = $params[$col];
1081
+            if (isset($params[$col])) {
1082
+                            $values[$col] = $params[$col];
1083
+            }
1084
+        }
1085
+        if (!$values) {
1086
+                    return false;
1077 1087
         }
1078
-        if (!$values)
1079
-            return false;
1080 1088
 
1081 1089
 
1082 1090
         if ($where) {
@@ -1257,11 +1265,13 @@  discard block
 block discarded – undo
1257 1265
         $values = array();
1258 1266
 
1259 1267
         foreach ($this->cols() as $col => $param) {
1260
-            if (isset($this->_params[$col]))
1261
-                $values[$col] = $this->_params[$col];
1268
+            if (isset($this->_params[$col])) {
1269
+                            $values[$col] = $this->_params[$col];
1270
+            }
1271
+        }
1272
+        if (!$values && empty($options['empty'])) {
1273
+                    return false;
1262 1274
         }
1263
-        if (!$values && empty($options['empty']))
1264
-            return false;
1265 1275
 
1266 1276
         if ($this->pk()) {
1267 1277
             $new = false;
@@ -1417,8 +1427,9 @@  discard block
 block discarded – undo
1417 1427
     {
1418 1428
 
1419 1429
         foreach (static::relations() as $relName => $rel) {
1420
-            if ($rel['col'] == $col)
1421
-                return $relName;
1430
+            if ($rel['col'] == $col) {
1431
+                            return $relName;
1432
+            }
1422 1433
         }
1423 1434
         return NULL;
1424 1435
     }
@@ -1574,8 +1585,9 @@  discard block
 block discarded – undo
1574 1585
             App::$cur->db->where($relation['relTablePrefix'] . $this->index(), $this->pk());
1575 1586
             App::$cur->db->where($relation['relTablePrefix'] . $relation['model']::index(), $objectId);
1576 1587
             $isset = App::$cur->db->select($relation['relTable'])->fetch_assoc();
1577
-            if ($isset)
1578
-                return true;
1588
+            if ($isset) {
1589
+                            return true;
1590
+            }
1579 1591
 
1580 1592
             App::$cur->db->insert($relation['relTable'], [
1581 1593
                 $relation['relTablePrefix'] . $this->index() => $this->{$this->index()},
Please login to merge, or discard this patch.
system/Inji/Module.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
      * Get all posible directorys for module files
82 82
      * 
83 83
      * @param string $moduleName
84
-     * @return array
84
+     * @return string
85 85
      */
86 86
     static function getModulePaths($moduleName)
87 87
     {
Please login to merge, or discard this patch.
system/Inji/Router.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@
 block discarded – undo
82 82
     /**
83 83
      * Return posible paths for class path
84 84
      * 
85
-     * @param type $code
86
-     * @param type $folder
87
-     * @param type $classPath
85
+     * @param string $code
86
+     * @param string $folder
87
+     * @param string $classPath
88 88
      * @return string
89 89
      */
90 90
     static function genFolderPaths($code, $folder, $classPath)
Please login to merge, or discard this patch.
system/Inji/Tools.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -216,6 +216,7 @@
 block discarded – undo
216 216
      * @param  $number Integer Число на основе которого нужно сформировать окончание
217 217
      * @param  $endingsArray  Array Массив слов или окончаний для чисел (1, 4, 5),
218 218
      *         например array('яблоко', 'яблока', 'яблок')
219
+     * @param string[] $endingArray
219 220
      * @return String
220 221
      */
221 222
     static function getNumEnding($number, $endingArray)
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     static function uriParse($uri)
39 39
     {
40 40
         $answerPos = strpos($uri, '?');
41
-        $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri) )), 1);
41
+        $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri))), 1);
42 42
 
43 43
         foreach ($params as $key => $param) {
44 44
             if ($param != '') {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     static function resizeImage($img_path, $max_width = 1000, $max_height = 1000, $crop = false, $pos = 'center')
86 86
     {
87 87
         ini_set("gd.jpeg_ignore_warning", 1);
88
-        list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($img_path);
88
+        list($img_width, $img_height, $img_type, $img_tag) = getimagesize($img_path);
89 89
         switch ($img_type) {
90 90
             case 1:
91 91
                 $img_type = 'gif';
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 
109 109
         if ($crop === true || $crop == 'q') {
110 110
             if ($img_width > $img_height) {
111
-                $imgX = floor(( $img_width - $img_height ) / 2);
111
+                $imgX = floor(($img_width - $img_height) / 2);
112 112
                 $imgY = 0;
113 113
                 $img_width = $img_height;
114 114
                 $new_width = $max_width;
115 115
                 $new_height = $max_height;
116 116
             } else {
117 117
                 $imgX = 0;
118
-                $imgY = floor(( $img_height - $img_width ) / 2);
118
+                $imgY = floor(($img_height - $img_width) / 2);
119 119
                 $img_height = $img_width;
120 120
                 $new_width = $max_width;
121 121
                 $new_height = $max_height;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $new_width = $max_width;
137 137
             $new_height = $max_height;
138 138
 //Находим начальные координаты (центрируем новое изображение)
139
-            $imgX = (int) (($ow / 2) - ($img_width / 2) );
139
+            $imgX = (int) (($ow / 2) - ($img_width / 2));
140 140
             if ($pos == 'center') {
141 141
                 $imgY = (int) (($oh / 2) - ($img_height / 2));
142 142
             } else {
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
      */
59 59
     static function createDir($path)
60 60
     {
61
-        if (file_exists($path))
62
-            return true;
61
+        if (file_exists($path)) {
62
+                    return true;
63
+        }
63 64
 
64 65
         $path = explode('/', $path);
65 66
         $cur = '';
@@ -101,10 +102,11 @@  discard block
 block discarded – undo
101 102
         $imagecreatefromX = "imagecreatefrom{$img_type}";
102 103
         $src_res = $imagecreatefromX($img_path);
103 104
 
104
-        if ($img_width / $max_width > $img_height / $max_height)
105
-            $separator = $img_width / $max_width;
106
-        else
107
-            $separator = $img_height / $max_height;
105
+        if ($img_width / $max_width > $img_height / $max_height) {
106
+                    $separator = $img_width / $max_width;
107
+        } else {
108
+                    $separator = $img_height / $max_height;
109
+        }
108 110
 
109 111
         if ($crop === true || $crop == 'q') {
110 112
             if ($img_width > $img_height) {
Please login to merge, or discard this patch.
system/Inji/Value.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
     public $model = null;
15 15
     public $type = 'string';
16 16
 
17
+    /**
18
+     * @param Model $model
19
+     */
17 20
     function __construct($model, $key)
18 21
     {
19 22
         $this->model = $model;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@
 block discarded – undo
64 64
                 ?>
65 65
                 <div class="filter_form_field filter_select">
66 66
                   <?php
67
-                  $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], ['value' => $value, 'values' => $values, 'noContainer' => true])
68
-                  ?>
67
+                    $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], ['value' => $value, 'values' => $values, 'noContainer' => true])
68
+                    ?>
69 69
                 </div>
70 70
                 <?php
71 71
                 break;
Please login to merge, or discard this patch.
system/modules/Access/Access.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -56,6 +56,10 @@
 block discarded – undo
56 56
         return true;
57 57
     }
58 58
 
59
+    /**
60
+     * @param string[] $path
61
+     * @param string $element
62
+     */
59 63
     function resolvePath($array, $path, $element)
60 64
     {
61 65
         while ($path) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
         if (!$app) {
16 16
             $app = $this->app->type;
17 17
         }
18
-        if (!empty($this->config['access']['accessTree'][$app]['deniedUrl']))
19
-            return $this->config['access']['accessTree'][$app]['deniedUrl'];
18
+        if (!empty($this->config['access']['accessTree'][$app]['deniedUrl'])) {
19
+                    return $this->config['access']['accessTree'][$app]['deniedUrl'];
20
+        }
20 21
 
21 22
         return '/';
22 23
     }
@@ -50,8 +51,9 @@  discard block
 block discarded – undo
50 51
             return true;
51 52
         }
52 53
 
53
-        if ((!$user->group_id && !empty($access)) || ($user->group_id && !empty($access) && !in_array($user->group_id, $access)))
54
-            return false;
54
+        if ((!$user->group_id && !empty($access)) || ($user->group_id && !empty($access) && !in_array($user->group_id, $access))) {
55
+                    return false;
56
+        }
55 57
 
56 58
         return true;
57 59
     }
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Query.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -29,6 +29,9 @@  discard block
 block discarded – undo
29 29
     public $params = [];
30 30
     public $distinct = false;
31 31
 
32
+    /**
33
+     * @param  $instance
34
+     */
32 35
     function __construct($instance = null)
33 36
     {
34 37
         if (!$instance) {
@@ -47,6 +50,9 @@  discard block
 block discarded – undo
47 50
         return $this->curInstance->pdo->lastInsertId();
48 51
     }
49 52
 
53
+    /**
54
+     * @param string $table
55
+     */
50 56
     public function select($table)
51 57
     {
52 58
         $this->operation = 'SELECT';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -288,7 +288,7 @@
 block discarded – undo
288 288
                     }
289 289
                 }
290 290
                 $update = implode(',', $updates);
291
-                $query .=" SET {$update}";
291
+                $query .= " SET {$update}";
292 292
             case 'SELECT':
293 293
             case 'DELETE':
294 294
                 $this->buildWhere($this->where);
Please login to merge, or discard this patch.
Braces   +59 added lines, -46 removed lines patch added patch discarded remove patch
@@ -126,12 +126,14 @@  discard block
 block discarded – undo
126 126
         if (!is_array($order)) {
127 127
             $this->order[] = "{$order} {$type}";
128 128
         } else {
129
-            foreach ($order as $item)
130
-                if (!is_array($item)) {
129
+            foreach ($order as $item) {
130
+                            if (!is_array($item)) {
131 131
                     call_user_func_array(array($this, 'order'), $order);
132
+            }
132 133
                     break;
133
-                } else
134
-                    $this->order($item);
134
+                } else {
135
+                                    $this->order($item);
136
+                }
135 137
         }
136 138
     }
137 139
 
@@ -140,8 +142,9 @@  discard block
 block discarded – undo
140 142
         $start = intval($start);
141 143
         $len = intval($len);
142 144
         $this->limit = "LIMIT {$start}";
143
-        if ($len !== 0)
144
-            $this->limit .= ",{$len}";
145
+        if ($len !== 0) {
146
+                    $this->limit .= ",{$len}";
147
+        }
145 148
     }
146 149
 
147 150
     function buildJoin($table, $where = false, $type = 'LEFT', $alias = '')
@@ -154,10 +157,12 @@  discard block
 block discarded – undo
154 157
             }
155 158
         } else {
156 159
             $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}";
157
-            if ($alias)
158
-                $join .= " AS `{$alias}`";
159
-            if ($where)
160
-                $join .= " ON {$where}";
160
+            if ($alias) {
161
+                            $join .= " AS `{$alias}`";
162
+            }
163
+            if ($where) {
164
+                            $join .= " ON {$where}";
165
+            }
161 166
         }
162 167
         return $join;
163 168
     }
@@ -166,69 +171,77 @@  discard block
 block discarded – undo
166 171
     {
167 172
         $params = [];
168 173
         if (!is_array($where)) {
169
-            if (!$operation)
170
-                $operation = '=';
174
+            if (!$operation) {
175
+                            $operation = '=';
176
+            }
171 177
 
172
-            if ($concatenation === false)
173
-                $concatenation = 'AND';
174
-            elseif ($concatenation === true)
175
-                $concatenation = '';
178
+            if ($concatenation === false) {
179
+                            $concatenation = 'AND';
180
+            } elseif ($concatenation === true) {
181
+                            $concatenation = '';
182
+            }
176 183
 
177
-            if ($this->whereString == NULL)
178
-                $this->whereString = ' WHERE ';
184
+            if ($this->whereString == NULL) {
185
+                            $this->whereString = ' WHERE ';
186
+            }
179 187
 
180 188
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
181
-                if (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value))
182
-                    $value = "({$value})";
183
-                elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value))
184
-                    $value = "\"{$value}\"";
185
-            }
186
-            elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
189
+                if (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
190
+                                    $value = "({$value})";
191
+                } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
192
+                                    $value = "\"{$value}\"";
193
+                }
194
+            } elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
187 195
                 $this->params[] = $value;
188 196
                 $value = "?";
189 197
             }
190 198
 
191
-            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ')
192
-                $this->whereString .= " {$where} {$operation} {$value} ";
193
-            else
194
-                $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
195
-        }
196
-        else {
199
+            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') {
200
+                            $this->whereString .= " {$where} {$operation} {$value} ";
201
+            } else {
202
+                            $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
203
+            }
204
+        } else {
197 205
             $i = -1;
198 206
             while (isset($where[++$i])) {
199 207
                 $item = $where[$i];
200 208
                 if (isset($where[$i + 1]) && !isset($where[$i - 1]) && is_array($where[$i])) {
201 209
                     if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(' && $this->whereString != 'WHERE ') {
202
-                        if (!isset($item[3]))
203
-                            $concatenation = 'AND';
204
-                        else
205
-                            $concatenation = $item[3];
210
+                        if (!isset($item[3])) {
211
+                                                    $concatenation = 'AND';
212
+                        } else {
213
+                                                    $concatenation = $item[3];
214
+                        }
206 215
 
207 216
                         $this->whereString .= "{$concatenation} ";
208 217
                     }
209 218
 
210
-                    if ($this->whereString != NULL)
211
-                        $this->whereString .= '(';
212
-                    else
213
-                        $this->whereString = 'WHERE (';
219
+                    if ($this->whereString != NULL) {
220
+                                            $this->whereString .= '(';
221
+                    } else {
222
+                                            $this->whereString = 'WHERE (';
223
+                    }
214 224
                 }
215 225
 
216 226
                 if (!is_array($item)) {
217 227
                     call_user_func_array(array($this, 'buildWhere'), $where);
218 228
                     break;
219 229
                 } else {
220
-                    if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(')
221
-                        if (!isset($item[3]))
230
+                    if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(') {
231
+                                            if (!isset($item[3]))
222 232
                             $concatenation = 'AND';
223
-                        else
224
-                            $concatenation = $item[3];
225
-                    elseif (substr($this->whereString, -1, 1) != '(')
226
-                        $this->whereString = 'WHERE ';
233
+                    } else {
234
+                                                    $concatenation = $item[3];
235
+                        }
236
+                    elseif (substr($this->whereString, -1, 1) != '(') {
237
+                                            $this->whereString = 'WHERE ';
238
+                    }
227 239
 
228 240
                     $this->buildWhere($item);
229 241
                 }
230
-                if (!isset($where[$i + 1]) && isset($where[$i - 1]))
231
-                    $this->whereString .= ') ';
242
+                if (!isset($where[$i + 1]) && isset($where[$i - 1])) {
243
+                                    $this->whereString .= ') ';
244
+                }
232 245
             }
233 246
         }
234 247
     }
Please login to merge, or discard this patch.