Completed
Branch master (ebb499)
by Alexey
04:15
created
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   +27 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
         foreach ($params as $key => $param) {
42 42
             if ($param != '') {
43 43
                 $params[$key] = urldecode($param);
44
-            } else {
44
+            }
45
+            else {
45 46
                 unset($params[$key]);
46 47
             }
47 48
         }
@@ -55,8 +56,9 @@  discard block
 block discarded – undo
55 56
      * @return boolean
56 57
      */
57 58
     public static function createDir($path) {
58
-        if (file_exists($path))
59
-            return true;
59
+        if (file_exists($path)) {
60
+                    return true;
61
+        }
60 62
 
61 63
         $path = explode('/', $path);
62 64
         $cur = '';
@@ -100,10 +102,12 @@  discard block
 block discarded – undo
100 102
             return false;
101 103
         }
102 104
 
103
-        if ($img_width / $max_width > $img_height / $max_height)
104
-            $separator = $img_width / $max_width;
105
-        else
106
-            $separator = $img_height / $max_height;
105
+        if ($img_width / $max_width > $img_height / $max_height) {
106
+                    $separator = $img_width / $max_width;
107
+        }
108
+        else {
109
+                    $separator = $img_height / $max_height;
110
+        }
107 111
 
108 112
         if ($crop === true || $crop == 'q') {
109 113
             if ($img_width > $img_height) {
@@ -112,7 +116,8 @@  discard block
 block discarded – undo
112 116
                 $img_width = $img_height;
113 117
                 $new_width = $max_width;
114 118
                 $new_height = $max_height;
115
-            } else {
119
+            }
120
+            else {
116 121
                 $imgX = 0;
117 122
                 $imgY = floor(( $img_height - $img_width ) / 2);
118 123
                 $img_height = $img_width;
@@ -122,7 +127,8 @@  discard block
 block discarded – undo
122 127
             if ($pos == 'top') {
123 128
                 $imgY = 0;
124 129
             }
125
-        } elseif ($crop == 'c') {
130
+        }
131
+        elseif ($crop == 'c') {
126 132
 //Вычисляем некий коэффициент масштабирования
127 133
             $k1 = $img_width / $max_width;
128 134
             $k2 = $img_height / $max_height;
@@ -138,10 +144,12 @@  discard block
 block discarded – undo
138 144
             $imgX = (int) (($ow / 2) - ($img_width / 2) );
139 145
             if ($pos == 'center') {
140 146
                 $imgY = (int) (($oh / 2) - ($img_height / 2));
141
-            } else {
147
+            }
148
+            else {
142 149
                 $imgY = 0;
143 150
             }
144
-        } else {
151
+        }
152
+        else {
145 153
             $imgX = 0;
146 154
             $imgY = 0;
147 155
             $new_width = floor($img_width / $separator);
@@ -156,7 +164,8 @@  discard block
 block discarded – undo
156 164
         if ($img_type == 'jpeg') {
157 165
             imageinterlace($new_res, 1); // чересстрочное формирование изображение
158 166
             imagejpeg($new_res, $img_path, 85);
159
-        } else {
167
+        }
168
+        else {
160 169
             $imageX = "image{$img_type}";
161 170
             $imageX($new_res, $img_path);
162 171
         }
@@ -207,7 +216,8 @@  discard block
 block discarded – undo
207 216
         }
208 217
         if (!headers_sent()) {
209 218
             header("Location: {$href}");
210
-        } else {
219
+        }
220
+        else {
211 221
             echo '\'"><script>window.location="' . $href . '";</script>';
212 222
         }
213 223
         exit("Перенаправление на: <a href = '{$href}'>{$href}</a>");
@@ -224,7 +234,8 @@  discard block
 block discarded – undo
224 234
         $number = $number % 100;
225 235
         if ($number >= 11 && $number <= 19) {
226 236
             $ending = $endingArray[2];
227
-        } else {
237
+        }
238
+        else {
228 239
             $i = $number % 10;
229 240
             switch ($i) {
230 241
                 case (1): $ending = $endingArray[0];
@@ -366,7 +377,8 @@  discard block
 block discarded – undo
366 377
             }
367 378
             if (is_dir($from . '/' . $file)) {
368 379
                 self::copyFiles($from . '/' . $file, $to . '/' . $file);
369
-            } else {
380
+            }
381
+            else {
370 382
                 copy($from . '/' . $file, $to . '/' . $file);
371 383
             }
372 384
         }
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Query.php 4 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   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
                     $newValue = '';
187 187
                     foreach ($value as $item) {
188 188
                         if ($newValue) {
189
-                            $newValue.=',';
189
+                            $newValue .= ',';
190 190
                         }
191 191
                         if (is_string($item)) {
192
-                            $newValue .='"' . $item . '"';
192
+                            $newValue .= '"' . $item . '"';
193 193
                         } else {
194
-                            $newValue .=$item;
194
+                            $newValue .= $item;
195 195
                         }
196 196
                     }
197 197
                     $value = '(' . $newValue . ')';
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
                     $newValue = '';
271 271
                     foreach ($value as $item) {
272 272
                         if ($newValue) {
273
-                            $newValue.=',';
273
+                            $newValue .= ',';
274 274
                         }
275 275
                         if (is_string($item)) {
276
-                            $newValue .='"' . $item . '"';
276
+                            $newValue .= '"' . $item . '"';
277 277
                         } else {
278
-                            $newValue .=$item;
278
+                            $newValue .= $item;
279 279
                         }
280 280
                     }
281 281
                     $value = '(' . $newValue . ')';
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                     }
382 382
                 }
383 383
                 $update = implode(',', $updates);
384
-                $query .=" SET {$update}";
384
+                $query .= " SET {$update}";
385 385
             case 'SELECT':
386 386
             case 'DELETE':
387 387
                 $this->buildWhere($this->where);
Please login to merge, or discard this patch.
Braces   +100 added lines, -59 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
     public function __construct($instance = null) {
35 35
         if (!$instance) {
36 36
             $this->curInstance = \App::$cur->db->connection;
37
-        } else {
37
+        }
38
+        else {
38 39
             $this->curInstance = $instance;
39 40
         }
40 41
     }
@@ -79,7 +80,8 @@  discard block
 block discarded – undo
79 80
     public function cols($cols) {
80 81
         if (is_array($cols)) {
81 82
             $this->cols = array_merge($this->cols, array_values($cols));
82
-        } else {
83
+        }
84
+        else {
83 85
             $this->cols[] = $cols;
84 86
         }
85 87
     }
@@ -90,11 +92,13 @@  discard block
 block discarded – undo
90 92
                 if (!is_array($item)) {
91 93
                     call_user_func_array(array($this, 'join'), $table);
92 94
                     break;
93
-                } else {
95
+                }
96
+                else {
94 97
                     $this->join($item);
95 98
                 }
96 99
             }
97
-        } else {
100
+        }
101
+        else {
98 102
             $this->join[] = [$table, $where, $type, $alias];
99 103
         }
100 104
     }
@@ -102,7 +106,8 @@  discard block
 block discarded – undo
102 106
     public function where($where = '', $value = '', $operation = false, $concatenation = 'AND') {
103 107
         if (!is_array($where)) {
104 108
             $this->where[] = [$where, $value, $operation, $concatenation];
105
-        } else {
109
+        }
110
+        else {
106 111
             $this->where[] = $where;
107 112
         }
108 113
     }
@@ -110,7 +115,8 @@  discard block
 block discarded – undo
110 115
     public function having($where = '', $value = '', $operation = false, $concatenation = 'AND') {
111 116
         if (!is_array($where)) {
112 117
             $this->having[] = [$where, $value, $operation, $concatenation];
113
-        } else {
118
+        }
119
+        else {
114 120
             $this->having[] = $where;
115 121
         }
116 122
     }
@@ -124,13 +130,17 @@  discard block
 block discarded – undo
124 130
 
