Completed
Push — master ( f17270...776132 )
by Alexey
07:15
created
system/Inji/ComposerCmd.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -58,6 +58,10 @@
 block discarded – undo
58 58
         self::command('install', false, $path);
59 59
     }
60 60
 
61
+    /**
62
+     * @param string $command
63
+     * @param string $path
64
+     */
61 65
     static function command($command, $needOutput = true, $path = null)
62 66
     {
63 67
         include_once 'composer/vendor/autoload.php';
Please login to merge, or discard this patch.
system/Inji/Tools.php 2 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.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
      */
59 59
     static function createDir($path)
60 60
     {
61
-        if (file_exists($path))
62
-            return true;
61
+        if (file_exists($path)) {
62
+                    return true;
63
+        }
63 64
 
64 65
         $path = explode('/', $path);
65 66
         $cur = '';
@@ -101,10 +102,11 @@  discard block
 block discarded – undo
101 102
         $imagecreatefromX = "imagecreatefrom{$img_type}";
102 103
         $src_res = $imagecreatefromX($img_path);
103 104
 
104
-        if ($img_width / $max_width > $img_height / $max_height)
105
-            $separator = $img_width / $max_width;
106
-        else
107
-            $separator = $img_height / $max_height;
105
+        if ($img_width / $max_width > $img_height / $max_height) {
106
+                    $separator = $img_width / $max_width;
107
+        } else {
108
+                    $separator = $img_height / $max_height;
109
+        }
108 110
 
109 111
         if ($crop === true || $crop == 'q') {
110 112
             if ($img_width > $img_height) {
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Query.php 2 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.
Braces   +53 added lines, -42 removed lines patch added patch discarded remove patch
@@ -125,12 +125,14 @@  discard block
 block discarded – undo
125 125
         if (!is_array($order)) {
126 126
             $this->order[] = "{$order} {$type}";
127 127
         } else {
128
-            foreach ($order as $item)
129
-                if (!is_array($item)) {
128
+            foreach ($order as $item) {
129
+                            if (!is_array($item)) {
130 130
                     call_user_func_array(array($this, 'order'), $order);
131
+            }
131 132
                     break;
132
-                } else
133
-                    $this->order($item);
133
+                } else {
134
+                                    $this->order($item);
135
+                }
134 136
         }
135 137
     }
136 138
 
@@ -138,8 +140,9 @@  discard block
 block discarded – undo
138 140
         $start = intval($start);
139 141
         $len = intval($len);
140 142
         $this->limit = "LIMIT {$start}";
141
-        if ($len !== 0)
142
-            $this->limit .= ",{$len}";
143
+        if ($len !== 0) {
144
+                    $this->limit .= ",{$len}";
145
+        }
143 146
     }
144 147
 
145 148
     public function buildJoin($table, $where = false, $type = 'LEFT', $alias = '') {
@@ -151,10 +154,12 @@  discard block
 block discarded – undo
151 154
             }
152 155
         } else {
153 156
             $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}";
154
-            if ($alias)
155
-                $join .= " AS `{$alias}`";
156
-            if ($where)
157
-                $join .= " ON {$where}";
157
+            if ($alias) {
158
+                            $join .= " AS `{$alias}`";
159
+            }
160
+            if ($where) {
161
+                            $join .= " ON {$where}";
162
+            }
158 163
         }
159 164
         return $join;
160 165
     }
@@ -173,13 +178,15 @@  discard block
 block discarded – undo
173 178
                 $operation = '=';
174 179
             }
175 180
 
176
-            if ($concatenation === false)
177
-                $concatenation = 'AND';
178
-            elseif ($concatenation === true)
179
-                $concatenation = '';
181
+            if ($concatenation === false) {
182
+                            $concatenation = 'AND';
183
+            } elseif ($concatenation === true) {
184
+                            $concatenation = '';
185
+            }
180 186
 
181
-            if ($this->whereString == NULL)
182
-                $this->whereString = ' WHERE ';
187
+            if ($this->whereString == NULL) {
188
+                            $this->whereString = ' WHERE ';
189
+            }
183 190
 
184 191
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
185 192
                 if (is_array($value)) {
@@ -205,12 +212,12 @@  discard block
 block discarded – undo
205 212
                 $value = "?";
206 213
             }
