Passed
Branch master (4b7a9f)
by Observer
01:48
created
after_install.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,17 +4,22 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app_bundle/start.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,9 +11,10 @@
 block discarded – undo
11 11
 	dirname (__DIR__) .'/qero-packages/KRypt0nn/VoidFramework/'. $package['github:KRypt0nn/VoidFramework']['basefolder'] .'/core' : __DIR__);
12 12
 
13 13
 # Подгружаем PHP расширения
14
-foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext)
14
+foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext) {
15 15
 	if (!extension_loaded ($ext = substr (basename ($ext), 4, -4)))
16 16
 		dl ($ext);
17
+}
17 18
 
18 19
 # Подгружаем Qero-пакеты
19 20
 require __DIR__ .'/../qero-packages/autoload.php';
Please login to merge, or discard this patch.
engine/VoidEngine.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,8 @@
 block discarded – undo
101 101
 require 'components/Designer.php';
102 102
 require 'components/EventGrid.php';
103 103
 
104
-if (is_dir ('extensions'))
104
+if (is_dir ('extensions')) {
105 105
     foreach (scandir ('extensions') as $ext)
106 106
         if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php'))
107 107
             require $ext;
108
+}
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/importer.php 1 patch
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,10 +16,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/interpreter.php 1 patch
Braces   +78 added lines, -72 removed lines patch added patch discarded remove patch
@@ -22,19 +22,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/parser.php 1 patch
Braces   +98 added lines, -76 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function __construct (string $content, array $settings = [])
35 35
     {
36
-        if (file_exists ($content))
37
-            $content = file_get_contents ($content);
36
+        if (file_exists ($content)) {
37
+                    $content = file_get_contents ($content);
38
+        }
38 39
 
39 40
         // Зачем? Так надо!
40 41
         // ДА БАГ ЭТО, НЕ ПИ%ДИ!!! И Я ПОНЯТИЯ НЕ ИМЕЮ КАК И ПОЧЕМУ!!!
@@ -42,10 +43,11 @@  discard block
 block discarded – undo
42 43
 
43 44
         foreach ($settings as $name => $setting)
44 45
         {
45
-            if (isset ($this->$name))
46
-                $this->$name = $setting;
47
-
48
-            else throw new \Exception ('Trying to setting up undefined property "'. $name .'"');
46
+            if (isset ($this->$name)) {
47
+                            $this->$name = $setting;
48
+            } else {
49
+                throw new \Exception ('Trying to setting up undefined property "'. $name .'"');
50
+            }
49 51
         }
50 52
 
51 53
         if ($this->use_caching && file_exists ($file = text (VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache')))
@@ -58,9 +60,9 @@  discard block
 block discarded – undo
58 60
                 $this->links = $info[1][1];
59 61
 
60 62
                 return;
63
+            } else {
64
+                unlink ($file);
61 65
             }
62
-
63
-            else unlink ($file);
64 66
         }
65 67
 
66 68
         $info = $this->generateSyntaxTree ($content);
@@ -70,8 +72,9 @@  discard block
 block discarded – undo
70 72
 
71 73
         if ($this->use_caching)
72 74
         {
73
-            if (!is_dir (dirname (__DIR__) .'/cache'))
74
-                mkdir (dirname (__DIR__) .'/cache');
75
+            if (!is_dir (dirname (__DIR__) .'/cache')) {
76
+                            mkdir (dirname (__DIR__) .'/cache');
77
+            }
75 78
 
76 79
             file_put_contents (text (VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache'), gzdeflate (serialize ([sha1 (file_get_contents (text (__FILE__))), $info])));
77 80
         }
@@ -94,19 +97,22 @@  discard block
 block discarded – undo
94 97
         $tree           = [];
95 98
         $links          = [];
96 99
 
97
-        if ($this->debug_mode)
98
-            pre ($lines);
100
+        if ($this->debug_mode) {
101
+                    pre ($lines);
102
+        }
99 103
 
100 104
         foreach ($lines as $id => $line)
101 105
         {
102
-            if ($skip_at > $id)
103
-                continue;
106
+            if ($skip_at > $id) {
107
+                            continue;
108
+            }
104 109
 
105 110
             $height = $this->getLineHeight ($line);
106 111
             $words  = $this->linesFilter (explode (' ', $line));
107 112
 
108
-            if ($this->debug_mode)
109
-                pre ($words);
113
+            if ($this->debug_mode) {
114
+                            pre ($words);
115
+            }
110 116
 
111 117
             /**
112 118
              * Высокоинтеллектуальный фикс
@@ -127,16 +133,18 @@  discard block
 block discarded – undo
127 133
             {
128 134
                 $updated = false;
129 135
 
130
-                if ($this->debug_mode)
131
-                    pre ($current_object);
136
+                if ($this->debug_mode) {
137
+                                    pre ($current_object);
138
+                }
132 139
 
133 140
                 while (isset ($tree[$current_object]['info']['subparent_link']) && $tree[$link = $tree[$current_object]['info']['subparent_link']->link]['hard'] < $tree[$current_object]['hard'])
134 141
                 {
135 142
                     $current_object = $link;
136 143
                     $updated        = true;
137 144
 
138
-                    if ($this->debug_mode)
139
-                        pre ($current_object);
145
+                    if ($this->debug_mode) {
146
+                                            pre ($current_object);
147
+                    }
140 148
                 }
141 149
 
142 150
                 if (
@@ -145,13 +153,15 @@  discard block
 block discarded – undo
145 153
                     isset ($tree[$current_object]['info']['arguments'][0]) &&
146 154
                     $tree[$current_object]['info']['arguments'][0] instanceof VLFLink &&
147 155
                     $tree[$tree[$current_object]['info']['arguments'][0]->link]['hard'] < $tree[$current_object]['hard']
148
-                ) $current_object = $tree[$current_object]['info']['arguments'][0]->link;
149
-
150
-                elseif (!$updated)
151
-                    break;
156
+                ) {
157
+                    $current_object = $tree[$current_object]['info']['arguments'][0]->link;
158
+                } elseif (!$updated) {
159
+                                    break;
160
+                }
152 161
 
153
-                if ($this->debug_mode)
154
-                    pre ($current_object);
162
+                if ($this->debug_mode) {
163
+                                    pre ($current_object);
164
+                }
155 165
             }
156 166
 
157 167
             /**
@@ -159,8 +169,9 @@  discard block
 block discarded – undo
159 169
              */
160 170
             if (class_exists ($words[0]) || class_exists ('\VoidEngine\\'. $words[0]))
161 171
             {
162
-                if (!isset ($words[1]))
163
-                    throw new \Exception ('Object name mustn\'t be empty at line "'. $line .'"');
172
+                if (!isset ($words[1])) {
173
+                                    throw new \Exception ('Object name mustn\'t be empty at line "'. $line .'"');
174
+                }
164 175
 
165 176
                 /**
166 177
                  * Button NewButton
@@ -188,9 +199,7 @@  discard block
 block discarded – undo
188 199
                     $current_object = $id;
189 200
 
190 201
                     continue;
191
-                }
192
-
193
-                else
202
+                } else
194 203
                 {
195 204
                     $tree[$id] = [
196 205
                         'type'  => VLF_OBJECT_DEFINITION,
@@ -212,10 +221,9 @@  discard block
 block discarded – undo
212 221
                         
213 222
                         $end = strrpos ($line, ')');
214 223
 
215
-                        if ($end === false)
216
-                            throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
217
-
218
-                        elseif ($begin < $end)
224
+                        if ($end === false) {
225
+                                                    throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
226
+                        } elseif ($begin < $end)
219 227
                         {
220 228
                             $arguments = [];
221 229
                             $parsed    = explode (',', substr ($line, $begin, $end - $begin));
@@ -224,18 +232,20 @@  discard block
 block discarded – undo
224 232
                             {
225 233
                                 $argument = trim ($argument);
226 234
 
227
-                                if (strlen ($argument) > 0)
228
-                                    $arguments[] = isset ($links[$argument]) ?
235
+                                if (strlen ($argument) > 0) {
236
+                                                                    $arguments[] = isset ($links[$argument]) ?
229 237
                                         new VLFLink ($argument, $links[$argument]) :
230 238
                                         $argument;
231
-
232
-                                else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
239
+                                } else {
240
+                                    throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
241
+                                }
233 242
                             }
234 243
 
235 244
                             $tree[$id]['info']['arguments'] = $arguments;
236 245
 
237
-                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0)
238
-                                throw new \Exception ('You mustn\'t write any chars after arguments definition');
246
+                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0) {
247
+                                                            throw new \Exception ('You mustn\'t write any chars after arguments definition');
248
+                            }
239 249
                         }
240 250
 
241 251
                         $tree[$id]['info']['subparent_link'] = new VLFLink ($tree[$current_object]['info']['object_name'], $current_object);
@@ -299,13 +309,14 @@  discard block
 block discarded – undo
299 309
 
300 310
                         $comment .= $parsed[0];
301 311
                         $skip_at  = $parsed[1];
312
+                    } else {
313
+                        throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
302 314
                     }
303
-
304
-                    else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
305 315
                 }
306 316
                 
307
-                if ($this->debug_mode)
308
-                    pre ("Comment:\n\n$comment");
317
+                if ($this->debug_mode) {
318
+                                    pre ("Comment:\n\n$comment");
319
+                }
309 320
             }
310 321
 
311 322
             /**
@@ -327,9 +338,9 @@  discard block
 block discarded – undo
327 338
 
328 339
                         $code   .= $parsed[0];
329 340
                         $skip_at = $parsed[1];
341
+                    } else {
342
+                        throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
330 343
                     }
331
-
332
-                    else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
333 344
                 }
334 345
                 
335 346
                 $tree[$id] = [
@@ -384,8 +395,9 @@  discard block
 block discarded – undo
384 395
 
385 396
                 if ($postChar == ':' || $postChar == '^')
386 397
                 {
387
-                    if (!isset ($words[1]))
388
-                        throw new \Exception ('Property value mustn\'t be empty at line "'. $line .'"');
398
+                    if (!isset ($words[1])) {
399
+                                            throw new \Exception ('Property value mustn\'t be empty at line "'. $line .'"');
400
+                    }
389 401
 
390 402
                     $propertyName     = substr ($words[0], 0, -1);
391 403
                     $propertyValue    = implode (' ', array_slice ($words, 1));
@@ -420,8 +432,9 @@  discard block
 block discarded – undo
420 432
                         'syntax_nodes' => []
421 433
                     ];
422 434
 
423
-                    if (isset ($links[$info['info']['property_value']]))
424
-                        $info['info']['property_value'] = new VLFLink ($info['info']['property_value'], $links[$info['info']['property_value']]);
435
+                    if (isset ($links[$info['info']['property_value']])) {
436
+                                            $info['info']['property_value'] = new VLFLink ($info['info']['property_value'], $links[$info['info']['property_value']]);
437
+                    }
425 438
 
426 439
                     $tree[$current_object]['syntax_nodes'][] = $info;
427 440
                 }
@@ -439,10 +452,9 @@  discard block
 block discarded – undo
439 452
                         
440 453
                         $end = strrpos ($line, ')');
441 454
 
442
-                        if ($end === false)
443
-                            throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
444
-
445
-                        elseif ($begin < $end)
455
+                        if ($end === false) {
456
+                                                    throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
457
+                        } elseif ($begin < $end)
446 458
                         {
447 459
                             $parsed = explode (',', substr ($line, $begin, $end - $begin));
448 460
 
@@ -450,24 +462,27 @@  discard block
 block discarded – undo
450 462
                             {
451 463
                                 $argument = trim ($argument);
452 464
 
453
-                                if (strlen ($argument) > 0)
454
-                                    $arguments[] = isset ($links[$argument]) ?
465
+                                if (strlen ($argument) > 0) {
466
+                                                                    $arguments[] = isset ($links[$argument]) ?
455 467
                                         new VLFLink ($argument, $links[$argument]) :
456 468
                                         $argument;
457
-
458
-                                else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
469
+                                } else {
470
+                                    throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
471
+                                }
459 472
                             }
460 473
 
461
-                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0)
462
-                                throw new \Exception ('You mustn\'t write any chars after arguments definition');
474
+                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0) {
475
+                                                            throw new \Exception ('You mustn\'t write any chars after arguments definition');
476
+                            }
463 477
                         }
464 478
                     }
465 479
 
466 480
                     /**
467 481
                      * ->show
468 482
                      */
469
-                    elseif (!$this->ignore_unexpected_method_args)
470
-                        throw new \Exception ('Unexpected method arguments list at line "'. $line .'"');
483
+                    elseif (!$this->ignore_unexpected_method_args) {
484
+                                            throw new \Exception ('Unexpected method arguments list at line "'. $line .'"');
485
+                    }
471 486
 
472 487
                     $tree[$current_object]['syntax_nodes'][] = [
473 488
                         'type'  => VLF_METHOD_CALL,
@@ -520,7 +535,9 @@  discard block
 block discarded – undo
520 535
             /**
521 536
              * Что-то загадочное, таинственное, неизвестное человечеству
522 537
              */
523
-            else throw new \Exception ('Unknown structures founded at line "'. $line .'"');
538
+            else {
539
+                throw new \Exception ('Unknown structures founded at line "'. $line .'"');
540
+            }
524 541
         }
525 542
 
526 543
         return [$tree, $links];
@@ -542,8 +559,9 @@  discard block
 block discarded – undo
542 559
 
543 560
         foreach ($lines as $line_id => $line)
544 561
         {
545
-            if ($line_id <= $begin_id)
546
-                continue;
562
+            if ($line_id <= $begin_id) {
563
+                            continue;
564
+            }
547 565
 
548 566
             if (!(bool)(trim ($line)))
549 567
             {
@@ -554,13 +572,15 @@  discard block
 block discarded – undo
554 572
 
555 573
             $height = $this->getLineHeight ($line);
556 574
 
557
-            if ($this->debug_mode)
558
-                pre ("$height, $down_height, $line");
559
-
560
-            if ($height > $down_height)
561
-                $parsed .= "$line\n";
575
+            if ($this->debug_mode) {
576
+                            pre ("$height, $down_height, $line");
577
+            }
562 578
 
563
-            else break;
579
+            if ($height > $down_height) {
580
+                            $parsed .= "$line\n";
581
+            } else {
582
+                break;
583
+            }
564 584
         }
565 585
 
566 586
         return [$parsed, $line_id];
@@ -584,8 +604,9 @@  discard block
 block discarded – undo
584 604
     {
585 605
         $i = 0;
586 606
 
587
-        while (isset ($line[$i]) && $line[$i] == "\t")
588
-            ++$i;
607
+        while (isset ($line[$i]) && $line[$i] == "\t") {
608
+                    ++$i;
609
+        }
589 610
         
590 611
         return strlen ($line = str_repeat ('    ', $i) . substr ($line, $i)) - strlen ($line = trim ($line));
591 612
     }
@@ -602,8 +623,9 @@  discard block
 block discarded – undo
602 623
     {
603 624
         return array_filter ($segments, function ($text)
604 625
         {
605
-            if ($this->strong_line_parser && preg_match ('/[^a-z0-9]/i', $text))
606
-                throw new \Exception  ('Line "'. $text .'" mustn\'t have any not-alphabet or not-numeric characters');
626
+            if ($this->strong_line_parser && preg_match ('/[^a-z0-9]/i', $text)) {
627
+                            throw new \Exception  ('Line "'. $text .'" mustn\'t have any not-alphabet or not-numeric characters');
628
+            }
607 629
             
608 630
             return strlen (trim ($text)) > 0;
609 631
         });
Please login to merge, or discard this patch.
engine/extensions/WinAPI/main.php 1 patch
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,15 +78,14 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
engine/common/Globals.php 1 patch
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,16 +15,15 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
engine/common/EngineInterfaces.php 1 patch
Braces   +93 added lines, -99 removed lines patch added patch discarded remove patch
@@ -284,8 +284,9 @@  discard block
 block discarded – undo
284 284
 
285 285
     public static function setObjectEvent (int $selector, string $eventName, string $code): void
286 286
     {
287
-        if (self::eventExists ($selector, $eventName))
288
-            self::removeObjectEvent ($selector, $eventName);
287
+        if (self::eventExists ($selector, $eventName)) {
288
+                    self::removeObjectEvent ($selector, $eventName);
289
+        }
289 290
 
290 291
         \VoidCore::setEvent ($selector, $eventName, $code);
291 292
         Components::setComponentEvent ($selector, $eventName, $code);
@@ -382,30 +383,37 @@  discard block
 block discarded – undo
382 383
 
383 384
     public static function compile (string $savePath, string $iconPath, string $phpCode, string $productDescription = null, string $productName = null, string $productVersion = null, string $companyName = null, string $copyright = null, string $callSharpCode = '', string $declareSharpCode = '', WFObject $dictionary = null, WFObject $assemblies = null): array
384 385
     {
385
-        if ($dictionary === null)
386
-            $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
386
+        if ($dictionary === null) {
387
+                    $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
388
+        }
387 389
 
388
-        if ($assemblies === null)
389
-            $assemblies = getNetArray ('System.String', array_map ('\VoidEngine\text', [
390
+        if ($assemblies === null) {
391
+                    $assemblies = getNetArray ('System.String', array_map ('\VoidEngine\text', [
390 392
                 // CORE_DIR .'/CefSharp.dll',
391 393
                 CORE_DIR .'/FastColoredTextBox.dll',
392 394
                 CORE_DIR .'/ScintillaNET.dll'
393 395
             ]));
396
+        }
394 397
 
395
-        if ($productName === null)
396
-            $productName = basenameNoExt ($savePath);
398
+        if ($productName === null) {
399
+                    $productName = basenameNoExt ($savePath);
400
+        }
397 401
 
398
-        if ($productDescription === null)
399
-            $productDescription = $productName;
402
+        if ($productDescription === null) {
403
+                    $productDescription = $productName;
404
+        }
400 405
 
401
-        if ($productVersion === null)
402
-            $productVersion = '1.0';
406
+        if ($productVersion === null) {
407
+                    $productVersion = '1.0';
408
+        }
403 409
 
404
-        if ($companyName === null)
405
-            $companyName = 'Company N';
410
+        if ($companyName === null) {
411
+                    $companyName = 'Company N';
412
+        }
406 413
 
407
-        if ($copyright === null)
408
-            $copyright = $companyName .' copyright (c) '. date ('Y');
414
+        if ($copyright === null) {
415
+                    $copyright = $companyName .' copyright (c) '. date ('Y');
416
+        }
409 417
 
410 418
         return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
411 419
     }
@@ -418,9 +426,7 @@  discard block
 block discarded – undo
418 426
         try
419 427
         {
420 428
             (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
421
-        }
422
-
423
-        catch (\Throwable $e)
429
+        } catch (\Throwable $e)
424 430
         {
425 431
             return false;
426 432
         }
@@ -432,8 +438,9 @@  discard block
 block discarded – undo
432 438
     {
433 439
         $property = VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'GetProperty', $name);
434 440
 
435
-        if (!is_int ($property))
436
-            return false;
441
+        if (!is_int ($property)) {
442
+                    return false;
443
+        }
437 444
 
438 445
         try
439 446
         {
@@ -476,9 +483,7 @@  discard block
 block discarded – undo
476 483
                         VoidEngine::getProperty ($selector, [$name, 'int']);
477 484
 
478 485
                         $property = 'int';
479
-                    }
480
-
481
-                    catch (\Throwable $e)
486
+                    } catch (\Throwable $e)
482 487
                     {
483 488
                         return [
484 489
                             'type'  => 'vrsf',
@@ -487,9 +492,7 @@  discard block
 block discarded – undo
487 492
                     }
488 493
                 break;
489 494
             }
490
-        }
491
-
492
-        catch (\Throwable $e)
495
+        } catch (\Throwable $e)
493 496
         {
494 497
             $property = 'object';
495 498
         }
@@ -507,8 +510,9 @@  discard block
 block discarded – undo
507 510
         $props = VoidEngine::callMethod (VoidEngine::callMethod ($object, 'GetType'), 'GetEvents');
508 511
         $len   = VoidEngine::getProperty ($props, 'Length');
509 512
 
510
-        for ($i = 0; $i < $len; ++$i)
511
-            $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
513
+        for ($i = 0; $i < $len; ++$i) {
514
+                    $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
515
+        }
512 516
 
513 517
         return $events;
514 518
     }
@@ -533,40 +537,38 @@  discard block
 block discarded – undo
533 537
 
534 538
     public function __construct ($object, ?string $classGroup = 'auto', ...$args)
535 539
     {
536
-        foreach ($args as $id => $arg)
537
-            $args[$id] = ngineAdditions::uncoupleSelector ($arg);
540
+        foreach ($args as $id => $arg) {
541
+                    $args[$id] = ngineAdditions::uncoupleSelector ($arg);
542
+        }
538 543
 
539
-        if (is_string ($object))
540
-            $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ?
544
+        if (is_string ($object)) {
545
+                    $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ?
541 546
                 substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args);
542
-
543
-        elseif (is_int ($object) && VoidEngine::objectExists ($object))
544
-            $this->selector = $object;
545
-
546
-        else throw new \Exception ('$object parameter must be string or object selector');
547
+        } elseif (is_int ($object) && VoidEngine::objectExists ($object)) {
548
+                    $this->selector = $object;
549
+        } else {
550
+            throw new \Exception ('$object parameter must be string or object selector');
551
+        }
547 552
     }
548 553
     
549 554
     public function __get ($name)
550 555
 	{
551
-        if (method_exists ($this, $method = "get_$name"))
552
-            $value = $this->$method ();
553
-
554
-        elseif (substr ($name, -5) == 'Event')
555
-            $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
556
-
557
-        elseif (property_exists ($this, $name))
558
-            $value = $this->$name;
559
-
560
-        else switch (strtolower ($name))
556
+        if (method_exists ($this, $method = "get_$name")) {
557
+                    $value = $this->$method ();
558
+        } elseif (substr ($name, -5) == 'Event') {
559
+                    $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
560
+        } elseif (property_exists ($this, $name)) {
561
+                    $value = $this->$name;
562
+        } else {
563
+            switch (strtolower ($name))
561 564
         {
562 565
             case 'count':
563 566
             case 'length':
564 567
                 try
565 568
                 {
566 569
                     return $this->getProperty ('Count');
567
-                }
568
-
569
-                catch (\Throwable $e)
570
+        }
571
+                } catch (\Throwable $e)
570 572
                 {
571 573
                     return $this->getProperty ('Length');
572 574
                 }
@@ -576,8 +578,9 @@  discard block
 block discarded – undo
576 578
                 $size = $this->count;
577 579
                 $list = [];
578 580
                 
579
-				for ($i = 0; $i < $size; ++$i)
580
-                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
581
+				for ($i = 0; $i < $size; ++$i) {
582
+				                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
583
+				}
581 584
                 
582 585
                 return $list;
583 586
             break;
@@ -586,13 +589,12 @@  discard block
 block discarded – undo
586 589
                 $size = $this->count;
587 590
                 $names = [];
588 591
                 
589
-                for ($i = 0; $i < $size; ++$i)
590
-                    try
592
+                for ($i = 0; $i < $size; ++$i) {
593
+                                    try
591 594
                     {
592 595
                         $names[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($this->selector, [$i, 'object']), 'Text');
593
-                    }
594
-
595
-                    catch (\Throwable $e)
596
+                }
597
+                    } catch (\Throwable $e)
596 598
                     {
597 599
                         $names[] = VoidEngine::getArrayValue ($this->selector, [$i, 'string']);
598 600
                     }
@@ -610,10 +612,11 @@  discard block
 block discarded – undo
610 612
 	
611 613
 	public function __set ($name, $value)
612 614
 	{
613
-        if (method_exists ($this, $method = "set_$name"))
614
-            try
615
+        if (method_exists ($this, $method = "set_$name")) {
616
+                    try
615 617
             {
616 618
                 return $this->$method ($value);
619
+        }
617 620
             }
618 621
 
619 622
             # Метод "set_$name" может принимать в качестве параметра объект WFObject
@@ -623,12 +626,11 @@  discard block
 block discarded – undo
623 626
             {
624 627
                 return $value instanceof WFObject ?
625 628
                     $this->$method ($value->selector) : null;
626
-            }
627
-
628
-        elseif (substr ($name, -5) == 'Event')
629
-            Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
630
-        
631
-        else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
629
+            } elseif (substr ($name, -5) == 'Event') {
630
+                    Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
631
+        } else {
632
+            $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
633
+        }
632 634
     }
633 635
 	
634 636
 	public function __call ($method, $args)
@@ -643,8 +645,9 @@  discard block
 block discarded – undo
643 645
 
644 646
     public function addRange (array $values, $assoc = false): void
645 647
     {
646
-        foreach ($values as $id => $value)
647
-            $this->offsetSet ($assoc ? $id : null, $value);
648
+        foreach ($values as $id => $value) {
649
+                    $this->offsetSet ($assoc ? $id : null, $value);
650
+        }
648 651
     }
649 652
     
650 653
     public function offsetSet ($index, $value)
@@ -654,9 +657,7 @@  discard block
 block discarded – undo
654 657
             return $index === null ?
655 658
                 $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
656 659
                 $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
657
-        }
658
-
659
-        catch (\Throwable $e)
660
+        } catch (\Throwable $e)
660 661
         {
661 662
             return $index === null ?
662 663
                 VoidEngine::setArrayValue ($this->selector, $this->count, $value) :
@@ -679,9 +680,7 @@  discard block
 block discarded – undo
679 680
         try
680 681
         {
681 682
             $this->offsetGet ($index);
682
-        }
683
-
684
-        catch (\Exception $e)
683
+        } catch (\Exception $e)
685 684
         {
686 685
             return false;
687 686
         }
@@ -708,8 +707,9 @@  discard block
 block discarded – undo
708 707
     {
709 708
         $size = $this->count;
710 709
 
711
-        for ($i = 0; $i < $size; ++$i)
712
-            $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
710
+        for ($i = 0; $i < $size; ++$i) {
711
+                    $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
712
+        }
713 713
     }
714 714
 
715 715
     public function where (\Closure $comparator, string $type = null): array
@@ -717,9 +717,10 @@  discard block
 block discarded – undo
717 717
         $size   = $this->count;
718 718
         $return = [];
719 719
 
720
-        for ($i = 0; $i < $size; ++$i)
721
-            if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
720
+        for ($i = 0; $i < $size; ++$i) {
721
+                    if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
722 722
                 $return[] = $value;
723
+        }
723 724
 
724 725
         return $return;
725 726
     }
@@ -729,9 +730,7 @@  discard block
 block discarded – undo
729 730
         try
730 731
         {
731 732
             return VoidEngine::getProperty ($this->selector, $name);
732
-        }
733
-
734
-        catch (\Throwable $e)
733
+        } catch (\Throwable $e)
735 734
         {
736 735
             return VoidEngine::getField ($this->selector, $name);
737 736
         }
@@ -742,9 +741,7 @@  discard block
 block discarded – undo
742 741
         try
743 742
         {
744 743
             VoidEngine::setProperty ($this->selector, $name, $value);
745
-        }
746
-
747
-        catch (\Throwable $e)
744
+        } catch (\Throwable $e)
748 745
         {
749 746
             VoidEngine::setField ($this->selector, $name, $value);
750 747
         }
@@ -761,8 +758,9 @@  discard block
 block discarded – undo
761 758
         $size   = VoidEngine::getProperty ($array, 'Length');
762 759
         $return = [];
763 760
 
764
-		for ($i = 0; $i < $size; ++$i)
765
-            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
761
+		for ($i = 0; $i < $size; ++$i) {
762
+		            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
763
+		}
766 764
         
767 765
         VoidEngine::removeObjects ($array);
768 766
         
@@ -774,9 +772,7 @@  discard block
 block discarded – undo
774 772
 		try
775 773
 		{
776 774
 			return $this->getProperty ('Name');
777
-        }
778
-        
779
-		catch (\Throwable $e)
775
+        } catch (\Throwable $e)
780 776
 		{
781 777
 			return $this->name;
782 778
 		}
@@ -787,9 +783,7 @@  discard block
 block discarded – undo
787 783
 		try
788 784
 		{
789 785
 			$this->setProperty ('Name', $name);
790
-        }
791
-        
792
-		catch (\Throwable $e)
786
+        } catch (\Throwable $e)
793 787
 		{
794 788
 			$this->name = $name;
795 789
 		}
@@ -807,14 +801,14 @@  discard block
 block discarded – undo
807 801
 
808 802
     public function __construct ($class, ?string $classGroup = 'auto')
809 803
     {
810
-        if (is_string ($class))
811
-            $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ?
804
+        if (is_string ($class)) {
805
+                    $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ?
812 806
                 substr ($class, 0, strrpos ($class, '.')) : $classGroup
813 807
             );
814
-
815
-        elseif (is_int ($class) && VoidEngine::objectExists ($class))
816
-            $this->selector = $class;
817
-
818
-        else throw new \Exception ('$class parameter must be string or class selector');
808
+        } elseif (is_int ($class) && VoidEngine::objectExists ($class)) {
809
+                    $this->selector = $class;
810
+        } else {
811
+            throw new \Exception ('$class parameter must be string or class selector');
812
+        }
819 813
     }
820 814
 }
Please login to merge, or discard this patch.