125 131
         if (!is_array($order)) {
126 132
             $this->order[] = "{$order} {$type}";
127
-        } else {
128
-            foreach ($order as $item)
129
-                if (!is_array($item)) {
133
+        }
134
+        else {
135
+            foreach ($order as $item) {
136
+                            if (!is_array($item)) {
130 137
                     call_user_func_array(array($this, 'order'), $order);
138
+            }
131 139
                     break;
132
-                } else
133
-                    $this->order($item);
140
+                }
141
+                else {
142
+                                    $this->order($item);
143
+                }
134 144
         }
135 145
     }
136 146
 
@@ -138,8 +148,9 @@  discard block
 block discarded – undo
138 148
         $start = intval($start);
139 149
         $len = intval($len);
140 150
         $this->limit = "LIMIT {$start}";
141
-        if ($len !== 0)
142
-            $this->limit .= ",{$len}";
151
+        if ($len !== 0) {
152
+                    $this->limit .= ",{$len}";
153
+        }
143 154
     }
144 155
 
145 156
     public function buildJoin($table, $where = false, $type = 'LEFT', $alias = '') {
@@ -149,12 +160,15 @@  discard block
 block discarded – undo
149 160
             foreach ($joins as $joinAr) {
150 161
                 $join .= call_user_func_array([$this, 'buildJoin'], $joinAr);
151 162
             }
152
-        } else {
163
+        }
164
+        else {
153 165
             $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}";
154
-            if ($alias)
155
-                $join .= " AS `{$alias}`";
156
-            if ($where)
157
-                $join .= " ON {$where}";
166
+            if ($alias) {
167
+                            $join .= " AS `{$alias}`";
168
+            }
169
+            if ($where) {
170
+                            $join .= " ON {$where}";
171
+            }
158 172
         }
159 173
         return $join;
160 174
     }
@@ -173,13 +187,16 @@  discard block
 block discarded – undo
173 187
                 $operation = '=';
174 188
             }
175 189
 
176
-            if ($concatenation === false)
177
-                $concatenation = 'AND';
178
-            elseif ($concatenation === true)
179
-                $concatenation = '';
190
+            if ($concatenation === false) {
191
+                            $concatenation = 'AND';
192
+            }
193
+            elseif ($concatenation === true) {
194
+                            $concatenation = '';
195
+            }
180 196
 
181
-            if ($this->whereString == NULL)
182
-                $this->whereString = ' WHERE ';
197
+            if ($this->whereString == NULL) {
198
+                            $this->whereString = ' WHERE ';
199
+            }
183 200
 
184 201
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
185 202
                 if (is_array($value)) {
@@ -190,25 +207,31 @@  discard block
 block discarded – undo
190 207
                         }
191 208
                         if (is_string($item)) {
192 209
                             $newValue .='"' . $item . '"';
193
-                        } else {
210
+                        }
211
+                        else {
194 212
                             $newValue .=$item;
195 213
                         }
196 214
                     }
197 215
                     $value = '(' . $newValue . ')';
198
-                } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
216
+                }
217
+                elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
199 218
                     $value = "({$value})";
200
-                } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
219
+                }
220
+                elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
201 221
                     $value = "\"{$value}\"";
202 222
                 }
203
-            } elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
223
+            }
224
+            elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
204 225
                 $this->params[] = $value;
205 226
                 $value = "?";
206 227
             }
207 228
 
208
-            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ')
209
-                $this->whereString .= " {$where} {$operation} {$value} ";
210
-            else
211
-                $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
229
+            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') {
230
+                            $this->whereString .= " {$where} {$operation} {$value} ";
231
+            }
232
+            else {
233
+                            $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
234
+            }
212 235
         }
213 236
         else {
214 237
             $i = -1;
@@ -218,23 +241,27 @@  discard block
 block discarded – undo
218 241
                     if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(' && $this->whereString != 'WHERE ') {
219 242
                         if (!isset($item[3])) {
220 243
                             $concatenation = 'AND';
221
-                        } else {
244
+                        }
245
+                        else {
222 246
                             $concatenation = $item[3];
223 247
                         }
224 248
 
225 249
                         $this->whereString .= "{$concatenation} ";
226 250
                     }
227 251
 
228
-                    if ($this->whereString != NULL)
229
-                        $this->whereString .= '(';
230
-                    else
231
-                        $this->whereString = 'WHERE (';
252
+                    if ($this->whereString != NULL) {
253
+                                            $this->whereString .= '(';
254
+                    }
255
+                    else {
256
+                                            $this->whereString = 'WHERE (';
257
+                    }
232 258
                 }
233 259
 
234 260
                 if (!is_array($item)) {
235 261
                     call_user_func_array(array($this, 'buildWhere'), $where);
236 262
                     break;
237
-                } else {
263
+                }
264
+                else {
238 265
                     $this->buildWhere($item);
239 266
                 }
240 267
                 if (!isset($where[$i + 1]) && isset($where[$i - 1])) {
@@ -257,13 +284,16 @@  discard block
 block discarded – undo
257 284
             if (empty($operation)) {
258 285
                 $operation = '=';
259 286
             }
260
-            if ($concatenation === false)
261
-                $concatenation = 'AND';
262
-            elseif ($concatenation === true)
263
-                $concatenation = '';
287
+            if ($concatenation === false) {
288
+                            $concatenation = 'AND';
289
+            }
290
+            elseif ($concatenation === true) {
291
+                            $concatenation = '';
292
+            }
264 293
 
265
-            if ($this->havingString == NULL)
266
-                $this->havingString = ' HAVING ';
294
+            if ($this->havingString == NULL) {
295
+                            $this->havingString = ' HAVING ';
296
+            }
267 297
 
268 298
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
269 299
                 if (is_array($value)) {
@@ -274,25 +304,31 @@  discard block
 block discarded – undo
274 304
                         }
275 305
                         if (is_string($item)) {
276 306
                             $newValue .='"' . $item . '"';
277
-                        } else {
307
+                        }
308
+                        else {
278 309
                             $newValue .=$item;
279 310
                         }
280 311
                     }
281 312
                     $value = '(' . $newValue . ')';
282
-                } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
313
+                }
314
+                elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
283 315
                     $value = "({$value})";
284
-                } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
316
+                }
317
+                elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
285 318
                     $value = "\"{$value}\"";
286 319
                 }
287
-            } elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
320
+            }
321
+            elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
288 322
                 $this->params[] = $value;
289 323
                 $value = "?";
290 324
             }
291 325
 
292
-            if (substr($this->havingString, -1, 1) == '(' || substr($this->havingString, -2, 2) == 'E ')
293
-                $this->havingString .= " {$where} {$operation} {$value} ";
294
-            else
295
-                $this->havingString .= "{$concatenation} {$where} {$operation} {$value} ";
326
+            if (substr($this->havingString, -1, 1) == '(' || substr($this->havingString, -2, 2) == 'E ') {
327
+                            $this->havingString .= " {$where} {$operation} {$value} ";
328
+            }
329
+            else {
330
+                            $this->havingString .= "{$concatenation} {$where} {$operation} {$value} ";
331
+            }
296 332
         }
297 333
         else {
298 334
             $i = -1;
@@ -302,23 +338,27 @@  discard block
 block discarded – undo
302 338
                     if ($this->havingString != NULL && substr($this->havingString, -1, 1) != '(' && $this->havingString != 'HAVING ') {
303 339
                         if (!isset($item[3])) {
304 340
                             $concatenation = 'AND';
305
-                        } else {
341
+                        }
342
+                        else {
306 343
                             $concatenation = $item[3];
307 344
                         }
308 345
 
309 346
                         $this->havingString .= "{$concatenation} ";
310 347
                     }
311 348
 
312
-                    if ($this->havingString != NULL)
313
-                        $this->havingString .= '(';
314
-                    else
315
-                        $this->havingString = 'HAVING (';
349
+                    if ($this->havingString != NULL) {
350
+                                            $this->havingString .= '(';
351
+                    }
352
+                    else {
353
+                                            $this->havingString = 'HAVING (';
354
+                    }
316 355
                 }
317 356
 
318 357
                 if (!is_array($item)) {
319 358
                     call_user_func_array(array($this, 'buildHaving'), $where);
320 359
                     break;
321
-                } else {
360
+                }
361
+                else {
322 362
                     $this->buildHaving($item);
323 363
                 }
