Completed
Push — master ( f8c7e1...7855c2 )
by Alexey
06:00
created
system/Inji/ComposerCmd.php 2 patches
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.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
             ;
20 20
             self::initComposer('./');
21 21
         }
22
-        if (!file_exists(App::$primary->path . '/vendor/autoload.php')) {
22
+        if (!file_exists(App::$primary->path.'/vendor/autoload.php')) {
23 23
             self::initComposer();
24 24
         }
25 25
     }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             if (!file_exists('composer/composer.phar')) {
32 32
                 file_put_contents('composer/composerInstall.php', file_get_contents('https://getcomposer.org/installer'));
33 33
                 $argv = ['install', '--install-dir', 'composer/'];
34
-                header("Location: " . filter_input(INPUT_SERVER, 'REQUEST_URI'));
34
+                header("Location: ".filter_input(INPUT_SERVER, 'REQUEST_URI'));
35 35
                 include_once 'composer/composerInstall.php';
36 36
             }
37 37
             $composer = new Phar('composer/composer.phar');
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
     public static function initComposer($path = '')
43 43
     {
44 44
         if (!$path) {
45
-            $path = App::$primary->path . '/';
45
+            $path = App::$primary->path.'/';
46 46
         }
47
-        if (!file_exists($path . 'composer.json')) {
47
+        if (!file_exists($path.'composer.json')) {
48 48
             $json = [
49
-                "name" => get_current_user() . "/" . App::$primary->name,
49
+                "name" => get_current_user()."/".App::$primary->name,
50 50
                 "config" => [
51 51
                     "cache-dir" => "./composerCache/"
52 52
                 ],
53 53
                 "authors" => [
54 54
                     [
55 55
                         "name" => get_current_user(),
56
-                        "email" => get_current_user() . "@" . INJI_DOMAIN_NAME
56
+                        "email" => get_current_user()."@".INJI_DOMAIN_NAME
57 57
                     ]
58 58
                 ],
59 59
                 "require" => [
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                 ]
62 62
             ];
63 63
             Tools::createDir($path);
64
-            file_put_contents($path . 'composer.json', json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
64
+            file_put_contents($path.'composer.json', json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
65 65
         }
66 66
         self::command('install', false, $path);
67 67
     }
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
         } else {
75 75
             $output = null;
76 76
         }
77
-        $path = str_replace('\\', '/', $path === null ? App::$primary->path . '/' : $path);
78
-        $input = new Symfony\Component\Console\Input\StringInput($command . ' -d ' . $path);
77
+        $path = str_replace('\\', '/', $path === null ? App::$primary->path.'/' : $path);
78
+        $input = new Symfony\Component\Console\Input\StringInput($command.' -d '.$path);
79 79
         $app = new Composer\Console\Application();
80 80
         $app->setAutoExit(false);
81 81
         $dir = getcwd();
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
     public static function requirePackage($packageName, $version = '', $path = '')
87 87
     {
88 88
         if (!$path) {
89
-            $path = App::$primary->path . '/';
89
+            $path = App::$primary->path.'/';
90 90
         }
91
-        if (file_exists($path . 'composer.lock')) {
92
-            $lockFile = json_decode(file_get_contents($path . 'composer.lock'), true);
91
+        if (file_exists($path.'composer.lock')) {
92
+            $lockFile = json_decode(file_get_contents($path.'composer.lock'), true);
93 93
         }
94 94
         if (!empty($lockFile['packages'])) {
95 95
             foreach ($lockFile['packages'] as $package) {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             }
100 100
         }
101 101
 
102
-        ComposerCmd::command('require ' . $packageName . ($version ? ':' . $version : ''), false, $path);
102
+        ComposerCmd::command('require '.$packageName.($version ? ':'.$version : ''), false, $path);
103 103
         return true;
104 104
     }
105 105
 
Please login to merge, or discard this patch.
system/Inji/Tools.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -216,6 +216,7 @@
 block discarded – undo
216 216
      * @param  $number Integer Число на основе которого нужно сформировать окончание
217 217
      * @param  $endingsArray  Array Массив слов или окончаний для чисел (1, 4, 5),
218 218
      *         например array('яблоко', 'яблока', 'яблок')
219
+     * @param string[] $endingArray
219 220
      * @return String
220 221
      */
221 222
     static function getNumEnding($number, $endingArray)
Please login to merge, or discard this patch.
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.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     public 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 != '') {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $path = explode('/', $path);
65 65
         $cur = '';
66 66
         foreach ($path as $item) {
67
-            $cur .= $item . '/';
67
+            $cur .= $item.'/';
68 68
             if (!file_exists($cur)) {
69 69
                 mkdir($cur);
70 70
             }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     public 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 {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         if (!headers_sent()) {
207 207
             header("Location: {$href}");
208 208
         } else {
209
-            echo '\'"><script>window.location="' . $href . '";</script>';
209
+            echo '\'"><script>window.location="'.$href.'";</script>';
210 210
         }
211 211
         exit("Перенаправление на: <a href = '{$href}'>{$href}</a>");
212 212
     }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             $pathArray = $cleanPathArray;
267 267
             $cleanPathArray = [];
268 268
         } while ($changes);
269
-        return (strpos($path, '/') === 0 ? '/' : '') . implode('/', $pathArray);
269
+        return (strpos($path, '/') === 0 ? '/' : '').implode('/', $pathArray);
270 270
     }
271 271
 
272 272
     /**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         if (empty($month[$mm - 1])) {
288 288
             return 'Не указано';
289 289
         }
290
-        return ($dd > 0 ? $dd . " " : '') . $month[$mm - 1] . " " . $yy . " " . $hours;
290
+        return ($dd > 0 ? $dd." " : '').$month[$mm - 1]." ".$yy." ".$hours;
291 291
     }
292 292
 
293 293
     /**
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
             if (in_array($file, ['.', '..'])) {
370 370
                 continue;
371 371
             }
372
-            if (is_dir($from . '/' . $file)) {
373
-                self::copyFiles($from . '/' . $file, $to . '/' . $file);
372
+            if (is_dir($from.'/'.$file)) {
373
+                self::copyFiles($from.'/'.$file, $to.'/'.$file);
374 374
             } else {
375
-                copy($from . '/' . $file, $to . '/' . $file);
375
+                copy($from.'/'.$file, $to.'/'.$file);
376 376
             }
377 377
         }
378 378
     }
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Query.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -29,6 +29,9 @@  discard block
 block discarded – undo
29 29
     public $params = [];
30 30
     public $distinct = false;
31 31
 
32
+    /**
33
+     * @param  $instance
34
+     */
32 35
     function __construct($instance = null)
33 36
     {
34 37
         if (!$instance) {
@@ -47,6 +50,9 @@  discard block
 block discarded – undo
47 50
         return $this->curInstance->pdo->lastInsertId();
48 51
     }
49 52
 
53
+    /**
54
+     * @param string $table
55
+     */
50 56
     public function select($table)
51 57
     {
52 58
         $this->operation = 'SELECT';
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
                     $newValue = '';
191 191
                     foreach ($value as $item) {
192 192
                         if ($newValue) {
193
-                            $newValue.=',';
193
+                            $newValue .= ',';
194 194
                         }
195 195
                         if (is_string($item)) {
196
-                            $newValue .='"' . $item . '"';
196
+                            $newValue .= '"'.$item.'"';
197 197
                         } else {
198
-                            $newValue .=$item;
198
+                            $newValue .= $item;
199 199
                         }
200 200
                     }
201
-                    $value = '(' . $newValue . ')';
201
+                    $value = '('.$newValue.')';
202 202
                 } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value))
203 203
                     $value = "({$value})";
204 204
                 elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value))
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 
263 263
         switch ($this->operation) {
264 264
             case 'SELECT':
265
-                $query .= ' ' . ($this->distinct ? 'DISTINCT' : '');
266
-                $query .= ' ' . (!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols)));
265
+                $query .= ' '.($this->distinct ? 'DISTINCT' : '');
266
+                $query .= ' '.(!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols)));
267 267
             case 'DELETE':