207 214
 
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} ";
212
-        }
213
-        else {
215
+            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') {
216
+                            $this->whereString .= " {$where} {$operation} {$value} ";
217
+            } else {
218
+                            $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
219
+            }
220
+        } else {
214 221
             $i = -1;
215 222
             while (isset($where[++$i])) {
216 223
                 $item = $where[$i];
@@ -225,10 +232,11 @@  discard block
 block discarded – undo
225 232
                         $this->whereString .= "{$concatenation} ";
226 233
                     }
227 234
 
228
-                    if ($this->whereString != NULL)
229
-                        $this->whereString .= '(';
230
-                    else
231
-                        $this->whereString = 'WHERE (';
235
+                    if ($this->whereString != NULL) {
236
+                                            $this->whereString .= '(';
237
+                    } else {
238
+                                            $this->whereString = 'WHERE (';
239
+                    }
232 240
                 }
233 241
 
234 242
                 if (!is_array($item)) {
@@ -257,13 +265,15 @@  discard block
 block discarded – undo
257 265
             if (empty($operation)) {
258 266
                 $operation = '=';
259 267
             }
260
-            if ($concatenation === false)
261
-                $concatenation = 'AND';
262
-            elseif ($concatenation === true)
263
-                $concatenation = '';
268
+            if ($concatenation === false) {
269
+                            $concatenation = 'AND';
270
+            } elseif ($concatenation === true) {
271
+                            $concatenation = '';
272
+            }
264 273
 
265
-            if ($this->havingString == NULL)
266
-                $this->havingString = ' HAVING ';
274
+            if ($this->havingString == NULL) {
275
+                            $this->havingString = ' HAVING ';
276
+            }
267 277
 
268 278
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
269 279
                 if (is_array($value)) {
@@ -289,12 +299,12 @@  discard block
 block discarded – undo
289 299
                 $value = "?";
290 300
             }
291 301
 
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} ";
296
-        }
297
-        else {
302
+            if (substr($this->havingString, -1, 1) == '(' || substr($this->havingString, -2, 2) == 'E ') {
303
+                            $this->havingString .= " {$where} {$operation} {$value} ";
304
+            } else {
305
+                            $this->havingString .= "{$concatenation} {$where} {$operation} {$value} ";
306
+            }
307
+        } else {
298 308
             $i = -1;
299 309
             while (isset($where[++$i])) {
300 310
                 $item = $where[$i];
@@ -309,10 +319,11 @@  discard block
 block discarded – undo
309 319
                         $this->havingString .= "{$concatenation} ";
310 320
                     }
311 321
 
312
-                    if ($this->havingString != NULL)
313
-                        $this->havingString .= '(';
314
-                    else
315
-                        $this->havingString = 'HAVING (';
322
+                    if ($this->havingString != NULL) {
323
+                                            $this->havingString .= '(';
324
+                    } else {
325
+                                            $this->havingString = 'HAVING (';
326
+                    }
316 327
                 }
317 328
 
318 329
                 if (!is_array($item)) {
Please login to merge, or discard this patch.
system/modules/Modules/Modules.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -45,6 +45,10 @@
 block discarded – undo
45 45
         return $modelCols;
46 46
     }
47 47
 
48
+    /**
49
+     * @param string $colPrefix
50
+     * @param string $tableName
51
+     */
48 52
     function parseColsForTable($cols, $colPrefix, $tableName)