324 364
                 if (!isset($where[$i + 1]) && isset($where[$i - 1])) {
@@ -376,7 +416,8 @@  discard block
 block discarded – undo
376 416
                     if (!in_array($item, array('CURRENT_TIMESTAMP'))) {
377 417
                         $this->params[] = $item;
378 418
                         $updates[] = "`{$key}` = ?";
379
-                    } else {
419
+                    }
420
+                    else {
380 421
                         $updates[] = "`{$key}` = {$item}";
381 422
                     }
382 423
                 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public $having = [];
20 20
     public $havingString = '';
21 21
     public $cols = [];
22
-    public $order = NULL;
22
+    public $order = null;
23 23
     public $join = [];
24 24
     public $group = [];
25 25
     public $limit = '';
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     public function limit($start = 0, $len = 0) {
138 138
         $start = intval($start);
139 139
         $len = intval($len);
140
-        $this->limit = "LIMIT {$start}";
140
+        $this->limit = "limit {$start}";
141 141
         if ($len !== 0)
142 142
             $this->limit .= ",{$len}";
143 143
     }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             elseif ($concatenation === true)
179 179
                 $concatenation = '';
180 180
 
181
-            if ($this->whereString == NULL)
181
+            if ($this->whereString == null)
182 182
                 $this->whereString = ' WHERE ';
183 183
 
184 184
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             while (isset($where[++$i])) {
216 216
                 $item = $where[$i];
217 217
                 if (isset($where[$i + 1]) && !isset($where[$i - 1]) && is_array($where[$i])) {
218
-                    if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(' && $this->whereString != 'WHERE ') {
218
+                    if ($this->whereString != null && substr($this->whereString, -1, 1) != '(' && $this->whereString != 'WHERE ') {
219 219
                         if (!isset($item[3])) {
220 220
                             $concatenation = 'AND';
221 221
                         } else {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                         $this->whereString .= "{$concatenation} ";
226 226
                     }
227 227
 
228
-                    if ($this->whereString != NULL)
228
+                    if ($this->whereString != null)
229 229
                         $this->whereString .= '(';
230 230
                     else
231 231
                         $this->whereString = 'WHERE (';
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             elseif ($concatenation === true)
263 263
                 $concatenation = '';
264 264
 
265
-            if ($this->havingString == NULL)
265
+            if ($this->havingString == null)
266 266
                 $this->havingString = ' HAVING ';
267 267
 
268 268
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             while (isset($where[++$i])) {
300 300
                 $item = $where[$i];
301 301
                 if (isset($where[$i + 1]) && !isset($where[$i - 1]) && is_array($where[$i])) {
302
-                    if ($this->havingString != NULL && substr($this->havingString, -1, 1) != '(' && $this->havingString != 'HAVING ') {
302
+                    if ($this->havingString != null && substr($this->havingString, -1, 1) != '(' && $this->havingString != 'HAVING ') {
303 303
                         if (!isset($item[3])) {
304 304
                             $concatenation = 'AND';
305 305
                         } else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                         $this->havingString .= "{$concatenation} ";
310 310
                     }
311 311
 
312
-                    if ($this->havingString != NULL)
312
+                    if ($this->havingString != null)
313 313
                         $this->havingString .= '(';
314 314
                     else
315 315
                         $this->havingString = 'HAVING (';
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     }
36 36
 }
37 37
 
38
-require_once( INJI_SYSTEM_DIR . '/init.php' );
38
+require_once(INJI_SYSTEM_DIR . '/init.php');
39 39
 /**
40 40
  * System error messages
41 41
  */
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@
 block discarded – undo
43 43
 function INJI_SYSTEM_ERROR($msg, $fatal = false) {
44 44
     if ($fatal) {
45 45
         exit("<div style = 'text-align:center;font-size:20px;margin-top:25%;'>{$msg}</div>");
46
-    } else {
46
+    }
47
+    else {
47 48
         echo "<div style = 'text-align:center;font-size:20px;margin-top:25%;'>{$msg}</div>";
48 49
     }
49 50
 }
Please login to merge, or discard this patch.
system/Inji/Log.php 2 patches
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   +23 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,9 +19,11 @@  discard block
 block discarded – undo
19 19
     public function __construct() {
20 20
         if (!empty($_SERVER['REQUEST_TIME_FLOAT'])) {
21 21
             $this->startTime = $_SERVER['REQUEST_TIME_FLOAT'];
22
-        } elseif (!empty($_SERVER['REQUEST_TIME'])) {
22
+        }
23
+        elseif (!empty($_SERVER['REQUEST_TIME'])) {
23 24
             $this->startTime = $_SERVER['REQUEST_TIME'];
24
-        } else {
25
+        }
26
+        else {
25 27
             $this->startTime = time();
26 28
         }
27 29
         $this->log[] = array('name' => 'System init', 'start' => $this->startTime, 'end' => microtime(true));
@@ -39,7 +41,8 @@  discard block
 block discarded – undo
39 41
         if ($this->run) {
40 42
             if ($key === false) {
41 43
                 $this->log[$this->lastLog]['end'] = microtime(true);
42
-            } else {
44
+            }
45
+            else {
43 46
                 $this->log[$key]['end'] = microtime(true);
44 47
             }
45 48
         }
@@ -70,11 +73,14 @@  discard block
 block discarded – undo
70 73
         foreach ($this->log as $log) {
71 74
             if (!empty($log['status'])) {
72 75
                 echo "<tr class = '{$log['status']}'><td>{$log['name']}</td><td>{$log['status']}</td></tr>";
73
-            } else {
74
-                if (empty($log['end']))
75
-                    $log['end'] = microtime(true);
76
-                if (empty($log['start']))
77
-                    $log['start'] = microtime(true);
76
+            }
77
+            else {
78
+                if (empty($log['end'])) {
79
+                                    $log['end'] = microtime(true);
80
+                }
81
+                if (empty($log['start'])) {
82
+                                    $log['start'] = microtime(true);
83
+                }
78 84
                 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>";
79 85
             }
80 86
         }
@@ -84,12 +90,15 @@  discard block
 block discarded – undo
84 90
 
85 91
     public function convertSize($size) {
86 92
 
87
-        if ($size < 1024)
88
-            return $size . "B";
89
-        elseif ($size < 1048576)
90
-            return round($size / 1024, 2) . "KB";
91
-        else
92
-            return round($size / 1048576, 2) . "MB";
93
+        if ($size < 1024) {
94
+                    return $size . "B";
95
+        }
96
+        elseif ($size < 1048576) {
97
+                    return round($size / 1024, 2) . "KB";
98
+        }
99
+        else {
100
+                    return round($size / 1048576, 2) . "MB";
101
+        }
93 102
     }
94 103
 
95 104
     public function __destruct() {
Please login to merge, or discard this patch.
system/Inji/Model.php 4 patches
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.
Doc Comments   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -437,6 +437,9 @@  discard block
 block discarded – undo
437 437
         }
438 438
     }
439 439
 
440
+    /**
441
+     * @param boolean $new
442
+     */
440 443
     public function logChanges($new) {
441 444
         if (!App::$cur->db->connect || !App::$cur->dashboard) {
442 445
             return false;
@@ -539,7 +542,7 @@  discard block
 block discarded – undo
539 542
     /**
540 543
      * Information extractor for col relations path
541 544
      * 
542
-     * @param string|array $info
545
+     * @param string $info
543 546
      * @return array
544 547
      */
545 548
     public static function parseColRecursion($info) {
@@ -625,7 +628,7 @@  discard block
 block discarded – undo
625 628
      * Generate params string for col by name
626 629
      * 
627 630
      * @param string $colName
628
-     * @return boolean|string
631
+     * @return false|string
629 632
      */
630 633
     public static function genColParams($colName) {
631 634
         if (empty(static::$cols[$colName]) || static::$storage['type'] == 'moduleConfig') {
@@ -780,7 +783,7 @@  discard block
 block discarded – undo
780 783
     /**
781 784
      * return relations list
782 785
      * 
783
-     * @return array
786
+     * @return string
784 787
      */
785 788
     public static function relations() {
786 789
         return [];
@@ -1303,7 +1306,7 @@  discard block
 block discarded – undo
1303 1306
      * 
1304 1307
      * @param array $params
1305 1308
      * @param array $where
1306
-     * @return boolean
1309
+     * @return false|null
1307 1310
      */
1308 1311
     public static function update($params, $where = []) {
1309 1312
         static::fixPrefix($params);
Please login to merge, or discard this patch.
Braces   +159 added lines, -86 removed lines patch added patch discarded remove patch
@@ -151,10 +151,12 @@  discard block
 block discarded – undo
151 151
             }
152 152
             if (strpos($valuePath, ':')) {
153 153
                 return self::getColValue($object->$rel, $param, $convert, $manageHref);
154
-            } else {
154
+            }
155
+            else {
155 156
                 return $convert ? Model::resloveTypeValue($object->$rel, $param, $manageHref) : $object->$rel->$param;
156 157
             }
157
-        } else {
158
+        }
159
+        else {
158 160
             return $convert ? Model::resloveTypeValue($object, $valuePath, $manageHref) : $object->$valuePath;
159 161
         }
160 162
     }
@@ -193,7 +195,8 @@  discard block
 block discarded – undo
193 195
                     case 'method':
194 196
                         if (!empty($colInfo['colParams']['params'])) {
195 197
                             $values = call_user_func_array([App::$cur->$colInfo['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']);
196
-                        } else {
198
+                        }
199
+                        else {
197 200
                             $values = $colInfo['colParams']['module']->$colInfo['colParams']['method']();
198 201
                         }
199 202
                         $value = !empty($values[$item->$colName]) ? $values[$item->$colName] : 'Не задано';
@@ -210,7 +213,8 @@  discard block
 block discarded – undo
210 213
                         $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel;
211 214
                         if ($manageHref) {
212 215
                             $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано';
213
-                        } else {
216
+                        }
217
+                        else {
214 218
                             $value = $relValue ? $relValue->name() : 'Не задано';
215 219
                         }
216 220
                         break;
@@ -220,7 +224,8 @@  discard block
 block discarded – undo
220 224
                 $file = Files\File::get($item->$colName);
221 225
                 if ($file) {
222 226
                     $value = '<img src="' . $file->path . '?resize=60x120" />';
223
-                } else {
227
+                }
228
+                else {
224 229
                     $value = '<img src="/static/system/images/no-image.png?resize=60x120" />';
225 230
                 }
226 231
                 break;
@@ -228,7 +233,8 @@  discard block
 block discarded – undo
228 233
                 $file = Files\File::get($item->$colName);
229 234
                 if ($file) {
230 235
                     $value = '<a href="' . $file->path . '">' . $file->name . '.' . $file->type->ext . '</a>';
231
-                } else {
236
+                }
237
+                else {
232 238
                     $value = 'Файл не загружен';
233 239
                 }
234 240
                 break;
@@ -279,7 +285,8 @@  discard block
 block discarded – undo
279 285
                     $onclick .= 'return false;';
280 286
                     $value = "<a href ='#' onclick='{$onclick}' >{$name}</a>";
281 287
                     $value .= $content;
282
-                } else {
288
+                }
289
+                else {
283 290
                     $value = 'Местоположение не заданно';
284 291
                 }
285 292
 
@@ -299,7 +306,8 @@  discard block
 block discarded – undo
299 306
                                 $itemModel = get_class($curItem);
300 307
                                 $relation = $itemModel::getRelation($relationName);
301 308
                                 $sourceModel = $relation['model'];
302
-                            } else {
309
+                            }
310
+                            else {
303 311
                                 $relation = static::getRelation($type['relation']);
304 312
                                 $sourceModel = $relation['model'];
305 313
                             }
@@ -307,10 +315,12 @@  discard block
 block discarded – undo
307 315
                             $value = $sourceModel::get($item->$colName);
308 316
                             if ($value) {
309 317
                                 $value = $value->name();
310
-                            } else {
318
+                            }
319
+                            else {
311 320
                                 $value = $item->$colName;
312 321
                             }
313
-                        } else {
322
+                        }
323
+                        else {
314 324
                             switch ($type) {
315 325
                                 case 'map':
316 326
                                     if ($item->$colName && json_decode($item->$colName, true)) {
@@ -351,7 +361,8 @@  discard block
 block discarded – undo
351 361
                                         $onclick .= 'return false;';
352 362
                                         $value = "<a href ='#' onclick='{$onclick}' >{$name}</a>";
353 363
                                         $value .= $content;
354
-                                    } else {
364
+                                    }
365
+                                    else {
355 366
                                         $value = 'Местоположение не заданно';
356 367
                                     }
357 368
 
@@ -393,7 +404,8 @@  discard block
 block discarded – undo
393 404
             }
394 405
             if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) {
395 406
                 $array = static::colPrefix() . $array;
396
-            } else {
407
+            }
408
+            else {
397 409
                 static::checkForJoin($array, $rootModel);
398 410
             }
399 411
             return;
@@ -412,7 +424,8 @@  discard block
 block discarded – undo
412 424
                     }
413 425
                     if (is_array($array[$key])) {
414 426
                         static::fixPrefix($array[$key], 'key', $rootModel);
415
-                    } else {
427
+                    }
428
+                    else {
416 429
                         static::checkForJoin($key, $rootModel);
417 430
                     }
418 431
                 }
@@ -425,10 +438,12 @@  discard block
 block discarded – undo
425 438
                     }
426 439
                     if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) {
427 440
                         $array[0] = static::colPrefix() . $array[0];
428
-                    } else {
441
+                    }
442
+                    else {
429 443
                         static::checkForJoin($array[0], $rootModel);
430 444
                     }
431
-                } elseif (isset($array[0]) && is_array($array[0])) {
445
+                }
446
+                elseif (isset($array[0]) && is_array($array[0])) {
432 447
                     foreach ($array as &$item) {
433 448
                         static::fixPrefix($item, 'first', $rootModel);
434 449
                     }
@@ -461,7 +476,8 @@  discard block
 block discarded – undo
461 476
                 }
462 477
                 if (strlen($oldValue) + strlen($this->_params[$fullColName]) < 200) {
463 478
                     $changes_text[] = (!empty($class::$labels[$colName]) ? $class::$labels[$colName] : $colName) . ": \"{$oldValue}\" => \"{$this->$colName}\"";
464
-                } else {
479
+                }
480
+                else {
465 481
                     $changes_text[] = !empty($class::$labels[$colName]) ? $class::$labels[$colName] : $colName;
466 482
                 }
467 483
             }
@@ -480,7 +496,8 @@  discard block
 block discarded – undo
480 496
                 ]);