268 268
                 $query .= ' FROM';
269 269
                 break;
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
                 $this->params = array_merge($this->params, array_values($this->cols));
281 281
                 $colsStr = '';
282 282
                 if ($this->cols) {
283
-                    $colsStr = '`' . implode('`,`', array_keys($this->cols)) . '`';
283
+                    $colsStr = '`'.implode('`,`', array_keys($this->cols)).'`';
284 284
                 }
285
-                $query .= ' (' . $colsStr . ') VALUES (' . rtrim(str_repeat('?,', count($this->cols)), ',') . ')';
285
+                $query .= ' ('.$colsStr.') VALUES ('.rtrim(str_repeat('?,', count($this->cols)), ',').')';
286 286
                 break;
287 287
             case 'CREATE TABLE':
288 288
                 $query .= " (";
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                 }
295 295
                 $query = rtrim($query, ',');
296 296
                 if ($this->indexes) {
297
-                    $query .= ', ' . implode(',', $this->indexes);
297
+                    $query .= ', '.implode(',', $this->indexes);
298 298
                 }
299 299
                 $query .= ") ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci";
300 300
                 break;
@@ -309,23 +309,23 @@  discard block
 block discarded – undo
309 309
                     }
310 310
                 }
311 311
                 $update = implode(',', $updates);
312
-                $query .=" SET {$update}";
312
+                $query .= " SET {$update}";
313 313
             case 'SELECT':
314 314
             case 'DELETE':
315 315
                 $this->buildWhere($this->where);
316 316
                 if ($this->whereString) {
317
-                    $query .= ' ' . $this->whereString;
317
+                    $query .= ' '.$this->whereString;
318 318
                 }
319 319
                 break;
320 320
         }
321 321
         if ($this->group) {
322
-            $query .= ' GROUP BY ' . implode(',', $this->group);
322
+            $query .= ' GROUP BY '.implode(',', $this->group);
323 323
         }
324 324
         if ($this->order) {
325
-            $query .= ' ORDER BY ' . implode(',', $this->order);
325
+            $query .= ' ORDER BY '.implode(',', $this->order);
326 326
         }
327 327
         if ($this->limit) {
328
-            $query .= ' ' . $this->limit;
328
+            $query .= ' '.$this->limit;
329 329
         }
330 330
         return ['query' => $query, 'params' => $this->params];
331 331
     }
Please login to merge, or discard this patch.
Braces   +34 added lines, -26 removed lines patch added patch discarded remove patch
@@ -126,12 +126,14 @@  discard block
 block discarded – undo
126 126
         if (!is_array($order)) {
127 127
             $this->order[] = "{$order} {$type}";
128 128
         } else {
129
-            foreach ($order as $item)
130
-                if (!is_array($item)) {
129
+            foreach ($order as $item) {
130
+                            if (!is_array($item)) {
131 131
                     call_user_func_array(array($this, 'order'), $order);
132
+            }
132 133
                     break;
133
-                } else
134
-                    $this->order($item);
134
+                } else {
135
+                                    $this->order($item);
136
+                }
135 137
         }
136 138
     }
137 139
 
@@ -140,8 +142,9 @@  discard block
 block discarded – undo
140 142
         $start = intval($start);
141 143
         $len = intval($len);
