Completed
Push — master ( 308a3c...ebb499 )
by Alexey
08:08
created
system/Inji/Model.php 1 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.
system/Inji/Inji.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,8 @@  discard block
 block discarded – undo
51 51
             $config = Config::custom(App::$primary->path . '/config/events.php');
52 52
             $config[$eventName][$listenCode] = serialize($callback);
53 53
             Config::save(App::$primary->path . '/config/events.php', $config);
54
-        } else {
54
+        }
55
+        else {
55 56
             $this->_listeners[$eventName][$listenCode] = $callback;
56 57
         }
57 58
     }
@@ -87,9 +88,11 @@  discard block
 block discarded – undo
87 88
                 $event['calledBefore'] = $calledBefore;
88 89
                 if (is_callable($callback)) {
89 90
                     $event['eventObject'] = $callback($event);
90
-                } elseif (is_array($callback) && isset($callback['callback'])) {
91
+                }
92
+                elseif (is_array($callback) && isset($callback['callback'])) {
91 93
                     $event['eventObject'] = $callback($event, $callback);
92
-                } else {
94
+                }
95
+                else {
93 96
                     $event['eventObject'] = App::$cur->{$callback['module']}->{$callback['method']}($event, $callback);
94 97
                 }
95 98
                 $calledBefore[$iteration] = $listenCode;
Please login to merge, or discard this patch.
system/Inji/Controller.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,8 @@
 block discarded – undo
66 66
         if (!empty($this->params[0]) && method_exists($this, $this->params[0] . 'Action')) {
67 67
             $this->method = $this->params[0];
68 68
             $this->params = array_slice($this->params, 1);
69
-        } elseif (!method_exists($this, $this->method . 'Action')) {
69
+        }
70
+        elseif (!method_exists($this, $this->method . 'Action')) {
70 71
             INJI_SYSTEM_ERROR('method not found', true);
71 72
         }
72 73
         if (!$this->checkAccess()) {
Please login to merge, or discard this patch.
system/Inji/Router.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
                 }
28 28
             }
29 29
             return $result;
30
-        } else {
30
+        }
31
+        else {
31 32
             return Router::loadClass($className);
32 33
         }
33 34
     }
@@ -99,7 +100,8 @@  discard block
 block discarded – undo
99 100
             $paths[$code . '_ObjectDir'] = $folder . '/objects/' . $classPath . '/' . $classPath . '.php';
100 101
             $paths[$code . '_Model'] = $folder . '/models/' . $classPath . '.php';
101 102
             $paths[$code . '_ModelDir'] = $folder . '/models/' . $classPath . '/' . $classPath . '.php';
102
-        } else {
103
+        }
104
+        else {
103 105
             $classFile = substr($classPath, strrpos($classPath, '/') + 1);
104 106
             $classPathWithotClass = substr($classPath, 0, strrpos($classPath, '/'));
105 107
 
Please login to merge, or discard this patch.
system/objects/CodeGenerator.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,20 +12,23 @@
 block discarded – undo
12 12
 
13 13
     public static function genArray($data, $level = 0) {
14 14
         $return = '';
15
-        if ($level == 0)
16
-            $return = "[";
15
+        if ($level == 0) {
16
+                    $return = "[";
17
+        }
17 18
         foreach ($data as $key => $item) {
18 19
             $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "'{$key}' => ";
19
-            if (!is_array($item))
20
-                $return .= "'{$item}',";
20
+            if (!is_array($item)) {
21
+                            $return .= "'{$item}',";
22
+            }
21 23
             else {
22 24
                 $return .= "[";
23 25
                 $return .= rtrim(self::genArray($item, $level + 1), ',');
24 26
                 $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "],";
25 27
             }
26 28
         }
27
-        if ($level == 0)
28
-            $return = rtrim($return, ',') . "\n];";
29
+        if ($level == 0) {
30
+                    $return = rtrim($return, ',') . "\n];";
31
+        }
29 32
 
30 33
         return $return;
31 34
     }
Please login to merge, or discard this patch.
system/objects/CodeGenerator/Property.php 1 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/program/setup/modules/Main/appSetupControllers/MainController.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,10 +25,12 @@
 block discarded – undo
25 25
             }
26 26
             if (password_verify($_POST['systemPass'], $config['systemPass'])) {
27 27
                 $_SESSION['systemLogin'] = 1;
28
-            } else {
28
+            }
29
+            else {
29 30
                 if (empty($config['failTry'])) {
30 31
                     $config['failTry'] = 1;
31
-                } else {
32
+                }
33
+                else {
32 34
                     $config['failTry'] ++;
33 35
                 }
34 36
                 Config::save('share', $config);
Please login to merge, or discard this patch.
index.php 1 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.