481 497
                 $change->save();
482 498
             }
483
-        } elseif ($new) {
499
+        }
500
+        elseif ($new) {
484 501
             $activity = new Dashboard\Activity([
485 502
                 'user_id' => \Users\User::$cur->id,
486 503
                 'module' => substr($class, 0, strpos($class, '\\')),
@@ -568,7 +585,8 @@  discard block
 block discarded – undo
568 585
                 }
569 586
                 $info = $relations[$rel]['model']::parseColRecursion($info);
570 587
             }
571
-        } else {
588
+        }
589
+        else {
572 590
             $cols = static::cols();
573 591
             if (!empty(static::$labels[$info['col']])) {
574 592
                 $info['label'] = static::$labels[$info['col']];
@@ -576,9 +594,11 @@  discard block
 block discarded – undo
576 594
 
577 595
             if (isset(static::$cols[$info['col']])) {
578 596
                 $info['colParams'] = static::$cols[$info['col']];
579
-            } elseif (isset(static::$cols[str_replace(static::colPrefix(), '', $info['col'])])) {
597
+            }
598
+            elseif (isset(static::$cols[str_replace(static::colPrefix(), '', $info['col'])])) {
580 599
                 $info['colParams'] = static::$cols[str_replace(static::colPrefix(), '', $info['col'])];
581
-            } else {
600
+            }
601
+            else {
582 602
                 $info['colParams'] = [];
583 603
             }
584 604
             if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) {
@@ -709,7 +729,8 @@  discard block
 block discarded – undo
709 729
             $tableName = static::table();
710 730
             $colPrefix = static::colPrefix();
711 731
             $indexes = static::indexes();
712
-        } else {
732
+        }
733
+        else {
713 734
             $tableName = $this->table();
714 735
             $colPrefix = $this->colPrefix();
715 736
             $indexes = $this->indexes();
@@ -855,7 +876,8 @@  discard block
 block discarded – undo
855 876
         static::$needJoin = [];
856 877
         if (is_array($param)) {
857 878
             App::$cur->db->where($param);
858
-        } else {
879
+        }
880
+        else {
859 881
             if ($col === null) {
860 882
 
861 883
                 $col = static::index();
@@ -866,7 +888,8 @@  discard block
 block discarded – undo
866 888
                     $col = static::colPrefix() . $col;
867 889
                 }
868 890
                 App::$cur->db->where($col, $param);
869
-            } else {
891
+            }
892
+            else {
870 893
                 return false;
871 894
             }
872 895
         }
@@ -898,22 +921,27 @@  discard block
 block discarded – undo
898 921
         if (!$query) {
899 922
             return [];
900 923
         }
901
-        if (!empty($options['where']))
902
-            $query->where($options['where']);
903
-        if (!empty($options['cols']))
904
-            $query->cols = $options['cols'];
924
+        if (!empty($options['where'])) {
925
+                    $query->where($options['where']);
926
+        }
927
+        if (!empty($options['cols'])) {
928
+                    $query->cols = $options['cols'];
929
+        }
905 930
         if (!empty($options['group'])) {
906 931
             $query->group($options['group']);
907 932
         }
908 933
         if (!empty($options['having'])) {
909 934
             $query->having($options['having']);
910 935
         }
911
-        if (!empty($options['order']))
912
-            $query->order($options['order']);
913
-        if (!empty($options['join']))
914
-            $query->join($options['join']);
915
-        if (!empty($options['distinct']))
916
-            $query->distinct = $options['distinct'];
936
+        if (!empty($options['order'])) {
937
+                    $query->order($options['order']);
938
+        }
939
+        if (!empty($options['join'])) {
940
+                    $query->join($options['join']);
941
+        }
942
+        if (!empty($options['distinct'])) {
943
+                    $query->distinct = $options['distinct'];
944
+        }
917 945
 
918 946
         foreach (static::$relJoins as $join) {
919 947
             $query->join($join[0], $join[1]);
@@ -939,13 +967,15 @@  discard block
 block discarded – undo
939 967
         }
940 968
         static::$needJoin = [];
941 969
 
942
-        if (!empty($options['limit']))
943
-            $limit = (int) $options['limit'];
970
+        if (!empty($options['limit'])) {
971
+                    $limit = (int) $options['limit'];
972
+        }
944 973
         else {
945 974
             $limit = 0;
946 975
         }
947
-        if (!empty($options['start']))
948
-            $start = (int) $options['start'];
976
+        if (!empty($options['start'])) {
977
+                    $start = (int) $options['start'];
978
+        }
949 979
         else {
950 980
             $start = 0;
951 981
         }
@@ -954,7 +984,8 @@  discard block
 block discarded – undo
954 984
         }