142 144
         $this->limit = "LIMIT {$start}";
143
-        if ($len !== 0)
144
-            $this->limit .= ",{$len}";
145
+        if ($len !== 0) {
146
+                    $this->limit .= ",{$len}";
147
+        }
145 148
     }
146 149
 
147 150
     public function buildJoin($table, $where = false, $type = 'LEFT', $alias = '')
@@ -154,10 +157,12 @@  discard block
 block discarded – undo
154 157
             }
155 158
         } else {
156 159
             $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}";
157
-            if ($alias)
158
-                $join .= " AS `{$alias}`";
159
-            if ($where)
160
-                $join .= " ON {$where}";
160
+            if ($alias) {
161
+                            $join .= " AS `{$alias}`";
162
+            }
163
+            if ($where) {
164
+                            $join .= " ON {$where}";
165
+            }
161 166
         }
162 167
         return $join;
163 168
     }
@@ -177,13 +182,15 @@  discard block
 block discarded – undo
177 182
                 $operation = '=';
178 183
             }
179 184
 
180
-            if ($concatenation === false)
181
-                $concatenation = 'AND';
182
-            elseif ($concatenation === true)
183
-                $concatenation = '';
185
+            if ($concatenation === false) {
186
+                            $concatenation = 'AND';
187
+            } elseif ($concatenation === true) {
188
+                            $concatenation = '';
189
+            }
184 190
 
185
-            if ($this->whereString == NULL)
186
-                $this->whereString = ' WHERE ';
191
+            if ($this->whereString == NULL) {
192
+                            $this->whereString = ' WHERE ';
193
+            }
187 194
 
188 195
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
189 196
                 if (is_array($value)) {
@@ -209,12 +216,12 @@  discard block
 block discarded – undo
209 216
                 $value = "?";
210 217
             }
211 218
 
212
-            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ')
213
-                $this->whereString .= " {$where} {$operation} {$value} ";
214
-            else
215
-                $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
216
-        }
217
-        else {
219
+            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') {
220
+                            $this->whereString .= " {$where} {$operation} {$value} ";
221
+            } else {
222
+                            $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
223
+            }
224
+        } else {
218 225
             $i = -1;
219 226
             while (isset($where[++$i])) {
220 227
                 $item = $where[$i];
@@ -229,10 +236,11 @@  discard block
 block discarded – undo
229 236
                         $this->whereString .= "{$concatenation} ";
230 237
                     }
231 238
 
232
-                    if ($this->whereString != NULL)
233
-                        $this->whereString .= '(';
234
-                    else
235
-                        $this->whereString = 'WHERE (';
239
+                    if ($this->whereString != NULL) {
240
+                                            $this->whereString .= '(';
241
+                    } else {
242
+                                            $this->whereString = 'WHERE (';
243
+                    }
236 244
                 }
237 245
 
