@@ -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 | } |
@@ -16,10 +16,11 @@ discard block |
||
16 | 16 | $objects = VLFInterpreter::run (new VLFParser ($vlf, $settings)); |
17 | 17 | $designers = []; |
18 | 18 | |
19 | - foreach ($objects as $name => $object) |
|
20 | - if ($object instanceof Form) |
|
19 | + foreach ($objects as $name => $object) { |
|
20 | + if ($object instanceof Form) |
|
21 | 21 | { |
22 | 22 | $page = new TabPage ($name); |
23 | + } |
|
23 | 24 | $designers[$object->selector] = new VoidDesigner ($page, $name, $propertyGrid, $eventsList, $currentSelectedItem, $formsList, $object); |
24 | 25 | |
25 | 26 | $designers[$object->selector]->form->text = $object->text; |
@@ -28,20 +29,19 @@ discard block |
||
28 | 29 | |
29 | 30 | $formsList->items->add ($page); |
30 | 31 | $formsList->selectedTab = $page->selector; |
31 | - } |
|
32 | - |
|
33 | - elseif ($object instanceof Control) |
|
34 | - try |
|
32 | + } elseif ($object instanceof Control) { |
|
33 | + try |
|
35 | 34 | { |
36 | 35 | $parent = $object->parent; |
37 | - while (!isset ($designers[$parent->selector]) && $parent->parent) |
|
38 | - $parent = $parent->parent; |
|
39 | - |
|
40 | - if (isset ($designers[$parent->selector])) |
|
41 | - $designers[$parent->selector]->addComponent ($object->selector, $name); |
|
42 | - } |
|
43 | - |
|
44 | - catch (\Throwable $e) {} |
|
36 | + } |
|
37 | + while (!isset ($designers[$parent->selector]) && $parent->parent) { |
|
38 | + $parent = $parent->parent; |
|
39 | + } |
|
40 | + |
|
41 | + if (isset ($designers[$parent->selector])) { |
|
42 | + $designers[$parent->selector]->addComponent ($object->selector, $name); |
|
43 | + } |
|
44 | + } catch (\Throwable $e) {} |
|
45 | 45 | |
46 | 46 | return $designers; |
47 | 47 | } |
@@ -22,19 +22,20 @@ discard block |
||
22 | 22 | |
23 | 23 | public static function run ($syntaxTree, string $resourcesDir = null, array $parent = null): array |
24 | 24 | { |
25 | - if ($syntaxTree instanceof VLFParser) |
|
26 | - $syntaxTree = $syntaxTree->tree; |
|
27 | - |
|
28 | - elseif (!is_array ($syntaxTree) && self::$throw_errors) |
|
29 | - throw new \Exception ('$syntaxTree argument must be instance of VoidEngine\VLFParser or contains Abstract Syntax Tree - multi-dimensional array'); |
|
25 | + if ($syntaxTree instanceof VLFParser) { |
|
26 | + $syntaxTree = $syntaxTree->tree; |
|
27 | + } elseif (!is_array ($syntaxTree) && self::$throw_errors) { |
|
28 | + throw new \Exception ('$syntaxTree argument must be instance of VoidEngine\VLFParser or contains Abstract Syntax Tree - multi-dimensional array'); |
|
29 | + } |
|
30 | 30 | |
31 | - foreach ($syntaxTree as $id => $syntaxInfo) |
|
32 | - if (isset ($syntaxInfo['type'])) |
|
31 | + foreach ($syntaxTree as $id => $syntaxInfo) { |
|
32 | + if (isset ($syntaxInfo['type'])) |
|
33 | 33 | { |
34 | 34 | switch ($syntaxInfo['type']) |
35 | 35 | { |
36 | 36 | case VLF_OBJECT_DEFINITION: |
37 | 37 | $class = $syntaxInfo['info']['object_class']; |
38 | + } |
|
38 | 39 | $name = $syntaxInfo['info']['object_name']; |
39 | 40 | $args = []; |
40 | 41 | |
@@ -42,12 +43,15 @@ discard block |
||
42 | 43 | { |
43 | 44 | $args = $syntaxInfo['info']['arguments']; |
44 | 45 | |
45 | - foreach ($args as $arg_id => $arg) |
|
46 | - if (is_object ($arg) && $arg instanceof VLFLink) |
|
46 | + foreach ($args as $arg_id => $arg) { |
|
47 | + if (is_object ($arg) && $arg instanceof VLFLink) |
|
47 | 48 | $args[$arg_id] = isset (self::$objects[$arg->name]) ? |
48 | 49 | self::formatLine ($arg->name, self::$objects) : null; |
50 | + } |
|
49 | 51 | |
50 | - else $args[$arg_id] = self::formatLine ($arg, self::$objects); |
|
52 | + else { |
|
53 | + $args[$arg_id] = self::formatLine ($arg, self::$objects); |
|
54 | + } |
|
51 | 55 | } |
52 | 56 | |
53 | 57 | try |
@@ -57,15 +61,12 @@ discard block |
||
57 | 61 | try |
58 | 62 | { |
59 | 63 | self::$objects[$name]->name = $name; |
60 | - } |
|
61 | - |
|
62 | - catch (\Throwable $e) {} |
|
63 | - } |
|
64 | - |
|
65 | - catch (\Throwable $e) |
|
64 | + } catch (\Throwable $e) {} |
|
65 | + } catch (\Throwable $e) |
|
66 | 66 | { |
67 | - if (self::$throw_errors) |
|
68 | - throw new \Exception ('Interpeter couldn\'t create object "'. $class .'" with name "'. $name .'" at line "'. $syntaxInfo['line'] .'". Exception info:'. "\n\n". (string) $e, 0, $e); |
|
67 | + if (self::$throw_errors) { |
|
68 | + throw new \Exception ('Interpeter couldn\'t create object "'. $class .'" with name "'. $name .'" at line "'. $syntaxInfo['line'] .'". Exception info:'. "\n\n". (string) $e, 0, $e); |
|
69 | + } |
|
69 | 70 | } |
70 | 71 | break; |
71 | 72 | |
@@ -80,23 +81,24 @@ discard block |
||
80 | 81 | $propertyValue = $syntaxInfo['info']['property_value']; |
81 | 82 | $preset = ''; |
82 | 83 | |
83 | - if (is_object ($propertyValue) && $propertyValue instanceof VLFLink) |
|
84 | - $propertyValue = isset (self::$objects[$propertyValue->name]) ? |
|
84 | + if (is_object ($propertyValue) && $propertyValue instanceof VLFLink) { |
|
85 | + $propertyValue = isset (self::$objects[$propertyValue->name]) ? |
|
85 | 86 | self::formatLine ($propertyValue->name, self::$objects) : null; |
86 | - |
|
87 | - elseif (preg_match ('/function \((.*)\) use \((.*)\)/', $propertyValue)) |
|
87 | + } elseif (preg_match ('/function \((.*)\) use \((.*)\)/', $propertyValue)) |
|
88 | 88 | { |
89 | 89 | $use = substr ($propertyValue, strpos ($propertyValue, 'use')); |
90 | 90 | $use = $ouse = substr ($use, ($pos = strpos ($use, '(') + 1), strpos ($use, ')') - $pos); |
91 | 91 | $use = explode (' ', $use); |
92 | 92 | |
93 | - foreach ($use as $id => $useParam) |
|
94 | - if (isset (self::$objects[$useParam]) && $use[$id + 1][0] == '$') |
|
93 | + foreach ($use as $id => $useParam) { |
|
94 | + if (isset (self::$objects[$useParam]) && $use[$id + 1][0] == '$') |
|
95 | 95 | { |
96 | 96 | $fname = $use[$id + 1]; |
97 | + } |
|
97 | 98 | |
98 | - if (substr ($fname, strlen ($fname) - 1) == ',') |
|
99 | - $fname = substr ($fname, 0, -1); |
|
99 | + if (substr ($fname, strlen ($fname) - 1) == ',') { |
|
100 | + $fname = substr ($fname, 0, -1); |
|
101 | + } |
|
100 | 102 | |
101 | 103 | $preset .= "$fname = $useParam; "; |
102 | 104 | |
@@ -105,37 +107,34 @@ discard block |
||
105 | 107 | |
106 | 108 | $preset = self::formatLine ($preset, self::$objects); |
107 | 109 | $propertyValue = self::formatLine (str_replace ($ouse, join (' ', $use), $propertyValue), self::$objects); |
110 | + } else { |
|
111 | + $propertyValue = self::formatLine ($propertyValue, self::$objects); |
|
108 | 112 | } |
109 | 113 | |
110 | - else $propertyValue = self::formatLine ($propertyValue, self::$objects); |
|
111 | - |
|
112 | 114 | try |
113 | 115 | { |
114 | 116 | self::$objects[$name]->$propertyName = eval ("namespace VoidEngine; $preset return $propertyValue;"); |
115 | - } |
|
116 | - |
|
117 | - catch (\Throwable $e) |
|
117 | + } catch (\Throwable $e) |
|
118 | 118 | { |
119 | 119 | try |
120 | 120 | { |
121 | 121 | $propertyValue = $syntaxInfo['info']['property_raw_value']; |
122 | 122 | |
123 | - if (strpos ($propertyName, '->') !== false) |
|
124 | - eval ('namespace VoidEngine; '. $preset .' _c('. self::$objects[$name]->selector .')->'. $propertyName .' = '. $propertyValue .';'); |
|
125 | - |
|
126 | - else self::$objects[$name]->$propertyName = eval ("namespace VoidEngine; $preset return $propertyValue;"); |
|
127 | - } |
|
128 | - |
|
129 | - catch (\Throwable $e) |
|
123 | + if (strpos ($propertyName, '->') !== false) { |
|
124 | + eval ('namespace VoidEngine; '. $preset .' _c('. self::$objects[$name]->selector .')->'. $propertyName .' = '. $propertyValue .';'); |
|
125 | + } else { |
|
126 | + self::$objects[$name]->$propertyName = eval ("namespace VoidEngine; $preset return $propertyValue;"); |
|
127 | + } |
|
128 | + } catch (\Throwable $e) |
|
130 | 129 | { |
131 | - if (self::$throw_errors) |
|
132 | - throw new \Exception ('Interpeter couldn\'t set property "'. $propertyName .'" with value "'. $propertyValue .'" at line "'. $syntaxInfo['line'] .'". Exception info:'. "\n\n". (string) $e, 0, $e); |
|
130 | + if (self::$throw_errors) { |
|
131 | + throw new \Exception ('Interpeter couldn\'t set property "'. $propertyName .'" with value "'. $propertyValue .'" at line "'. $syntaxInfo['line'] .'". Exception info:'. "\n\n". (string) $e, 0, $e); |
|
132 | + } |
|
133 | 133 | } |
134 | 134 | } |
135 | + } elseif (self::$throw_errors) { |
|
136 | + throw new \Exception ('Setting property to an non-object at line "'. $syntaxInfo['line']); |
|
135 | 137 | } |
136 | - |
|
137 | - elseif (self::$throw_errors) |
|
138 | - throw new \Exception ('Setting property to an non-object at line "'. $syntaxInfo['line']); |
|
139 | 138 | break; |
140 | 139 | |
141 | 140 | case VLF_METHOD_CALL: |
@@ -144,30 +143,32 @@ discard block |
||
144 | 143 | $methodName = $syntaxInfo['info']['method_name']; |
145 | 144 | $methodArgs = $syntaxInfo['info']['method_arguments']; |
146 | 145 | |
147 | - foreach ($methodArgs as $arg_id => $arg) |
|
148 | - if (is_object ($arg) && $arg instanceof VLFLink) |
|
146 | + foreach ($methodArgs as $arg_id => $arg) { |
|
147 | + if (is_object ($arg) && $arg instanceof VLFLink) |
|
149 | 148 | $methodArgs[$arg_id] = isset (self::$objects[$arg->name]) ? |
150 | 149 | self::formatLine ($arg->name, self::$objects) : null; |
150 | + } |
|
151 | 151 | |
152 | - else $methodArgs[$arg_id] = self::formatLine ($arg, self::$objects); |
|
152 | + else { |
|
153 | + $methodArgs[$arg_id] = self::formatLine ($arg, self::$objects); |
|
154 | + } |
|
153 | 155 | |
154 | 156 | try |
155 | 157 | { |
156 | - if (strpos ($methodName, '->') !== false && self::$allow_multimethods_calls) |
|
157 | - eval ('namespace VoidEngine; _c('. self::$objects[$name]->selector .')->'. $methodName .' ('. implode (', ', $methodArgs) .');'); |
|
158 | - |
|
159 | - else self::$objects[$name]->$methodName (...$methodArgs); |
|
160 | - } |
|
161 | - |
|
162 | - catch (\Throwable $e) |
|
158 | + if (strpos ($methodName, '->') !== false && self::$allow_multimethods_calls) { |
|
159 | + eval ('namespace VoidEngine; _c('. self::$objects[$name]->selector .')->'. $methodName .' ('. implode (', ', $methodArgs) .');'); |
|
160 | + } else { |
|
161 | + self::$objects[$name]->$methodName (...$methodArgs); |
|
162 | + } |
|
163 | + } catch (\Throwable $e) |
|
163 | 164 | { |
164 | - if (self::$throw_errors) |
|
165 | - throw new \Exception ('Interpeter couldn\'t call method "'. $methodName .'" with arguments '. json_encode ($methodArgs) .' at line "'. $syntaxInfo['line'] .'". Exception info:'. "\n\n". (string) $e, 0, $e); |
|
165 | + if (self::$throw_errors) { |
|
166 | + throw new \Exception ('Interpeter couldn\'t call method "'. $methodName .'" with arguments '. json_encode ($methodArgs) .' at line "'. $syntaxInfo['line'] .'". Exception info:'. "\n\n". (string) $e, 0, $e); |
|
167 | + } |
|
166 | 168 | } |
169 | + } elseif (self::$throw_errors) { |
|
170 | + throw new \Exception ('Calling method to an non-object at line "'. $syntaxInfo['line'] .'"'); |
|
167 | 171 | } |
168 | - |
|
169 | - elseif (self::$throw_errors) |
|
170 | - throw new \Exception ('Calling method to an non-object at line "'. $syntaxInfo['line'] .'"'); |
|
171 | 172 | break; |
172 | 173 | |
173 | 174 | case VLF_RUNTIME_EXECUTABLE: |
@@ -175,16 +176,18 @@ discard block |
||
175 | 176 | break; |
176 | 177 | } |
177 | 178 | |
178 | - if (isset ($syntaxInfo['syntax_nodes']) && sizeof ($syntaxInfo['syntax_nodes']) > 0) |
|
179 | - self::$objects = self::run ($syntaxInfo['syntax_nodes'], null, $syntaxInfo); |
|
179 | + if (isset ($syntaxInfo['syntax_nodes']) && sizeof ($syntaxInfo['syntax_nodes']) > 0) { |
|
180 | + self::$objects = self::run ($syntaxInfo['syntax_nodes'], null, $syntaxInfo); |
|
181 | + } |
|
182 | + } else { |
|
183 | + throw new \Exception ('Catched unknown syntax node: "'. json_encode ($syntaxInfo) .'"'); |
|
180 | 184 | } |
181 | 185 | |
182 | - else throw new \Exception ('Catched unknown syntax node: "'. json_encode ($syntaxInfo) .'"'); |
|
183 | - |
|
184 | - if (is_dir ($resourcesDir)) |
|
185 | - foreach (glob ($resourcesDir .'/*.vrsf') as $id => $dir) |
|
186 | + if (is_dir ($resourcesDir)) { |
|
187 | + foreach (glob ($resourcesDir .'/*.vrsf') as $id => $dir) |
|
186 | 188 | { |
187 | 189 | $baseName = basenameNoExt ($dir); |
190 | + } |
|
188 | 191 | $info = explode ('.', $baseName); |
189 | 192 | |
190 | 193 | if (isset (self::$objects[$info[0]])) |
@@ -194,9 +197,9 @@ discard block |
||
194 | 197 | $collection = VoidEngine::getProperty (self::$objects[$info[0]]->selector, $info[1]); |
195 | 198 | |
196 | 199 | VoidEngine::callMethod ($collection, 'Add', [VoidEngine::importObject (base64_encode (file_get_contents ($dir))), 'object']); |
200 | + } else { |
|
201 | + VoidEngine::setProperty (self::$objects[$info[0]]->selector, $info[1], VoidEngine::importObject (base64_encode (file_get_contents ($dir)))); |
|
197 | 202 | } |
198 | - |
|
199 | - else VoidEngine::setProperty (self::$objects[$info[0]]->selector, $info[1], VoidEngine::importObject (base64_encode (file_get_contents ($dir)))); |
|
200 | 203 | } |
201 | 204 | } |
202 | 205 | |
@@ -236,8 +239,9 @@ discard block |
||
236 | 239 | |
237 | 240 | $nReplacement = []; |
238 | 241 | |
239 | - foreach ($replacement as $replaceTo => $nLn) |
|
240 | - $nReplacement[$omap[$replaceTo]] = $replaceTo; |
|
242 | + foreach ($replacement as $replaceTo => $nLn) { |
|
243 | + $nReplacement[$omap[$replaceTo]] = $replaceTo; |
|
244 | + } |
|
241 | 245 | |
242 | 246 | $replacement = $nReplacement; |
243 | 247 | $blacklist = array_flip (['\'', '"', '$']); |
@@ -246,10 +250,11 @@ discard block |
||
246 | 250 | { |
247 | 251 | $replaced = false; |
248 | 252 | |
249 | - foreach ($replacement as $name => $replaceAt) |
|
250 | - if (substr ($line, $i, ($l = strlen ($name))) == $name && !isset ($blacklist[$line[$i - 1]])) |
|
253 | + foreach ($replacement as $name => $replaceAt) { |
|
254 | + if (substr ($line, $i, ($l = strlen ($name))) == $name && !isset ($blacklist[$line[$i - 1]])) |
|
251 | 255 | { |
252 | 256 | $newLine .= $replaceAt; |
257 | + } |
|
253 | 258 | |
254 | 259 | $i += $l - 1; |
255 | 260 | $replaced = true; |
@@ -257,8 +262,9 @@ discard block |
||
257 | 262 | break; |
258 | 263 | } |
259 | 264 | |
260 | - if (!$replaced) |
|
261 | - $newLine .= $line[$i]; |
|
265 | + if (!$replaced) { |
|
266 | + $newLine .= $line[$i]; |
|
267 | + } |
|
262 | 268 | } |
263 | 269 | |
264 | 270 | $line = $newLine; |
@@ -78,15 +78,14 @@ |
||
78 | 78 | |
79 | 79 | public function __call ($method, $args) |
80 | 80 | { |
81 | - if (method_exists ($this, $method)) |
|
82 | - return $this->$method (...$args); |
|
83 | - |
|
84 | - else try |
|
81 | + if (method_exists ($this, $method)) { |
|
82 | + return $this->$method (...$args); |
|
83 | + } else { |
|
84 | + try |
|
85 | 85 | { |
86 | 86 | return $this->WinAPI->$method (...$args); |
87 | 87 | } |
88 | - |
|
89 | - catch (\Throwable $e) |
|
88 | + } catch (\Throwable $e) |
|
90 | 89 | { |
91 | 90 | throw new \Exception ('Method "'. $method .'" not found or return an exception. Exception info: '. "\n\n". (string) $e); |
92 | 91 | } |
@@ -15,16 +15,15 @@ |
||
15 | 15 | |
16 | 16 | public function run ($form = null): void |
17 | 17 | { |
18 | - if ($form instanceof WFObject) |
|
19 | - $this->application->run ($form->selector); |
|
20 | - |
|
21 | - elseif (is_int ($form) && VoidEngine::objectExists ($form)) |
|
22 | - $this->application->run ($form); |
|
23 | - |
|
24 | - elseif ($form === null) |
|
25 | - $this->application->run (); |
|
26 | - |
|
27 | - else throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector'); |
|
18 | + if ($form instanceof WFObject) { |
|
19 | + $this->application->run ($form->selector); |
|
20 | + } elseif (is_int ($form) && VoidEngine::objectExists ($form)) { |
|
21 | + $this->application->run ($form); |
|
22 | + } elseif ($form === null) { |
|
23 | + $this->application->run (); |
|
24 | + } else { |
|
25 | + throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector'); |
|
26 | + } |
|
28 | 27 | } |
29 | 28 | |
30 | 29 | public function restart (): void |
@@ -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); |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | |
41 | 41 | public function set_syntax ($syntax) |
42 | 42 | { |
43 | - if (file_exists ($syntax)) |
|
44 | - $syntax = file_get_contents ($syntax); |
|
43 | + if (file_exists ($syntax)) { |
|
44 | + $syntax = file_get_contents ($syntax); |
|
45 | + } |
|
45 | 46 | |
46 | 47 | $syntax = json_decode ($syntax, true); |
47 | 48 | |
@@ -49,30 +50,33 @@ discard block |
||
49 | 50 | !is_array ($syntax['syntax']) || |
50 | 51 | !is_array ($syntax['references']) || |
51 | 52 | !isset ($syntax['lexer']) |
52 | - ) return false; |
|
53 | - |
|
54 | - else |
|
53 | + ) { |
|
54 | + return false; |
|
55 | + } else |
|
55 | 56 | { |
56 | 57 | $this->resetSyntax (); |
57 | 58 | $this->clearSyntax (); |
58 | 59 | |
59 | - foreach ($syntax['references'] as $name => $value) |
|
60 | - if (isset ($syntax['syntax'][$name])) |
|
60 | + foreach ($syntax['references'] as $name => $value) { |
|
61 | + if (isset ($syntax['syntax'][$name])) |
|
61 | 62 | { |
62 | 63 | $element = VoidEngine::getArrayValue ($this->styles, $value); |
64 | + } |
|
63 | 65 | $color = $syntax['syntax'][$name]; |
64 | 66 | |
65 | - if (defined ($color)) |
|
66 | - $color = constant ($color); |
|
67 | + if (defined ($color)) { |
|
68 | + $color = constant ($color); |
|
69 | + } |
|
67 | 70 | |
68 | 71 | VoidEngine::setProperty ($element, 'ForeColor', [$color, 'color']); |
69 | 72 | } |
70 | 73 | |
71 | 74 | $this->lexer = $syntax['lexer']; |
72 | 75 | |
73 | - if (is_array ($syntax['keywords'])) |
|
74 | - foreach ($syntax['keywords'] as $id => $keywords) |
|
76 | + if (is_array ($syntax['keywords'])) { |
|
77 | + foreach ($syntax['keywords'] as $id => $keywords) |
|
75 | 78 | $this->setKeywords ($id, $keywords); |
79 | + } |
|
76 | 80 | |
77 | 81 | $this->propertyInit ('fold', 1); |
78 | 82 | $this->propertyInit ('fold.compact', 1); |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | { |
38 | 38 | Components::removeComponent ($this->$name); |
39 | 39 | |
40 | - if (VoidEngine::objectExists ($this->$name)) |
|
41 | - VoidEngine::removeObjects ($this->$name); |
|
40 | + if (VoidEngine::objectExists ($this->$name)) { |
|
41 | + VoidEngine::removeObjects ($this->$name); |
|
42 | + } |
|
43 | + } elseif ($this->$name instanceof Component) { |
|
44 | + $this->$name->dispose (); |
|
42 | 45 | } |
43 | - |
|
44 | - elseif ($this->$name instanceof Component) |
|
45 | - $this->$name->dispose (); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | unset ($this->$name); |
@@ -56,20 +56,21 @@ discard block |
||
56 | 56 | { |
57 | 57 | Components::removeComponent ($value); |
58 | 58 | |
59 | - if (VoidEngine::objectExists ($value)) |
|
60 | - VoidEngine::removeObjects ($value); |
|
59 | + if (VoidEngine::objectExists ($value)) { |
|
60 | + VoidEngine::removeObjects ($value); |
|
61 | + } |
|
62 | + } elseif ($value instanceof Component) { |
|
63 | + $value->dispose (); |
|
61 | 64 | } |
62 | 65 | |
63 | - elseif ($value instanceof Component) |
|
64 | - $value->dispose (); |
|
65 | - |
|
66 | 66 | unset ($this->$param); |
67 | 67 | } |
68 | 68 | |
69 | 69 | if (isset ($this->selector)) |
70 | 70 | { |
71 | - if (VoidEngine::objectExists ($this->selector)) |
|
72 | - VoidEngine::removeObjects ($this->selector); |
|
71 | + if (VoidEngine::objectExists ($this->selector)) { |
|
72 | + VoidEngine::removeObjects ($this->selector); |
|
73 | + } |
|
73 | 74 | |
74 | 75 | Components::removeComponent ($this->selector); |
75 | 76 | } |
@@ -11,9 +11,7 @@ |
||
11 | 11 | try |
12 | 12 | { |
13 | 13 | $node = $this->selectedNode; |
14 | - } |
|
15 | - |
|
16 | - catch (\Throwable $e) |
|
14 | + } catch (\Throwable $e) |
|
17 | 15 | { |
18 | 16 | return false; |
19 | 17 | } |