@@ -4,17 +4,22 @@ |
||
4 | 4 | |
5 | 5 | function dir_copy (string $from, string $to): bool |
6 | 6 | { |
7 | - if (!is_dir ($from)) |
|
8 | - return false; |
|
7 | + if (!is_dir ($from)) { |
|
8 | + return false; |
|
9 | + } |
|
9 | 10 | |
10 | - if (!is_dir ($to)) |
|
11 | - dir_create ($to); |
|
11 | + if (!is_dir ($to)) { |
|
12 | + dir_create ($to); |
|
13 | + } |
|
12 | 14 | |
13 | - foreach (array_slice (scandir ($from), 2) as $file) |
|
14 | - if (is_dir ($f = $from .'/'. $file)) |
|
15 | + foreach (array_slice (scandir ($from), 2) as $file) { |
|
16 | + if (is_dir ($f = $from .'/'. $file)) |
|
15 | 17 | dir_copy ($f, $to .'/'. $file); |
18 | + } |
|
16 | 19 | |
17 | - else copy ($f, $to .'/'. $file); |
|
20 | + else { |
|
21 | + copy ($f, $to .'/'. $file); |
|
22 | + } |
|
18 | 23 | |
19 | 24 | return true; |
20 | 25 | } |
@@ -338,8 +338,9 @@ |
||
338 | 338 | 'clLight' => $converter->fromHtml ('#EEEEEE') |
339 | 339 | ]; |
340 | 340 | |
341 | -foreach ($constants as $name => $value) |
|
341 | +foreach ($constants as $name => $value) { |
|
342 | 342 | define ($name, $value); |
343 | +} |
|
343 | 344 | |
344 | 345 | $argv = START_PARAMS; |
345 | 346 | $argc = sizeof ($argv); |
@@ -8,9 +8,10 @@ |
||
8 | 8 | define ('VoidEngine\CORE_DIR', dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/core'); |
9 | 9 | |
10 | 10 | # Подгружаем PHP расширения |
11 | -foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext) |
|
11 | +foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext) { |
|
12 | 12 | if (!extension_loaded (substr (basename ($ext), 4, -4))) |
13 | 13 | load_extension ($ext); |
14 | +} |
|
14 | 15 | |
15 | 16 | # Подгружаем Qero-пакеты |
16 | 17 | require __DIR__ .'/../qero-packages/autoload.php'; |
@@ -5,18 +5,21 @@ |
||
5 | 5 | const CORE_DIR = __DIR__; |
6 | 6 | chdir (CORE_DIR); |
7 | 7 | |
8 | -foreach (glob ('ext/php_*.dll') as $ext) |
|
8 | +foreach (glob ('ext/php_*.dll') as $ext) { |
|
9 | 9 | if (!extension_loaded (substr (basename ($ext), 4, -4))) |
10 | 10 | load_extension ($ext); |
11 | +} |
|
11 | 12 | |
12 | -if (file_exists ('../engine/VoidEngine.php')) |
|
13 | +if (file_exists ('../engine/VoidEngine.php')) { |
|
13 | 14 | require '../engine/VoidEngine.php'; |
14 | - |
|
15 | -else message ('VoidEngine not founded'); |
|
15 | +} else { |
|
16 | + message ('VoidEngine not founded'); |
|
17 | +} |
|
16 | 18 | |
17 | 19 | $app = '../../app/start.php'; |
18 | 20 | |
19 | -if (file_exists ($app)) |
|
21 | +if (file_exists ($app)) { |
|
20 | 22 | require $app; |
21 | - |
|
22 | -else \VoidCore::callMethod (\VoidCore::createObject ('WinForms_PHP.DebugForm'), 'ShowDialog'); |
|
23 | +} else { |
|
24 | + \VoidCore::callMethod (\VoidCore::createObject ('WinForms_PHP.DebugForm'), 'ShowDialog'); |
|
25 | +} |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | $code = "<?php\n\nnamespace VoidEngine;\n\n"; |
10 | 10 | $definedObjects = []; |
11 | 11 | |
12 | - foreach ($tree->getNodes () as $node) |
|
13 | - $code .= self::translateNode ($node, null, $definedObjects) ."\n"; |
|
12 | + foreach ($tree->getNodes () as $node) { |
|
13 | + $code .= self::translateNode ($node, null, $definedObjects) ."\n"; |
|
14 | + } |
|
14 | 15 | |
15 | 16 | return $code; |
16 | 17 | } |
@@ -27,8 +28,9 @@ discard block |
||
27 | 28 | break; |
28 | 29 | |
29 | 30 | case OBJECT_DEFINITION: |
30 | - if (isset ($definedObjects[$node->args['name']])) |
|
31 | - break; |
|
31 | + if (isset ($definedObjects[$node->args['name']])) { |
|
32 | + break; |
|
33 | + } |
|
32 | 34 | |
33 | 35 | $code .= '$'. $node->args['name'] .' = new '. $node->args['class'] .' ('. implode (', ', self::processArgs ($node->args['args'], $definedObjects)) .');' ."\n". '$'. $node->args['name'] .'->name = \''. $node->args['name'] .'\';' ."\n"; |
34 | 36 | |
@@ -45,13 +47,15 @@ discard block |
||
45 | 47 | $use = $ouse = substr ($use, ($pos = strpos ($use, '(') + 1), strpos ($use, ')') - $pos); |
46 | 48 | $use = explode (' ', $use); |
47 | 49 | |
48 | - foreach ($use as $id => $useParam) |
|
49 | - if (isset ($definedObjects[$useParam]) && $use[$id + 1][0] == '$') |
|
50 | + foreach ($use as $id => $useParam) { |
|
51 | + if (isset ($definedObjects[$useParam]) && $use[$id + 1][0] == '$') |
|
50 | 52 | { |
51 | 53 | $fname = $use[$id + 1]; |
54 | + } |
|
52 | 55 | |
53 | - if (substr ($fname, strlen ($fname) - 1) == ',') |
|
54 | - $fname = substr ($fname, 0, -1); |
|
56 | + if (substr ($fname, strlen ($fname) - 1) == ',') { |
|
57 | + $fname = substr ($fname, 0, -1); |
|
58 | + } |
|
55 | 59 | |
56 | 60 | $preset .= "$fname = $useParam; "; |
57 | 61 | |
@@ -73,8 +77,9 @@ discard block |
||
73 | 77 | break; |
74 | 78 | } |
75 | 79 | |
76 | - foreach ($node->getNodes () as $subnode) |
|
77 | - $code .= self::translateNode ($subnode, $node, $definedObjects); |
|
80 | + foreach ($node->getNodes () as $subnode) { |
|
81 | + $code .= self::translateNode ($subnode, $node, $definedObjects); |
|
82 | + } |
|
78 | 83 | |
79 | 84 | return $code; |
80 | 85 | } |
@@ -83,8 +88,9 @@ discard block |
||
83 | 88 | { |
84 | 89 | $newArgs = []; |
85 | 90 | |
86 | - foreach ($args as $arg) |
|
87 | - $newArgs[] = self::formatLine ($arg, $definedObjects); |
|
91 | + foreach ($args as $arg) { |
|
92 | + $newArgs[] = self::formatLine ($arg, $definedObjects); |
|
93 | + } |
|
88 | 94 | |
89 | 95 | return $newArgs; |
90 | 96 | } |
@@ -110,8 +116,9 @@ discard block |
||
110 | 116 | |
111 | 117 | $nReplacement = []; |
112 | 118 | |
113 | - foreach ($replacement as $replaceTo => $nLn) |
|
114 | - $nReplacement[$omap[$replaceTo]] = $replaceTo; |
|
119 | + foreach ($replacement as $replaceTo => $nLn) { |
|
120 | + $nReplacement[$omap[$replaceTo]] = $replaceTo; |
|
121 | + } |
|
115 | 122 | |
116 | 123 | $replacement = $nReplacement; |
117 | 124 | $blacklist = array_flip (['\'', '"', '$']); |
@@ -120,10 +127,11 @@ discard block |
||
120 | 127 | { |
121 | 128 | $replaced = false; |
122 | 129 | |
123 | - foreach ($replacement as $name => $replaceAt) |
|
124 | - if (substr ($line, $i, ($l = strlen ($name))) == $name && !isset ($blacklist[$line[$i - 1]])) |
|
130 | + foreach ($replacement as $name => $replaceAt) { |
|
131 | + if (substr ($line, $i, ($l = strlen ($name))) == $name && !isset ($blacklist[$line[$i - 1]])) |
|
125 | 132 | { |
126 | 133 | $newLine .= $replaceAt; |
134 | + } |
|
127 | 135 | |
128 | 136 | $i += $l - 1; |
129 | 137 | $replaced = true; |
@@ -131,8 +139,9 @@ discard block |
||
131 | 139 | break; |
132 | 140 | } |
133 | 141 | |
134 | - if (!$replaced) |
|
135 | - $newLine .= $line[$i]; |
|
142 | + if (!$replaced) { |
|
143 | + $newLine .= $line[$i]; |
|
144 | + } |
|
136 | 145 | } |
137 | 146 | |
138 | 147 | $line = $newLine; |
@@ -22,8 +22,9 @@ |
||
22 | 22 | */ |
23 | 23 | public function __construct (array $node = null) |
24 | 24 | { |
25 | - if ($node !== null) |
|
26 | - $this->import ($node); |
|
25 | + if ($node !== null) { |
|
26 | + $this->import ($node); |
|
27 | + } |
|
27 | 28 | } |
28 | 29 | |
29 | 30 | /** |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function __construct (array $tree = null) |
19 | 19 | { |
20 | - if ($tree !== null) |
|
21 | - $this->import ($tree); |
|
20 | + if ($tree !== null) { |
|
21 | + $this->import ($tree); |
|
22 | + } |
|
22 | 23 | } |
23 | 24 | |
24 | 25 | /** |
@@ -30,8 +31,9 @@ discard block |
||
30 | 31 | */ |
31 | 32 | public function import (array $tree): AST |
32 | 33 | { |
33 | - foreach ($tree as $node) |
|
34 | - $this->nodes[] = new Node ($node); |
|
34 | + foreach ($tree as $node) { |
|
35 | + $this->nodes[] = new Node ($node); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | return $this; |
37 | 39 | } |
@@ -48,10 +48,12 @@ |
||
48 | 48 | require 'components/Component.php'; |
49 | 49 | require 'components/Control.php'; |
50 | 50 | |
51 | -foreach (glob ('components/*/*.php') as $name) |
|
51 | +foreach (glob ('components/*/*.php') as $name) { |
|
52 | 52 | require $name; |
53 | +} |
|
53 | 54 | |
54 | -if (file_exists ('extensions')) |
|
55 | +if (file_exists ('extensions')) { |
|
55 | 56 | foreach (scandir ('extensions') as $ext) |
56 | 57 | if (file_exists ($ext = 'extensions/'. $ext .'/main.php')) |
57 | 58 | require $ext; |
59 | +} |
@@ -12,13 +12,12 @@ |
||
12 | 12 | { |
13 | 13 | try |
14 | 14 | { |
15 | - foreach ($args as $id => $arg) |
|
16 | - $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
15 | + foreach ($args as $id => $arg) { |
|
16 | + $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
17 | + } |
|
17 | 18 | |
18 | 19 | return $function (_c ($sender) ?: new NetObject ($sender), ...$args); |
19 | - } |
|
20 | - |
|
21 | - catch (\Throwable $e) |
|
20 | + } catch (\Throwable $e) |
|
22 | 21 | { |
23 | 22 | message ([ |
24 | 23 | 'type' => get_class ($e), |