955 985
         if (isset($options['key'])) {
956 986
             $key = $options['key'];
957
-        } else {
987
+        }
988
+        else {
958 989
             $key = static::index();
959 990
         }
960 991
         try {
@@ -966,7 +997,8 @@  discard block
 block discarded – undo
966 997
             if ($exc->getCode() == '42S02') {
967 998
                 static::createTable();
968 999
                 $result = $query->query($queryArr);
969
-            } else {
1000
+            }
1001
+            else {
970 1002
                 throw $exc;
971 1003
             }
972 1004
         }
@@ -1029,7 +1061,8 @@  discard block
 block discarded – undo
1029 1061
         $classPath = explode('\\', get_called_class());
1030 1062
         if (!empty(static::$storage['options']['share'])) {
1031 1063
             $moduleConfig = Config::share($classPath[0]);
1032
-        } else {
1064
+        }
1065
+        else {
1033 1066
             $moduleConfig = Config::module($classPath[0], strpos(static::$storage['type'], 'system') !== false);
1034 1067
         }
1035 1068
         $appType = App::$cur->type;
@@ -1038,7 +1071,8 @@  discard block
 block discarded – undo
1038 1071
                 $appType = $options['appType'];
1039 1072
             }
1040 1073
             $storage = !empty($moduleConfig['storage'][$appType]) ? $moduleConfig['storage'][$appType] : [];
1041
-        } else {
1074
+        }
1075
+        else {
1042 1076
             $storage = !empty($moduleConfig['storage']) ? $moduleConfig['storage'] : [];
1043 1077
         }
1044 1078
         if (!empty($storage[$classPath[1]])) {
@@ -1070,17 +1104,20 @@  discard block
 block discarded – undo
1070 1104
         $classPath = explode('\\', get_called_class());
1071 1105
         if (!empty(static::$storage['options']['share'])) {
1072 1106
             $moduleConfig = Config::share($classPath[0]);
1073
-        } else {
1107
+        }
1108
+        else {
1074 1109
             $moduleConfig = Config::module($classPath[0], strpos(static::$storage['type'], 'system') !== false);
1075 1110
         }
1076 1111
         if (!empty($moduleConfig['storage']['appTypeSplit'])) {
1077 1112
             if (empty($options['appType'])) {
1078 1113
                 $appType = App::$cur->type;
1079
-            } else {
1114
+            }
1115
+            else {
1080 1116
                 $appType = $options['appType'];
1081 1117
             }
1082 1118
             $storage = !empty($moduleConfig['storage'][$appType]) ? $moduleConfig['storage'][$appType] : [];
1083
-        } else {
1119
+        }
1120
+        else {
1084 1121
             $storage = !empty($moduleConfig['storage']) ? $moduleConfig['storage'] : [];
1085 1122
         }
1086 1123
         if (!empty($storage[$classPath[1]])) {
@@ -1088,7 +1125,8 @@  discard block
 block discarded – undo
1088 1125
             $class = get_called_class();
1089 1126
             if (isset($options['key'])) {
1090 1127
                 $arrayKey = $options['key'];
1091
-            } else {
1128
+            }
1129
+            else {
1092 1130
                 $arrayKey = static::index();
1093 1131
             }
1094 1132
             foreach ($storage[$classPath[1]] as $key => $item) {
@@ -1101,7 +1139,8 @@  discard block
 block discarded – undo
1101 1139
                 usort($items, function($a, $b) use($options) {
1102 1140
                     if ($a->{$options['order'][0]} > $b->{$options['order'][0]} && $options['order'][1] = 'asc') {
1103 1141
                         return 1;
1104
-                    } elseif ($a->{$options['order'][0]} < $b->{$options['order'][0]} && $options['order'][1] = 'asc') {
1142
+                    }
1143
+                    elseif ($a->{$options['order'][0]} < $b->{$options['order'][0]} && $options['order'][1] = 'asc') {
1105 1144
                         return -1;
1106 1145
                     }
1107 1146
                     return 0;
@@ -1131,12 +1170,14 @@  discard block
 block discarded – undo
1131 1170
         $count = 0;
1132 1171
         if (empty($options['appType'])) {
1133 1172
             $appType = App::$cur->type;
1134
-        } else {
1173
+        }
1174
+        else {
1135 1175
             $appType = $options['appType'];
1136 1176
         }
1137 1177
         if (!empty(static::$storage['options']['share'])) {
1138 1178
             $moduleConfig = Config::share($classPath[0]);
1139
-        } else {
1179
+        }
1180
+        else {
1140 1181
             $moduleConfig = Config::module($classPath[0], strpos(static::$storage['type'], 'system') !== false);
1141 1182
         }
1142 1183
         if (!empty($moduleConfig['storage'][$appType][$classPath[1]])) {
@@ -1149,7 +1190,8 @@  discard block
 block discarded – undo
1149 1190
                     if (Model::checkWhere($item, $options['where'])) {
1150 1191
                         $count++;
1151 1192
                     }
1152
-                } else {
1193
+                }
1194
+                else {
1153 1195
                     $count++;
1154 1196
                 }
1155 1197
             }
@@ -1185,7 +1227,8 @@  discard block
 block discarded – undo
1185 1227
                 }
1186 1228
 
1187 1229
                 return $result;
1188
-            } else {
1230
+            }
1231
+            else {
1189 1232
                 return forward_static_call_array(['Model', 'checkWhere'], array_merge([$item], $where));
1190 1233
             }
1191 1234
         }
@@ -1221,20 +1264,24 @@  discard block
 block discarded – undo
1221 1264
         if (!empty($options['group'])) {
1222 1265
             static::fixPrefix($options['group'], 'first');
1223 1266
         }
1224
-        if (!empty($options['where']))
1225
-            $query->where($options['where']);
1226
-        if (!empty($options['join']))
1227
-            $query->join($options['join']);
1267
+        if (!empty($options['where'])) {
1268
+                    $query->where($options['where']);
1269
+        }
1270
+        if (!empty($options['join'])) {
1271
+                    $query->join($options['join']);
1272
+        }
1228 1273
         if (!empty($options['order'])) {
1229 1274
             $query->order($options['order']);
1230 1275
         }
1231
-        if (!empty($options['limit']))
1232
-            $limit = (int) $options['limit'];
1276
+        if (!empty($options['limit'])) {
1277
+                    $limit = (int) $options['limit'];
1278
+        }
1233 1279
         else {
1234 1280
             $limit = 0;
1235 1281
         }
1236
-        if (!empty($options['start']))
1237
-            $start = (int) $options['start'];
1282
+        if (!empty($options['start'])) {
1283
+                    $start = (int) $options['start'];
1284
+        }
1238 1285
         else {
1239 1286
             $start = 0;
1240 1287
         }
@@ -1270,10 +1317,12 @@  discard block
 block discarded – undo
1270 1317
         if (!empty($options['distinct'])) {
1271 1318
             if (is_bool($options['distinct'])) {
1272 1319
                 $cols .= 'DISTINCT *';
1273
-            } else {
1320
+            }
1321
+            else {
1274 1322
                 $cols .= "DISTINCT {$options['distinct']}";
1275 1323
             }
1276
-        } else {
1324
+        }
1325
+        else {
1277 1326
             $cols .= '*';
1278 1327
         }
1279 1328
         $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : '');