238 246
                 if (!is_array($item)) {
Please login to merge, or discard this patch.
system/modules/Modules/Modules.php 2 patches
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.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
     public function createBlankModule($name, $codeName)
14 14
     {
15 15
         $codeName = ucfirst($codeName);
16
-        Tools::createDir(App::$primary->path . '/modules/' . $codeName);
16
+        Tools::createDir(App::$primary->path.'/modules/'.$codeName);
17 17
         ob_start();
18
-        include $this->path . '/tpls/BlankModule.php';
18
+        include $this->path.'/tpls/BlankModule.php';
19 19
         $moduleCode = ob_get_contents();
20 20
         ob_end_clean();
21
-        file_put_contents(App::$primary->path . '/modules/' . $codeName . '/' . $codeName . '.php', $moduleCode);
22
-        file_put_contents(App::$primary->path . '/modules/' . $codeName . '/info.php', "<?php\nreturn " . CodeGenerator::genArray(['name' => $name]));
23
-        file_put_contents(App::$primary->path . '/modules/' . $codeName . '/generatorHash.php', "<?php\nreturn " . CodeGenerator::genArray([$codeName . '.php' => md5($moduleCode)]));
21
+        file_put_contents(App::$primary->path.'/modules/'.$codeName.'/'.$codeName.'.php', $moduleCode);
22
+        file_put_contents(App::$primary->path.'/modules/'.$codeName.'/info.php', "<?php\nreturn ".CodeGenerator::genArray(['name' => $name]));
23
+        file_put_contents(App::$primary->path.'/modules/'.$codeName.'/generatorHash.php', "<?php\nreturn ".CodeGenerator::genArray([$codeName.'.php' => md5($moduleCode)]));
24 24
     }
25 25
 
26 26
     public function parseColsForModel($cols = [])
27 27
     {
28
-        $modelCols = [ 'labels' => [], 'cols' => [], 'relations' => []];
28
+        $modelCols = ['labels' => [], 'cols' => [], 'relations' => []];
29 29
         foreach ($cols as $col) {
30 30
             $modelCols['labels'][$col['code']] = $col['label'];
31 31
             $colType = !empty($col['type']['primary']) ? $col['type']['primary'] : $col['type'];
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
         $colsExist = App::$cur->db->getTableCols($tableName);
52 52
         $tableCols = [];
53
-        if (empty($colsExist[$colPrefix . 'id'])) {
54
-            $tableCols[$colPrefix . 'id'] = 'pk';
53
+        if (empty($colsExist[$colPrefix.'id'])) {
54
+            $tableCols[$colPrefix.'id'] = 'pk';
55 55
         }
56 56
         foreach ($cols as $col) {
57
-            if (!empty($colsExist[$colPrefix . $col['code']])) {
57
+            if (!empty($colsExist[$colPrefix.$col['code']])) {
58 58
                 continue;
59 59
             }
60 60
             $colType = !empty($col['type']['primary']) ? $col['type']['primary'] : $col['type'];
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
                 case 'image':
63 63
                 case 'number':
64 64
                 case 'relation':
65
-                    $tableCols[$colPrefix . $col['code']] = 'int(11) NOT NULL';
65
+                    $tableCols[$colPrefix.$col['code']] = 'int(11) NOT NULL';
66 66
                     break;
67 67
                 case 'decimal':
68
-                    $tableCols[$colPrefix . $col['code']] = 'decimal(11,2) NOT NULL';
68
+                    $tableCols[$colPrefix.$col['code']] = 'decimal(11,2) NOT NULL';
69 69
                     break;
70 70
                 case 'dateTime':
71
-                    $tableCols[$colPrefix . $col['code']] = 'timestamp NOT NULL';
71
+                    $tableCols[$colPrefix.$col['code']] = 'timestamp NOT NULL';
72 72
                     break;
73 73
                 case 'currentDateTime':
74
-                    $tableCols[$colPrefix . $col['code']] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
74
+                    $tableCols[$colPrefix.$col['code']] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
75 75
                     break;
76 76
                 case 'text':
77
-                    $tableCols[$colPrefix . $col['code']] = 'varchar(255) NOT NULL';
77
+                    $tableCols[$colPrefix.$col['code']] = 'varchar(255) NOT NULL';
78 78
                     break;
79 79
                 case 'textarea':
80 80
                 default:
81
-                    $tableCols[$colPrefix . $col['code']] = 'text NOT NULL';
81
+                    $tableCols[$colPrefix.$col['code']] = 'text NOT NULL';
82 82
                     break;
83 83
             }
84 84
         }
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
         $modelCols = $this->parseColsForModel();
95 95
         if (!empty($options['cols'])) {
96 96
             $modelCols = $this->parseColsForModel($options['cols']);
97
-            $tableName = strtolower($module) . '_' . strtolower($codeName);
98
-            $tableCols = $this->parseColsForTable($options['cols'], strtolower($codeName) . '_', $tableName);
97
+            $tableName = strtolower($module).'_'.strtolower($codeName);
98
+            $tableCols = $this->parseColsForTable($options['cols'], strtolower($codeName).'_', $tableName);
99 99
             if (App::$cur->db->tableExist($tableName)) {
100 100
                 foreach ($tableCols as $colKey => $params) {
101 101
                     App::$cur->db->add_col($tableName, $colKey, $params);
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
         $class->addProperty('objectName', $name, true);
108 108
         $class->addProperty('cols', $modelCols['cols'], true);
109 109
         $class->addProperty('labels', $modelCols['labels'], true);
110
-        $class->addMethod('relations', 'return ' . CodeGenerator::genArray($modelCols['relations']), [], true);
111
-        $modelCode = "<?php \n\nnamespace {$module};\n\n" . $class->generate();
110
+        $class->addMethod('relations', 'return '.CodeGenerator::genArray($modelCols['relations']), [], true);
111
+        $modelCode = "<?php \n\nnamespace {$module};\n\n".$class->generate();
112 112
 
113 113
         $modulePath = Module::getModulePath($module);
114
-        Tools::createDir($modulePath . '/models');
115
-        file_put_contents($modulePath . '/models/' . $codeName . '.php', $modelCode);
116
-        $config = Config::custom($modulePath . '/generatorHash.php');
117
-        $config['models/' . $codeName . '.php'] = md5($modelCode);
118
-        Config::save($modulePath . '/generatorHash.php', $config);
114
+        Tools::createDir($modulePath.'/models');
115
+        file_put_contents($modulePath.'/models/'.$codeName.'.php', $modelCode);
116
+        $config = Config::custom($modulePath.'/generatorHash.php');
117
+        $config['models/'.$codeName.'.php'] = md5($modelCode);
118
+        Config::save($modulePath.'/generatorHash.php', $config);
119 119
     }
120 120
 
121 121
     public function install($module, $params = [])
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         $type = 'modules';
137 137
 
138
-        $path = INJI_SYSTEM_DIR . '/modules/';
138
+        $path = INJI_SYSTEM_DIR.'/modules/';
139 139
         $location = 'modules';
140 140
 
141 141
         $config[$location][] = $module;
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
             }
149 149
         }
150 150
         Config::save('app', $config, null, App::$primary);
151
-        if (file_exists($path . $module . '/install_script.php')) {
152
-            $installFunction = include $path . $module . '/install_script.php';
151
+        if (file_exists($path.$module.'/install_script.php')) {
152
+            $installFunction = include $path.$module.'/install_script.php';
153 153
             $installFunction(1, $params);
154 154
         }
155 155
     }
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
             $info = Modules::getInfo($module);
179 179
             $moduleName = !empty($info['name']) ? $info['name'] : $module;
180 180
             foreach ($modelsNames as $modelName) {
181
-                $fullModelName = $module . '\\' . $modelName;
182
-                $models[$fullModelName] = $moduleName . ' - ' . ($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
181
+                $fullModelName = $module.'\\'.$modelName;
182
+                $models[$fullModelName] = $moduleName.' - '.($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
183 183
             }
184 184
         }
185 185
         foreach (App::$primary->config['modules'] as $configModule) {
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
             $info = Modules::getInfo($configModule);
191 191
             $moduleName = !empty($info['name']) ? $info['name'] : $configModule;
192 192
             foreach ($modelsNames as $modelName) {
193
-                $fullModelName = $configModule . '\\' . $modelName;
193
+                $fullModelName = $configModule.'\\'.$modelName;
194 194
                 Router::loadClass($fullModelName);
195
-                $models[$fullModelName] = $moduleName . ' - ' . ($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
195
+                $models[$fullModelName] = $moduleName.' - '.($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
196 196
             }
197 197
         }
198 198
         return $models;
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
     public function getModelsList($module, $dir = '')
202 202
     {
203 203
         $modulePath = Module::getModulePath($module);
204
-        $path = rtrim($modulePath . '/models/' . $dir, '/');
204
+        $path = rtrim($modulePath.'/models/'.$dir, '/');
205 205
         $models = [];
206 206
         if (file_exists($path)) {
207 207
             foreach (array_slice(scandir($path), 2) as $file) {
208 208
                 $modelLastName = pathinfo($file, PATHINFO_FILENAME);
209
-                if (is_dir($path . '/' . $file)) {
210
-                    $models = array_merge($models, $this->getModelsList($module, $dir . '/' . $modelLastName));
209
+                if (is_dir($path.'/'.$file)) {
210
+                    $models = array_merge($models, $this->getModelsList($module, $dir.'/'.$modelLastName));
211 211
                 }
212
-                $nameSpace = trim(preg_replace('!/' . $modelLastName . '$!', '', $dir), '/');
213
-                $models[] = trim(str_replace('/', '\\', $nameSpace) . '\\' . $modelLastName, '\\');
212
+                $nameSpace = trim(preg_replace('!/'.$modelLastName.'$!', '', $dir), '/');
213
+                $models[] = trim(str_replace('/', '\\', $nameSpace).'\\'.$modelLastName, '\\');
214 214
             }
215 215
         }
216 216
         return $models;
@@ -219,30 +219,30 @@  discard block
 block discarded – undo
219 219
     public function createController($module, $controllerType)
220 220
     {
221 221
         $modulePath = Module::getModulePath($module);
222
-        $path = $modulePath . '/' . $controllerType . '/' . $module . 'Controller.php';
222
+        $path = $modulePath.'/'.$controllerType.'/'.$module.'Controller.php';
223 223
         $class = new CodeGenerator\ClassGenerator();
224
-        $class->name = $module . 'Controller';
224
+        $class->name = $module.'Controller';
225 225
         $class->extends = 'Controller';
226
-        $controllerCode = "<?php\n\n" . $class->generate();
226
+        $controllerCode = "<?php\n\n".$class->generate();
227 227
         Tools::createDir(pathinfo($path, PATHINFO_DIRNAME));
228 228
         file_put_contents($path, $controllerCode);
229
-        $config = Config::custom($modulePath . '/generatorHash.php');
230
-        $config[$controllerType . '/' . $module . 'Controller.php'] = md5($controllerCode);
231
-        Config::save($modulePath . '/generatorHash.php', $config);
229
+        $config = Config::custom($modulePath.'/generatorHash.php');
230
+        $config[$controllerType.'/'.$module.'Controller.php'] = md5($controllerCode);
231
+        Config::save($modulePath.'/generatorHash.php', $config);
232 232
     }
233 233
 
234 234
     public function addActionToController($module, $type, $controller, $url)
235 235
     {
236 236
         $modulePath = Module::getModulePath($module);
237
-        $path = Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php';
237
+        $path = Modules::getModulePath($module).'/'.$type.'/'.$controller.'.php';
238 238
         $class = CodeGenerator::parseClass($path);
239
-        $class->addMethod($url . 'Action');
240
-        $controllerCode = "<?php\n\n" . $class->generate();
239
+        $class->addMethod($url.'Action');
240
+        $controllerCode = "<?php\n\n".$class->generate();
241 241
         Tools::createDir(pathinfo($path, PATHINFO_DIRNAME));
242 242
         file_put_contents($path, $controllerCode);
243
-        $config = Config::custom($modulePath . '/generatorHash.php');
244
-        $config[$type . '/' . $module . 'Controller.php'] = md5($controllerCode);
245
-        Config::save($modulePath . '/generatorHash.php', $config);
243
+        $config = Config::custom($modulePath.'/generatorHash.php');
244
+        $config[$type.'/'.$module.'Controller.php'] = md5($controllerCode);
245
+        Config::save($modulePath.'/generatorHash.php', $config);
246 246
     }
247 247
 
248 248
 }
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 3 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.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
         if (!empty($this->config[$this->app->type]['current'])) {
38 38
             $templateName = $this->config[$this->app->type]['current'];
39 39
             if (!empty($this->config[$this->app->type]['installed'][$templateName]['location'])) {
40
-                $this->templatesPath = App::$primary->path . "/templates";
40
+                $this->templatesPath = App::$primary->path."/templates";
41 41
             }
42 42
         }
43 43
         if (!$this->templatesPath) {
44
-            $this->templatesPath = $this->app->path . "/templates";
44
+            $this->templatesPath = $this->app->path."/templates";
45 45
         }
46 46
         $this->template = \View\Template::get($templateName, $this->app, $this->templatesPath);
47 47
         if (!$this->template) {
48 48
             $this->template = new \View\Template([
49 49
                 'name' => 'default',
50
-                'path' => $this->templatesPath . '/default',
50
+                'path' => $this->templatesPath.'/default',
51 51
                 'app' => $this->app
52 52
             ]);
53 53
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                 case 'WIDGET':
165 165
                     $source = $this->cutTag($source, $rawTag);
166 166
                     $params = array_slice($tag, 2);
167
-                    $this->widget($tag[1], ['params' => $params], ':' . implode(':', $params));
167
+                    $this->widget($tag[1], ['params' => $params], ':'.implode(':', $params));
168 168
                     break;
169 169
                 case 'HEAD':
170 170
                     $source = $this->cutTag($source, $rawTag);
@@ -187,18 +187,18 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $pos = strpos($source, $rawTag) - 1;
189 189
         echo substr($source, 0, $pos);
190
-        return substr($source, ( $pos + strlen($rawTag) + 2));
190
+        return substr($source, ($pos + strlen($rawTag) + 2));
191 191
     }
192 192
 
193 193
     public function getHref($type, $params)
194 194
     {
195 195
         $href = '';
196 196
         if (is_string($params)) {
197
-            $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params;
197
+            $href = ($this->app->type != 'app' ? '/'.$this->app->name : '').$params;
198 198
         } elseif (empty($params['template']) && !empty($params['file'])) {
199
-            $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params['file'];
199
+            $href = ($this->app->type != 'app' ? '/'.$this->app->name : '').$params['file'];
200 200
         } elseif (!empty($params['template']) && !empty($params['file'])) {
201
-            $href = $this->app->templatesPath . "/{$this->template->name}/{$type}/{$params['file']}";
201
+            $href = $this->app->templatesPath."/{$this->template->name}/{$type}/{$params['file']}";
202 202
         }
203 203
         return $href;
204 204
     }
@@ -235,16 +235,16 @@  discard block
 block discarded – undo
235 235
 
236 236
         echo "<title>{$this->title}</title>\n";
237 237
 
238
-        if (!empty($this->template->config['favicon']) && file_exists($this->template->path . "/{$this->template->config['favicon']}")) {
238
+        if (!empty($this->template->config['favicon']) && file_exists($this->template->path."/{$this->template->config['favicon']}")) {
239 239
             echo "        <link rel='shortcut icon' href='/templates/{$this->template->name}/{$this->template->config['favicon']}' />";
240
-        } elseif (!empty($this->template->config['favicon']) && file_exists($this->app->path . "/static/images/{$this->template->config['favicon']}")) {
240
+        } elseif (!empty($this->template->config['favicon']) && file_exists($this->app->path."/static/images/{$this->template->config['favicon']}")) {
241 241
             echo "        <link rel='shortcut icon' href='/static/images/{$this->template->config['favicon']}' />";
242
-        } elseif (file_exists($this->app->path . '/static/images/favicon.ico')) {
242
+        } elseif (file_exists($this->app->path.'/static/images/favicon.ico')) {
243 243
             echo "        <link rel='shortcut icon' href='/static/images/favicon.ico' />";
244 244
         }
245 245
 
246 246
         foreach ($this->getMetaTags() as $meta) {
247
-            echo "\n        " . Html::el('meta', $meta, '', null);
247
+            echo "\n        ".Html::el('meta', $meta, '', null);
248 248
         }
249 249
 
250 250
         if (!empty(Inji::$config['assets']['js'])) {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
         $this->checkNeedLibs();
257 257
         $this->parseCss();
258
-        echo "\n        <script src='" . Statics::file(($this->app->type != 'app' ? '/' . $this->app->name : '' ) . "/static/system/js/Inji.js") . "'></script>";
258
+        echo "\n        <script src='".Statics::file(($this->app->type != 'app' ? '/'.$this->app->name : '')."/static/system/js/Inji.js")."'></script>";
259 259
     }
260 260
 
261 261
     public function parseCss()
@@ -279,25 +279,25 @@  discard block
 block discarded – undo
279 279
             if (file_exists($path)) {
280 280
                 $this->loadedCss[$href] = $href;
281 281
                 $urls[$href] = $path;
282
-                $timeStr.=filemtime($path);
282
+                $timeStr .= filemtime($path);
283 283
             } else {
284 284
                 echo "\n        <link href='{$href}' rel='stylesheet' type='text/css' />";
285 285
             }
286 286
         }
287 287
         $timeMd5 = md5($timeStr);
288 288
         $cacheDir = Cache::getDir('static');
289
-        if (!file_exists($cacheDir . '/all' . $timeMd5 . '.css')) {
289
+        if (!file_exists($cacheDir.'/all'.$timeMd5.'.css')) {
290 290
             foreach ($urls as $primaryUrl => $url) {
291 291
                 $source = file_get_contents($url);
292 292
                 $rootPath = substr($primaryUrl, 0, strrpos($primaryUrl, '/'));
293 293
                 $levelUpPath = substr($rootPath, 0, strrpos($rootPath, '/'));
294
-                $source = preg_replace('!url\((\'?"?)[\.]{2}!isU', 'url($1' . $levelUpPath, $source);
295
-                $source = preg_replace('!url\((\'?"?)[\.]{1}!isU', 'url($1' . $rootPath, $source);
296
-                $source = preg_replace('#url\(([\'"]){1}(?!http|https|/|data\:)([^/])#isU', 'url($1' . $rootPath . '/$2', $source);
297
-                $source = preg_replace('#url\((?!http|https|/|data\:|\'|")([^/])#isU', 'url(' . $rootPath . '/$1$2', $source);
294
+                $source = preg_replace('!url\((\'?"?)[\.]{2}!isU', 'url($1'.$levelUpPath, $source);
295
+                $source = preg_replace('!url\((\'?"?)[\.]{1}!isU', 'url($1'.$rootPath, $source);
296
+                $source = preg_replace('#url\(([\'"]){1}(?!http|https|/|data\:)([^/])#isU', 'url($1'.$rootPath.'/$2', $source);
297
+                $source = preg_replace('#url\((?!http|https|/|data\:|\'|")([^/])#isU', 'url('.$rootPath.'/$1$2', $source);
298 298
                 $cssAll .= $source;
299 299
             }
300
-            file_put_contents($cacheDir . '/all' . $timeMd5 . '.css', $cssAll);
300
+            file_put_contents($cacheDir.'/all'.$timeMd5.'.css', $cssAll);
301 301
         }
302 302
         echo "\n        <link href='/{$cacheDir}/all{$timeMd5}.css' rel='stylesheet' type='text/css' />";
303 303
     }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                     if (strpos($css, '//') !== false)
330 330
                         $href = $css;
331 331
                     else
332
-                        $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
332
+                        $href = ($this->app->type != 'app' ? '/'.$this->app->name : '').$css;
333 333
                     $hrefs[$href] = $href;
334 334
                 }
335 335
                 break;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                     if (strpos($css, '://') !== false)
343 343
                         $href = $css;
344 344
                     else
345
-                        $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}";
345
+                        $href = $this->app->templatesPath."/{$this->template->name}/css/{$css}";
346 346
                     $hrefs[$href] = $href;
347 347
                 }
348 348
                 break;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                     if (strpos($css, '//') !== false)
356 356
                         $href = $css;
357 357
                     else
358
-                        $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
358
+                        $href = ($this->app->type != 'app' ? '/'.$this->app->name : '').$css;
359 359
                     $hrefs[$href] = $href;
360 360
                 }
361 361
                 break;
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
         if (!empty($this->app->config['site']['metatags'])) {
376 376
             foreach ($this->app->config['site']['metatags'] as $meta) {
377 377
                 if (!empty($meta['name'])) {
378
-                    $metas['metaName:' . $meta['name']] = $meta;
378
+                    $metas['metaName:'.$meta['name']] = $meta;
379 379
                 } elseif (!empty($meta['property'])) {
380
-                    $metas['metaProperty:' . $meta['property']] = $meta;
380
+                    $metas['metaProperty:'.$meta['property']] = $meta;
381 381
                 }
382 382
             }
383 383
         }
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
     public function addMetaTag($meta)
391 391
     {
392 392
         if (!empty($meta['name'])) {
393
-            $this->dynMetas['metaName:' . $meta['name']] = $meta;
393
+            $this->dynMetas['metaName:'.$meta['name']] = $meta;
394 394
         } elseif (!empty($meta['property'])) {
395
-            $this->dynMetas['metaProperty:' . $meta['property']] = $meta;
395
+            $this->dynMetas['metaProperty:'.$meta['property']] = $meta;
396 396
         }
397 397
     }
398 398
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                 if (file_exists($path)) {
417 417
                     $nativeUrl[$script] = $script;
418 418
                     $urls[$script] = $path;
419
-                    $timeStr.=filemtime($path);
419
+                    $timeStr .= filemtime($path);
420 420
                 } else {
421 421
                     $noParsedScripts[$script] = $script;
422 422
                 }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                     if (!empty($script['name'])) {
432 432
                         $onLoadModules[$script['name']] = $script['name'];
433 433
                     }
434
-                    $timeStr.=filemtime($path);
434
+                    $timeStr .= filemtime($path);
435 435
                 } else {
436 436
                     $noParsedScripts[$script] = $script;
437 437
                 }
@@ -440,20 +440,20 @@  discard block
 block discarded – undo
440 440
 
441 441
         $timeMd5 = md5($timeStr);
442 442
         $cacheDir = Cache::getDir('static');
443
-        if (!file_exists($cacheDir . '/all' . $timeMd5 . '.js')) {
443
+        if (!file_exists($cacheDir.'/all'.$timeMd5.'.js')) {
444 444
             foreach ($urls as $url) {
445
-                $scriptAll .= ';' . file_get_contents($url);
445
+                $scriptAll .= ';'.file_get_contents($url);
446 446
             }
447
-            file_put_contents($cacheDir . '/all' . $timeMd5 . '.js', $scriptAll);
447
+            file_put_contents($cacheDir.'/all'.$timeMd5.'.js', $scriptAll);
448 448
         }
449 449
         $options = [
450 450
             'scripts' => array_values($noParsedScripts),
451 451
             'compresedScripts' => $nativeUrl,
452 452
             'styles' => [],
453
-            'appRoot' => $this->app->type == 'app' ? '/' : '/' . $this->app->name . '/',
453
+            'appRoot' => $this->app->type == 'app' ? '/' : '/'.$this->app->name.'/',
454 454
             'onLoadModules' => $onLoadModules
455 455
         ];
456
-        $options['scripts'][] = '/' . $cacheDir . '/all' . $timeMd5 . '.js';
456
+        $options['scripts'][] = '/'.$cacheDir.'/all'.$timeMd5.'.js';
457 457
         $this->widget('View\bodyEnd', compact('options'));
458 458
     }
459 459
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
                     if (strpos($js, '//') !== false)
501 501
                         $href = $js;
502 502
                     else
503
-                        $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}";
503
+                        $href = $this->app->templatesPath."/{$this->template->name}/js/{$js}";
504 504
                     $resultArray[] = $href;
505 505
                 }
506 506
                 break;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
     {
538 538
         if ($add && !empty($this->app->config['site']['name'])) {
539 539
             if ($title) {
540
-                $this->title = $title . ' - ' . $this->app->config['site']['name'];
540
+                $this->title = $title.' - '.$this->app->config['site']['name'];
541 541
             } else {
542 542
                 $this->title = $this->app->config['site']['name'];
543 543
             }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                     }
567 567
                 }
568 568
                 if (!$paramArray)
569
-                    $lineParams = ':' . implode(':', $_params);
569
+                    $lineParams = ':'.implode(':', $_params);
570 570
             }