49 53
     {
50 54
 
Please login to merge, or discard this patch.
system/modules/Ui/objects/Table.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -23,6 +23,9 @@
 block discarded – undo
23 23
     public $attributes = [];
24 24
     public $indexCol = null;
25 25
 
26
+    /**
27
+     * @param string[] $cols
28
+     */
26 29
     function setCols($cols)
27 30
     {
28 31
         $this->cols = $cols;
Please login to merge, or discard this patch.
system/modules/View/View.php 2 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -147,6 +147,9 @@  discard block
 block discarded – undo
147 147
         return $result[1];
148 148
     }
149 149
 
150
+    /**
151
+     * @param string $source
152
+     */
150 153
     function parseSource($source)
151 154
     {
152 155
         $tags = $this->parseRaw($source);
@@ -190,6 +193,9 @@  discard block
 block discarded – undo
190 193
         return substr($source, ( $pos + strlen($rawTag) + 2));
191 194
     }
192 195
 
196
+    /**
197
+     * @param string $type
198
+     */
193 199
     function getHref($type, $params)
194 200
     {
195 201
         $href = '';
@@ -531,6 +537,9 @@  discard block
 block discarded – undo
531 537
         echo round(( microtime(true) - INJI_TIME_START), 4);
532 538
     }
533 539
 
540
+    /**
541
+     * @param string $type
542
+     */
534 543
     function customAsset($type, $asset, $lib = false)
535 544
     {
536 545
         if (!$lib) {
@@ -549,6 +558,9 @@  discard block
 block discarded – undo
549 558
         }
550 559
     }
551 560
 
561
+    /**
562
+     * @param string $lineParams
563
+     */
552 564
     function widget($_widgetName, $_params = [], $lineParams = null)
553 565
     {
554 566
         $_paths = $this->getWidgetPaths($_widgetName);
Please login to merge, or discard this patch.
Braces   +43 added lines, -32 removed lines patch added patch discarded remove patch
@@ -140,8 +140,9 @@  discard block
 block discarded – undo
140 140
 
141 141
     private function parseRaw($source)
142 142
     {
143
-        if (!$source)
144
-            return [];
143
+        if (!$source) {
144
+                    return [];
145
+        }
145 146
 
146 147
         preg_match_all("|{([^}]+)}|", $source, $result);
147 148
         return $result[1];
@@ -327,10 +328,11 @@  discard block
 block discarded – undo
327 328
                         $this->ResolveCssHref($css, $type, $hrefs);
328 329
                         continue;
329 330
                     }
330
-                    if (strpos($css, '//') !== false)
331
-                        $href = $css;
332
-                    else
333
-                        $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
331
+                    if (strpos($css, '//') !== false) {
332
+                                            $href = $css;
333
+                    } else {
334
+                                            $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
335
+                    }
334 336
                     $hrefs[$href] = $href;
335 337
                 }
336 338
                 break;
@@ -340,10 +342,11 @@  discard block
 block discarded – undo
340 342
                         $this->ResolveCssHref($css, $type, $hrefs);
341 343
                         continue;
342 344
                     }
343
-                    if (strpos($css, '://') !== false)
344
-                        $href = $css;
345
-                    else
346
-                        $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}";
345
+                    if (strpos($css, '://') !== false) {
346
+                                            $href = $css;
347
+                    } else {
348
+                                            $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}";
349
+                    }
347 350
                     $hrefs[$href] = $href;
348 351
                 }
349 352
                 break;
@@ -353,10 +356,11 @@  discard block
 block discarded – undo
353 356
                         $this->ResolveCssHref($css, $type, $hrefs);
354 357
                         continue;
355 358
                     }
356
-                    if (strpos($css, '//') !== false)
357
-                        $href = $css;
358
-                    else
359
-                        $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
359
+                    if (strpos($css, '//') !== false) {
360
+                                            $href = $css;
361
+                    } else {
362
+                                            $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
363
+                    }
360 364
                     $hrefs[$href] = $href;
361 365
                 }
362 366
                 break;
@@ -410,8 +414,9 @@  discard block
 block discarded – undo
410 414
         $noParsedScripts = [];
411 415
         foreach ($scripts as $script) {
412 416
             if (is_string($script)) {
413
-                if (!empty($urls[$script]))
414
-                    continue;
417
+                if (!empty($urls[$script])) {
418
+                                    continue;
419
+                }
415 420
 
416 421
                 $path = $this->app->staticLoader->parsePath($script);
417 422
                 if (file_exists($path)) {
@@ -422,8 +427,9 @@  discard block
 block discarded – undo
422 427
                     $noParsedScripts[$script] = $script;
423 428
                 }
424 429
             } elseif (!empty($script['file'])) {
425
-                if (!empty($urls[$script['file']]))
426
-                    continue;
430
+                if (!empty($urls[$script['file']])) {
431
+                                    continue;
432
+                }
427 433
 
428 434
                 $path = $this->app->staticLoader->parsePath($script['file']);
429 435
                 if (file_exists($path)) {
@@ -482,12 +488,14 @@  discard block
 block discarded – undo
482 488
                         $this->genScriptArray($js, $type, $resultArray);
483 489
                         continue;
484 490
                     }
485
-                    if (strpos($js, '//') !== false)
486
-                        $href = $js;
487
-                    else
488
-                        $href = $this->getHref('js', $js);
489
-                    if (!$href)
490
-                        continue;
491
+                    if (strpos($js, '//') !== false) {
492
+                                            $href = $js;
493
+                    } else {
494
+                                            $href = $this->getHref('js', $js);
495
+                    }
496
+                    if (!$href) {
497
+                                            continue;
498
+                    }
491 499
 
492 500
                     $resultArray[] = $href;
493 501
                 }
@@ -498,10 +506,11 @@  discard block
 block discarded – undo
498 506
                         $this->genScriptArray($js, $type, $resultArray);
499 507
                         continue;
500 508
                     }