@@ -1292,7 +1341,8 @@  discard block
 block discarded – undo
1292 1341
         if (!empty($options['group'])) {
1293 1342
             $count = $result->getArray();
1294 1343
             return $count;
1295
-        } else {
1344
+        }
1345
+        else {
1296 1346
             $count = $result->fetch();
1297 1347
             return $count['count'];
1298 1348
         }
@@ -1312,8 +1362,9 @@  discard block
 block discarded – undo
1312 1362
 
1313 1363
         $values = [];
1314 1364
         foreach ($cols as $col => $param) {
1315
-            if (isset($params[$col]))
1316
-                $values[$col] = $params[$col];
1365
+            if (isset($params[$col])) {
1366
+                            $values[$col] = $params[$col];
1367
+            }
1317 1368
         }
1318 1369
         if (empty($values)) {
1319 1370
             return false;
@@ -1358,18 +1409,21 @@  discard block
 block discarded – undo
1358 1409
 
1359 1410
         if (!empty(static::$storage['options']['share'])) {
1360 1411
             $moduleConfig = Config::share($classPath[0]);
1361
-        } else {
1412
+        }
1413
+        else {
1362 1414
             $moduleConfig = Config::module($classPath[0], strpos(static::$storage['type'], 'system') !== false);
1363 1415
         }
1364 1416
 
1365 1417
         if (!empty($moduleConfig['storage']['appTypeSplit'])) {
1366 1418
             if (empty($options['appType'])) {
1367 1419
                 $appType = App::$cur->type;
1368
-            } else {
1420
+            }
1421
+            else {
1369 1422
                 $appType = $options['appType'];
1370 1423
             }
1371 1424
             $storage = !empty($moduleConfig['storage'][$appType]) ? $moduleConfig['storage'][$appType] : [];
1372
-        } else {
1425
+        }
1426
+        else {
1373 1427
             $storage = !empty($moduleConfig['storage']) ? $moduleConfig['storage'] : [];
1374 1428
         }
1375 1429
         if (empty($storage[$classPath[1]])) {
@@ -1382,7 +1436,8 @@  discard block
 block discarded – undo
1382 1436
                     break;
1383 1437
                 }
1384 1438
             }
1385
-        } else {
1439
+        }
1440
+        else {
1386 1441
             $id = !empty($storage['scheme'][$classPath[1]]['ai']) ? $storage['scheme'][$classPath[1]]['ai'] : 1;
1387 1442
             $this->$col = $id;
1388 1443
             $storage['scheme'][$classPath[1]]['ai'] = $id + 1;
@@ -1390,12 +1445,14 @@  discard block
 block discarded – undo
1390 1445
         }
1391 1446
         if (!empty($moduleConfig['storage']['appTypeSplit'])) {
1392 1447
             $moduleConfig['storage'][$appType] = $storage;
1393
-        } else {
1448
+        }
1449
+        else {
1394 1450
             $moduleConfig['storage'] = $storage;
1395 1451
         }
1396 1452
         if (empty(static::$storage['options']['share'])) {
1397 1453
             Config::save('module', $moduleConfig, $classPath[0]);
1398
-        } else {
1454
+        }
1455
+        else {
1399 1456
             Config::save('share', $moduleConfig, $classPath[0]);
1400 1457
         }
1401 1458
         return true;
@@ -1442,7 +1499,8 @@  discard block
 block discarded – undo
1442 1499
         if ($catalog && $catalogParent) {
1443 1500
             if ($catalogParent->tree_path) {
1444 1501
                 return $catalogParent->tree_path . $catalogParent->id . '/';
1445
-            } else {
1502
+            }
1503
+            else {
1446 1504
                 return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/';
1447 1505
             }
1448 1506
         }
@@ -1458,7 +1516,8 @@  discard block
 block discarded – undo
1458 1516
         $category = $categoryModel::get($this->{$categoryModel::index()});
1459 1517
         if ($category) {
1460 1518
             $this->tree_path = $category->tree_path . $category->pk() . '/';
1461
-        } else {
1519
+        }
1520
+        else {
1462 1521
             $this->tree_path = '/';
1463 1522
         }
1464 1523
     }
@@ -1507,11 +1566,13 @@  discard block
 block discarded – undo
1507 1566
             if ($this->get($this->_params[$this->index()])) {
1508 1567
                 App::$cur->db->where($this->index(), $this->_params[$this->index()]);
1509 1568
                 App::$cur->db->update($this->table(), $values);
1510
-            } else {
1569
+            }
1570
+            else {
1511 1571
 
1512 1572
                 $this->_params[$this->index()] = App::$cur->db->insert($this->table(), $values);
1513 1573
             }
1514
-        } else {
1574
+        }
1575
+        else {
1515 1576
             $new = true;
1516 1577
             $this->_params[$this->index()] = App::$cur->db->insert($this->table(), $values);
1517 1578
         }
@@ -1561,18 +1622,21 @@  discard block
 block discarded – undo
1561 1622
         $classPath = explode('\\', get_called_class());
1562 1623
         if (!empty(static::$storage['options']['share'])) {
1563 1624
             $moduleConfig = Config::share($classPath[0]);
1564
-        } else {
1625
+        }
1626
+        else {
1565 1627
             $moduleConfig = Config::module($classPath[0], strpos(static::$storage['type'], 'system') !== false);
1566 1628
         }
1567 1629
 
