@@ -58,6 +58,10 @@ |
||
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'; |
@@ -216,6 +216,7 @@ |
||
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) |
@@ -55,8 +55,9 @@ |
||
55 | 55 | * @return boolean |
56 | 56 | */ |
57 | 57 | public static function createDir($path) { |
58 | - if (file_exists($path)) |
|
59 | - return true; |
|
58 | + if (file_exists($path)) { |
|
59 | + return true; |
|
60 | + } |
|
60 | 61 | |
61 | 62 | $path = explode('/', $path); |
62 | 63 | $cur = ''; |
@@ -29,6 +29,9 @@ discard block |
||
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 |
||
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'; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $concatenation = ''; |
185 | 185 | } |
186 | 186 | |
187 | - if ($this->whereString == NULL) { |
|
187 | + if ($this->whereString == null) { |
|
188 | 188 | $this->whereString = ' WHERE '; |
189 | 189 | } |
190 | 190 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $this->whereString .= "{$concatenation} "; |
233 | 233 | } |
234 | 234 | |
235 | - if ($this->whereString != NULL) { |
|
235 | + if ($this->whereString != null) { |
|
236 | 236 | $this->whereString .= '('; |
237 | 237 | } else { |
238 | 238 | $this->whereString = 'WHERE ('; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $concatenation = ''; |
272 | 272 | } |
273 | 273 | |
274 | - if ($this->havingString == NULL) { |
|
274 | + if ($this->havingString == null) { |
|
275 | 275 | $this->havingString = ' HAVING '; |
276 | 276 | } |
277 | 277 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $this->havingString .= "{$concatenation} "; |
320 | 320 | } |
321 | 321 | |
322 | - if ($this->havingString != NULL) { |
|
322 | + if ($this->havingString != null) { |
|
323 | 323 | $this->havingString .= '('; |
324 | 324 | } else { |
325 | 325 | $this->havingString = 'HAVING ('; |
@@ -45,6 +45,10 @@ |
||
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 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | 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']; |
@@ -23,6 +23,9 @@ |
||
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; |
@@ -147,6 +147,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -133,8 +133,9 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | private function parseRaw($source) { |
136 | - if (!$source) |
|
137 | - return []; |
|
136 | + if (!$source) { |
|
137 | + return []; |
|
138 | + } |
|
138 | 139 | |
139 | 140 | preg_match_all("|{([^}]+)}|", $source, $result); |
140 | 141 | return $result[1]; |
@@ -311,10 +312,11 @@ discard block |
||
311 | 312 | $this->ResolveCssHref($css, $type, $hrefs); |
312 | 313 | continue; |
313 | 314 | } |
314 | - if (strpos($css, '//') !== false) |
|
315 | - $href = $css; |
|
316 | - else |
|
317 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $css; |
|
315 | + if (strpos($css, '//') !== false) { |
|
316 | + $href = $css; |
|
317 | + } else { |
|
318 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $css; |
|
319 | + } |
|
318 | 320 | $hrefs[$href] = $href; |
319 | 321 | } |
320 | 322 | break; |
@@ -324,10 +326,11 @@ discard block |
||
324 | 326 | $this->ResolveCssHref($css, $type, $hrefs); |
325 | 327 | continue; |
326 | 328 | } |
327 | - if (strpos($css, '://') !== false) |
|
328 | - $href = $css; |
|
329 | - else |
|
330 | - $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
329 | + if (strpos($css, '://') !== false) { |
|
330 | + $href = $css; |
|
331 | + } else { |
|
332 | + $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}"; |
|
333 | + } |
|
331 | 334 | $hrefs[$href] = $href; |
332 | 335 | } |
333 | 336 | break; |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | public function cutTag($source, $rawTag) { |
179 | 179 | $pos = strpos($source, $rawTag) - 1; |
180 | 180 | echo substr($source, 0, $pos); |
181 | - return substr($source, ( $pos + strlen($rawTag) + 2)); |
|
181 | + return substr($source, ($pos + strlen($rawTag) + 2)); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | public function getHref($type, $params) { |
185 | 185 | $href = ''; |
186 | 186 | if (is_string($params)) { |
187 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params; |
|
187 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $params; |
|
188 | 188 | } elseif (empty($params['template']) && !empty($params['file'])) { |
189 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params['file']; |
|
189 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $params['file']; |
|
190 | 190 | } elseif (!empty($params['template']) && !empty($params['file'])) { |
191 | 191 | $href = $this->app->templatesPath . "/{$this->template->name}/{$type}/{$params['file']}"; |
192 | 192 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if (strpos($css, '//') !== false) { |
341 | 341 | $href = $css; |
342 | 342 | } else { |
343 | - $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css; |
|
343 | + $href = ($this->app->type != 'app' ? '/' . $this->app->name : '') . $css; |
|
344 | 344 | } |
345 | 345 | $hrefs[$href] = $href; |
346 | 346 | } |
@@ -31,6 +31,9 @@ |
||
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); |
@@ -16,13 +16,13 @@ |
||
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) |
@@ -13,20 +13,22 @@ |
||
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 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | -require_once( INJI_SYSTEM_DIR . '/init.php' ); |
|
38 | +require_once(INJI_SYSTEM_DIR . '/init.php'); |
|
39 | 39 | /** |
40 | 40 | * System error messages |
41 | 41 | */ |
@@ -86,7 +86,7 @@ |
||
86 | 86 | echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>"; |
87 | 87 | } |
88 | 88 | } |
89 | - echo '<tr><th>Summary</th><th>' . round(( microtime(true) - $this->startTime), 5) . '</th></tr>'; |
|
89 | + echo '<tr><th>Summary</th><th>' . round((microtime(true) - $this->startTime), 5) . '</th></tr>'; |
|
90 | 90 | echo '<tr><th>Memory</th><th>' . $this->convertSize(memory_get_peak_usage()) . ' of ' . ini_get('memory_limit') . '</th></tr></table></div>'; |
91 | 91 | } |
92 | 92 |
@@ -79,10 +79,12 @@ discard block |
||
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 |
||
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() |