571 571
         }
572 572
         echo "<!--start:{WIDGET:{$_widgetName}{$lineParams}}-->\n";
@@ -585,24 +585,24 @@  discard block
 block discarded – undo
585 585
         if (strpos($widgetName, '\\')) {
586 586
             $widgetName = explode('\\', $widgetName);
587 587
 
588
-            $paths['templatePath_widgetDir'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName[0] . '/' . $widgetName[1] . '/' . $widgetName[1] . '.php';
589
-            $paths['templatePath'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName[0] . '/' . $widgetName[1] . '.php';
588
+            $paths['templatePath_widgetDir'] = $this->templatesPath.'/'.$this->template->name.'/widgets/'.$widgetName[0].'/'.$widgetName[1].'/'.$widgetName[1].'.php';
589
+            $paths['templatePath'] = $this->templatesPath.'/'.$this->template->name.'/widgets/'.$widgetName[0].'/'.$widgetName[1].'.php';
590 590
             App::$cur->$widgetName[0];
591 591
             $modulePaths = Module::getModulePaths(ucfirst($widgetName[0]));
592 592
             foreach ($modulePaths as $pathName => $path) {
593
-                $paths[$pathName . '_widgetDir'] = $path . '/widgets/' . $widgetName[1] . '/' . $widgetName[1] . '.php';
594
-                $paths[$pathName] = $path . '/widgets/' . $widgetName[1] . '.php';
593
+                $paths[$pathName.'_widgetDir'] = $path.'/widgets/'.$widgetName[1].'/'.$widgetName[1].'.php';
594
+                $paths[$pathName] = $path.'/widgets/'.$widgetName[1].'.php';
595 595
             }
596 596
             return $paths;
597 597
         } else {
598
-            $paths['templatePath_widgetDir'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName . '/' . $widgetName . '.php';
599
-            $paths['templatePath'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName . '.php';
598
+            $paths['templatePath_widgetDir'] = $this->templatesPath.'/'.$this->template->name.'/widgets/'.$widgetName.'/'.$widgetName.'.php';
599
+            $paths['templatePath'] = $this->templatesPath.'/'.$this->template->name.'/widgets/'.$widgetName.'.php';
600 600
 
601
-            $paths['curAppPath_widgetDir'] = $this->app->path . '/widgets/' . $widgetName . '/' . $widgetName . '.php';
602
-            $paths['curAppPath'] = $this->app->path . '/widgets/' . $widgetName . '.php';
601
+            $paths['curAppPath_widgetDir'] = $this->app->path.'/widgets/'.$widgetName.'/'.$widgetName.'.php';
602
+            $paths['curAppPath'] = $this->app->path.'/widgets/'.$widgetName.'.php';
603 603
 
604
-            $paths['systemPath_widgetDir'] = INJI_SYSTEM_DIR . '/widgets/' . $widgetName . '/' . $widgetName . '.php';
605
-            $paths['systemPath'] = INJI_SYSTEM_DIR . '/widgets/' . $widgetName . '.php';
604
+            $paths['systemPath_widgetDir'] = INJI_SYSTEM_DIR.'/widgets/'.$widgetName.'/'.$widgetName.'.php';
605
+            $paths['systemPath'] = INJI_SYSTEM_DIR.'/widgets/'.$widgetName.'.php';
606 606
         }
607 607
         return $paths;
608 608
     }
Please login to merge, or discard this patch.
system/objects/CodeGenerator.php 3 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.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@
 block discarded – undo
16 16
         if ($level == 0)
17 17
             $return = "[";
18 18
         foreach ($data as $key => $item) {
19
-            $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "'{$key}' => ";
19
+            $return .= "\n".str_repeat(' ', ($level * 4 + 4))."'{$key}' => ";
20 20
             if (!is_array($item))
21 21
                 $return .= "'{$item}',";
22 22
             else {
23 23
                 $return .= "[";
24 24
                 $return .= rtrim(self::genArray($item, $level + 1), ',');
25
-                $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "],";
25
+                $return .= "\n".str_repeat(' ', ($level * 4 + 4))."],";
26 26
             }
27 27
         }
28 28
         if ($level == 0)
29
-            $return = rtrim($return, ',') . "\n];";
29
+            $return = rtrim($return, ',')."\n];";
30 30
 
31 31
         return $return;
32 32
     }
Please login to merge, or discard this patch.
system/Inji/Html.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         $html = "<{$tag}";
25 25
         if ($attributes && is_array($attributes)) {
26 26
             foreach ($attributes as $key => $value) {
27
-                $html .=" {$key} = '";
27
+                $html .= " {$key} = '";
28 28
                 if (!is_array($value)) {
29 29
                     $html .= addcslashes($value, "'");
30 30
                 } else {
Please login to merge, or discard this patch.
system/Inji/Log.php 2 patches
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,22 +83,22 @@
 block discarded – undo
83 83
                     $log['end'] = microtime(true);
84 84
                 if (empty($log['start']))
85 85
                     $log['start'] = microtime(true);
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>";
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>';
90
-        echo '<tr><th>Memory</th><th>' . $this->convertSize(memory_get_peak_usage()) . ' of ' . ini_get('memory_limit') . '</th></tr></table></div>';
89
+        echo '<tr><th>Summary</th><th>'.round((microtime(true) - $this->startTime), 5).'</th></tr>';
90
+        echo '<tr><th>Memory</th><th>'.$this->convertSize(memory_get_peak_usage()).' of '.ini_get('memory_limit').'</th></tr></table></div>';
91 91
     }
92 92
 
93 93
     public function convertSize($size)
94 94
     {
95 95
 
96 96
         if ($size < 1024)
97
-            return $size . "B";
97
+            return $size."B";
98 98
         elseif ($size < 1048576)
99
-            return round($size / 1024, 2) . "KB";
99
+            return round($size / 1024, 2)."KB";
100 100
         else
101
-            return round($size / 1048576, 2) . "MB";
101
+            return round($size / 1048576, 2)."MB";
102 102
     }
103 103
 
104 104
     public function __destruct()
Please login to merge, or discard this patch.