1568 1630
         if (!empty($moduleConfig['storage']['appTypeSplit'])) {
1569 1631
             if (empty($options['appType'])) {
1570 1632
                 $appType = App::$cur->type;
1571
-            } else {
1633
+            }
1634
+            else {
1572 1635
                 $appType = $options['appType'];
1573 1636
             }
1574 1637
             $storage = !empty($moduleConfig['storage'][$appType]) ? $moduleConfig['storage'][$appType] : [];
1575
-        } else {
1638
+        }
1639
+        else {
1576 1640
             $storage = !empty($moduleConfig['storage']) ? $moduleConfig['storage'] : [];
1577 1641
         }
1578 1642
         if (empty($storage[$classPath[1]])) {
@@ -1587,12 +1651,14 @@  discard block
 block discarded – undo
1587 1651
         }
1588 1652
         if (!empty($moduleConfig['storage']['appTypeSplit'])) {
1589 1653
             $moduleConfig['storage'][$appType] = $storage;
1590
-        } else {
1654
+        }
1655
+        else {
1591 1656
             $moduleConfig['storage'] = $storage;
1592 1657
         }
1593 1658
         if (empty(static::$storage['options']['share'])) {
1594 1659
             Config::save('module', $moduleConfig, $classPath[0]);
1595
-        } else {
1660
+        }
1661
+        else {
1596 1662
             Config::save('share', $moduleConfig, $classPath[0]);
1597 1663
         }
1598 1664
         return true;
@@ -1650,8 +1716,9 @@  discard block
 block discarded – undo
1650 1716
     public static function findRelation($col) {
1651 1717
 
1652 1718
         foreach (static::relations() as $relName => $rel) {
1653
-            if ($rel['col'] == $col)
1654
-                return $relName;
1719
+            if ($rel['col'] == $col) {
1720
+                            return $relName;
1721
+            }
1655 1722
         }
1656 1723
         return NULL;
1657 1724
     }
@@ -1706,7 +1773,8 @@  discard block
 block discarded – undo
1706 1773
         if ($relation) {
1707 1774
             if (!isset($relation['type'])) {
1708 1775
                 $type = 'to';
1709
-            } else {
1776
+            }
1777
+            else {
1710 1778
                 $type = $relation['type'];
1711 1779
             }
1712 1780
             $getCol = null;
@@ -1722,7 +1790,8 @@  discard block
 block discarded – undo
1722 1790
                     if (empty($ids)) {
1723 1791
                         if (empty($params['count'])) {
1724 1792
                             return [];
1725
-                        } else {
1793
+                        }
1794
+                        else {
1726 1795
                             return 0;
1727 1796
                         }
1728 1797
                     }
@@ -1777,10 +1846,12 @@  discard block
 block discarded – undo
1777 1846
                     return $relation['model']::getCount($options);
1778 1847
                 }
1779 1848
                 return 0;
1780
-            } else {
1849
+            }
1850
+            else {
1781 1851
                 if (class_exists($relation['model'])) {
1782 1852
                     $this->loadedRelations[$name][json_encode($params)] = $relation['model']::$getType($options, $getCol, $getParams);
1783
-                } else {
1853
+                }
1854
+                else {
1784 1855
                     $this->loadedRelations[$name][json_encode($params)] = [];
1785 1856
                 }
1786 1857
             }
@@ -1851,7 +1922,8 @@  discard block
 block discarded – undo
1851 1922
         static::fixPrefix($fixedName);
1852 1923
         if (isset($this->_params[$fixedName])) {
1853 1924
             return new Value($this, $fixedName);
1854
-        } elseif (isset($this->_params[$name])) {
1925
+        }
1926
+        elseif (isset($this->_params[$name])) {
1855 1927
             return new Value($this, $name);
1856 1928
         }
1857 1929
         return call_user_func_array([$this, 'loadRelation'], array_merge([$name], $params));
@@ -1886,7 +1958,8 @@  discard block
 block discarded – undo
1886 1958
         static::fixPrefix($fixedName);
1887 1959
         if (isset($this->_params[$fixedName])) {
1888 1960
             return new Value($this, $fixedName);
1889
-        } elseif ($this->_params[$name]) {
1961
+        }
1962
+        elseif ($this->_params[$name]) {
1890 1963
             return new Value($this, $name);
1891 1964
         }
1892 1965
         return null;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
             if (is_bool($options['distinct'])) {
1272 1272
                 $cols .= 'DISTINCT *';
1273 1273
             } else {
1274
-                $cols .= "DISTINCT {$options['distinct']}";
1274
+                $cols .= "distinct {$options['distinct']}";
1275 1275
             }
1276 1276
         } else {
1277 1277
             $cols .= '*';
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
             if ($rel['col'] == $col)
1654 1654
                 return $relName;
1655 1655
         }
1656
-        return NULL;
1656
+        return null;
1657 1657
     }
1658 1658
 