501
-                    if (strpos($js, '//') !== false)
502
-                        $href = $js;
503
-                    else
504
-                        $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}";
509
+                    if (strpos($js, '//') !== false) {
510
+                                            $href = $js;
511
+                    } else {
512
+                                            $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}";
513
+                    }
505 514
                     $resultArray[] = $href;
506 515
                 }
507 516
                 break;
@@ -517,8 +526,9 @@  discard block
 block discarded – undo
517 526
                         $asset = [];
518 527
                     }
519 528
                     $asset['file'] = $this->getHref('js', $js);
520
-                    if (!$asset['file'])
521
-                        continue;
529
+                    if (!$asset['file']) {
530
+                                            continue;
531
+                    }
522 532
                     $resultArray[] = $asset;
523 533
                 }
524 534
                 break;
@@ -568,8 +578,9 @@  discard block
 block discarded – undo
568 578
                         $paramArray = true;
569 579
                     }
570 580
                 }
571
-                if (!$paramArray)
572
-                    $lineParams = ':' . implode(':', $_params);
581
+                if (!$paramArray) {
582
+                                    $lineParams = ':' . implode(':', $_params);
583
+                }
573 584
             }
574 585
         }
575 586
         echo "<!--start:{WIDGET:{$_widgetName}{$lineParams}}-->\n";
Please login to merge, or discard this patch.
system/objects/CodeGenerator.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@
 block discarded – undo
31 31
         return $return;
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $path
36
+     */
34 37
     static function parseClass($path)
35 38
     {
36 39
         $code = file_get_contents($path);
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,20 +13,22 @@
 block discarded – undo
13 13
     static function genArray($data, $level = 0)
14 14
     {
15 15
         $return = '';
16
-        if ($level == 0)
17
-            $return = "[";
16
+        if ($level == 0) {
17
+                    $return = "[";
18
+        }
18 19
         foreach ($data as $key => $item) {
19 20
             $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "'{$key}' => ";
20
-            if (!is_array($item))
21
-                $return .= "'{$item}',";
22
-            else {
21
+            if (!is_array($item)) {
22
+                            $return .= "'{$item}',";
23
+            } else {
23 24
                 $return .= "[";
24 25
                 $return .= rtrim(self::genArray($item, $level + 1), ',');
25 26
                 $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "],";
26 27
             }
27 28
         }
28
-        if ($level == 0)
29
-            $return = rtrim($return, ',') . "\n];";
29
+        if ($level == 0) {
30
+                    $return = rtrim($return, ',') . "\n];";
31
+        }
30 32
 
31 33
         return $return;
32 34
     }
Please login to merge, or discard this patch.
system/Inji/Log.php 1 patch
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -79,10 +79,12 @@  discard block
 block discarded – undo
79 79
             if (!empty($log['status'])) {
80 80
                 echo "<tr class = '{$log['status']}'><td>{$log['name']}</td><td>{$log['status']}</td></tr>";
81 81
             } else {
82
-                if (empty($log['end']))
83
-                    $log['end'] = microtime(true);
84
-                if (empty($log['start']))
85
-                    $log['start'] = microtime(true);
82
+                if (empty($log['end'])) {
83
+                                    $log['end'] = microtime(true);
84
+                }
85
+                if (empty($log['start'])) {
86
+                                    $log['start'] = microtime(true);
87
+                }
86 88
                 echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>";
87 89
             }
88 90
         }
@@ -93,12 +95,13 @@  discard block
 block discarded – undo
93 95
     function convertSize($size)
94 96
     {
95 97
 
96
-        if ($size < 1024)
97
-            return $size . "B";
98
-        elseif ($size < 1048576)
99
-            return round($size / 1024, 2) . "KB";
100
-        else
101
-            return round($size / 1048576, 2) . "MB";
98
+        if ($size < 1024) {
99
+                    return $size . "B";
100
+        } elseif ($size < 1048576) {
101
+                    return round($size / 1024, 2) . "KB";
102
+        } else {
103
+                    return round($size / 1048576, 2) . "MB";
104
+        }
102 105
     }
103 106
 
104 107
     function __destruct()
Please login to merge, or discard this patch.
system/Inji/Msg.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@
 block discarded – undo
52 52
      */
53 53
     static function get($clean = false)
54 54
     {
55
-        if (empty($_SESSION['_INJI_MSG']))
56
-            return [];
55
+        if (empty($_SESSION['_INJI_MSG'])) {
56
+                    return [];
57
+        }
57 58
         $msgs = $_SESSION['_INJI_MSG'];
58 59
         if ($clean) {
59 60
             $_SESSION['_INJI_MSG'] = [];
Please login to merge, or discard this patch.