1659 1659
     /**
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
                     $options = [$relation['col'], $this->pk()];
1766 1766
                     break;
1767 1767
                 default:
1768
-                    if ($this->$relation['col'] === NULL) {
1768
+                    if ($this->$relation['col'] === null) {
1769 1769
                         return null;
1770 1770
                     }
1771 1771
                     $getType = 'get';
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
             }
1787 1787
             return $this->loadedRelations[$name][json_encode($params)];
1788 1788
         }
1789
-        return NULL;
1789
+        return null;
1790 1790
     }
1791 1791
 
1792 1792
     /**
Please login to merge, or discard this patch.
system/modules/Ecommerce/Ecommerce.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@
 block discarded – undo
307 307
         if (is_array($counts)) {
308 308
             $sum = 0;
309 309
             foreach ($counts as $count) {
310
-                $sum +=$count['count'];
310
+                $sum += $count['count'];
311 311
             }
312 312
             return $sum;
313 313
         }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,7 +86,8 @@  discard block
 block discarded – undo
86 86
                         $user->{$path[0]}->{$path[1]} = $info->value;
87 87
                         $relations[$path[0]] = $path[0];
88 88
                     }
89
-                } else {
89
+                }
90
+                else {
90 91
                     if (!$user->{$field->userfield}) {
91 92
                         $user->{$field->userfield} = $info->value;
92 93
                     }
@@ -142,7 +143,8 @@  discard block
 block discarded – undo
142 143
                         $user->{$path[0]}->{$path[1]} = $info->value;
143 144
                         $relations[$path[0]] = $path[0];
144 145
                     }
145
-                } else {
146
+                }
147
+                else {
146 148
                     if (!$user->{$field->userfield}) {
147 149
                         $user->{$field->userfield} = $info->value;
148 150
                     }
@@ -262,7 +264,8 @@  discard block
 block discarded – undo
262 264
                                     $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
263 265
                                 }
264 266
                                 $qstr = 'IN (' . implode(',', $optionValueArr) . ')';
265
-                            } else {
267
+                            }
268
+                            else {
266 269
                                 $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue);
267 270
                             }
268 271
                             $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
@@ -281,7 +284,8 @@  discard block
 block discarded – undo
281 284
                                     $optionValueArr[] = \App::$cur->db->connection->pdo->quote($val);
282 285
                                 }
283 286
                                 $qstr = 'IN (' . implode(',', $optionValueArr) . ')';
284
-                            } else {
287
+                            }
288
+                            else {
285 289
                                 $qstr = '= ' . \App::$cur->db->connection->pdo->quote($optionValue);
286 290
                             }
287 291
                             $selectOptions['join'][] = [Ecommerce\Item\Offer\Param::table(), Ecommerce\Item\Offer::index() . ' = ' . 'offerOption' . $optionId . '.' . Ecommerce\Item\Offer\Param::colPrefix() . Ecommerce\Item\Offer::index() . ' AND ' .
@@ -306,7 +310,8 @@  discard block
 block discarded – undo
306 310
                 $first = false;
307 311
             }
308 312
             $selectOptions['where'][] = $where;
309
-        } elseif (!empty($options['parent'])) {
313
+        }
314
+        elseif (!empty($options['parent'])) {
310 315
             $category = \Ecommerce\Category::get($options['parent']);
311 316
             $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE'];
312 317
         }
@@ -492,7 +497,8 @@  discard block
 block discarded – undo
492 497
             foreach ($cartItem->price->offer->bonuses as $bonus) {
493 498
                 if ($bonus->limited && $bonus->left <= 0) {
494 499
                     continue;
495
-                } elseif ($bonus->limited && $bonus->left > 0) {
500
+                }
501
+                elseif ($bonus->limited && $bonus->left > 0) {
496 502
                     $bonus->left -= 1;
497 503
                     $bonus->save();
498 504
                 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@
 block discarded – undo
223 223
         ];
224 224
 
225 225
         $selectOptions['where'][] = [
226
-            [Ecommerce\Item\Offer\Price\Type::index(), NULL, 'is'],
226
+            [Ecommerce\Item\Offer\Price\Type::index(), null, 'is'],
227 227
             [
228 228
                 [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '', '=', 'OR'],
229 229
                 [Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles', '%|' . \Users\User::$cur->role_id . '|%', 'LIKE', 'OR'],
Please login to merge, or discard this patch.
system/modules/Ecommerce/appControllers/CartController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -268,7 +268,7 @@
 block discarded – undo
268 268
             $result->send();
269 269
         }
270 270
 
271
-        $item->sales ++;
271
+        $item->sales++;
272 272
         $item->save();
273 273
 
274 274
         if (empty($_GET['count']))
Please login to merge, or discard this patch.
Braces   +20 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,10 +22,12 @@  discard block
 block discarded – undo
22 22
                     $user_id = $this->Users->registration($_POST, true);
23 23
                     if (!$user_id) {
24 24
                         $error = true;
25
-                    } else {
25
+                    }
26
+                    else {
26 27
                         $user = Users\User::get($user_id);
27 28
                     }
28
-                } else {
29
+                }
30
+                else {
29 31
                     $user = Users\User::$cur;
30 32
                 }
31 33
                 $ids = [];
@@ -69,7 +71,8 @@  discard block
 block discarded – undo
69 71
                 if ($deliverys && empty($deliverys[$_POST['delivery']])) {
70 72
                     $error = 1;
71 73
                     Msg::add('Выберите способ доставки', 'danger');
72
-                } elseif ($deliverys && !empty($deliverys[$_POST['delivery']])) {
74
+                }
75
+                elseif ($deliverys && !empty($deliverys[$_POST['delivery']])) {
73 76
                     $cart->delivery_id = $_POST['delivery'];
74 77
                     foreach ($deliverys[$cart->delivery_id]->fields as $field) {
75 78
                         if (empty($_POST['deliveryFields'][$field->id]) && $field->required) {
@@ -81,10 +84,12 @@  discard block
 block discarded – undo
81 84
                 if ($payTypes && (empty($_POST['payType']) || empty($payTypes[$_POST['payType']]))) {
82 85
                     $error = 1;
83 86
                     Msg::add('Выберите способ оплаты', 'danger');
84
-                } elseif ($payTypes && !empty($payTypes[$_POST['payType']])) {
87
+                }
88
+                elseif ($payTypes && !empty($payTypes[$_POST['payType']])) {
85 89
                     $payType = $payTypes[$_POST['payType']];
86 90
                     $cart->paytype_id = $payType->id;
87
-                } else {
91
+                }
92
+                else {
88 93
                     $payType = null;
89 94
                 }
90 95
                 foreach (\Ecommerce\UserAdds\Field::getList() as $field) {
@@ -98,10 +103,12 @@  discard block
 block discarded – undo
98 103
                     if (!$userCard) {
99 104
                         $error = true;
100 105
                         Msg::add('Такой карты не существует', 'danger');
101
-                    } elseif ($userCard->user_id != $user->id) {
106
+                    }
107
+                    elseif ($userCard->user_id != $user->id) {
102 108
                         $error = true;
103 109
                         Msg::add('Это не ваша карта', 'danger');
104
-                    } else {
110
+                    }
111
+                    else {
105 112
                         $cart->card_item_id = $userCard->id;
106 113
                     }
107 114
                 }
@@ -272,10 +279,12 @@  discard block
 block discarded – undo
272 279
         $item->sales ++;
273 280
         $item->save();
274 281
 
275
-        if (empty($_GET['count']))
276
-            $count = 1;
277
-        else
278
-            $count = (float) $_GET['count'];
282
+        if (empty($_GET['count'])) {
283
+                    $count = 1;
284
+        }
285
+        else {
286
+                    $count = (float) $_GET['count'];
287
+        }
279 288
 
280 289
         $cart = $this->ecommerce->getCurCart();
281 290
         $stages = Ecommerce\Cart\Stage::getList();
Please login to merge, or discard this patch.
system/modules/Ecommerce/models/Item/Offer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@
 block discarded – undo
72 72
     {
73 73
         $warehouse = Offer\Warehouse::get([['count', '0', '>'], ['item_offer_id', $this->id]]);
74 74
         if ($warehouse) {
75
-            $warehouse->count +=(float) $count;
75
+            $warehouse->count += (float) $count;
76 76
             $warehouse->save();
77 77
         } else {
78 78
             $warehouse = Offer\Warehouse::get([['item_offer_id', $this->id]]);
79 79
             if ($warehouse) {
80
-                $warehouse->count +=(float) $count;
80
+                $warehouse->count += (float) $count;
81 81
                 $warehouse->save();
82 82
             }
83 83
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@
 block discarded – undo
24 24
         $code .= '$' . $this->name . ' = ';
25 25
         if (is_array($this->value)) {
26 26
             $code .= \CodeGenerator::genArray($this->value);
27
-        } else {
27
+        }
28
+        else {
28 29
             $code .= '"' . str_replace('"', '\"', $this->value) . '";';
29 30
         }
30 31
         return $code;
Please login to merge, or discard this patch.
system/modules/Exchange1c/objects/Parser/Orders.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
         foreach ($cart->cartItems as $cartItem) {
134 134
             $isset = false;
135 135
             foreach ($cItems as $key => $cItem) {
136
-                if (!($cItem['item_id'] == $cartItem->item_id )) {
136
+                if (!($cItem['item_id'] == $cartItem->item_id)) {
137 137
                     continue;
138 138
                 }
139 139
                 $isset = true;
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@  discard block
 block discarded – undo
47 47
                 $payed = true;
48 48
                 $date = new \DateTime((string) $reqs['Дата оплаты по 1С']);
49 49
                 $cart->payed_date = $date->format('Y-m-d H:i:s');
50
-            } elseif (
50
+            }
51
+            elseif (
51 52
                     (!empty($reqs['Отменен']) && $reqs['Отменен'] == 'true') ||
52 53
                     (!empty($reqs['Дата оплаты по 1С']) && $reqs['Дата оплаты по 1С'] == 'T')) {
53 54
                 $cancel = true;
@@ -57,10 +58,12 @@  discard block
 block discarded – undo
57 58
             $cart->payed = $payed;
58 59
             if ($payed && $cart->cart_status_id == 5) {
59 60
                 
60
-            } elseif ($payed && $cart->cart_status_id == 3) {
61
+            }
62
+            elseif ($payed && $cart->cart_status_id == 3) {
61 63
                 $cart->cart_status_id = 5;
62 64
                 $cart->save();
63
-            } elseif ($cancel && $cart->cart_status_id == 3) {
65
+            }
66
+            elseif ($cancel && $cart->cart_status_id == 3) {
64 67
                 $cart->cart_status_id = 4;
65 68
             }
66 69
             if ($cart->warehouse_block && !$payed && !$cancel && !empty($reqs['Проведен']) && $reqs['Проведен'] == 'true') {
@@ -104,7 +107,8 @@  discard block
 block discarded – undo
104 107
             $itemPrice = number_format((string) $item->ЦенаЗаЕдиницу, 2, '.', '');
105 108
             if (!empty($pricesByPrice[$itemPrice])) {
106 109
                 $price = $pricesByPrice[$itemPrice];
107
-            } else {
110
+            }
111
+            else {
108 112
                 $rolePrice = 0;
109 113
                 foreach ($siteItem->prices as $priceId => $itemPrice) {
110 114
                     if (!$itemPrice->type->cipt_roles) {
Please login to merge, or discard this patch.