Passed
Push — master ( 01e8e0...676938 )
by Observer
01:16
created
engine/components/graphic/RadioButton.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class RadioButton extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.RadioButton';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+    protected ?string $assembly  = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class RadioButton extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.RadioButton';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+	protected ?string $assembly = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
engine/components/Component.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,22 +11,22 @@
 block discarded – undo
11 11
     protected ?string $classname;
12 12
     protected ?string $assembly;
13 13
 
14
-    public function __construct (...$args)
14
+    public function __construct(...$args)
15 15
     {
16
-        parent::__construct ($this->classname, $this->assembly, ...$args);
16
+        parent::__construct($this->classname, $this->assembly, ...$args);
17 17
 
18
-        Components::add ($this);
18
+        Components::add($this);
19 19
     }
20 20
 
21
-    public function dispose (): void
21
+    public function dispose(): void
22 22
     {
23
-        VoidCore::removeObjects ($this->selector);
24
-        Components::remove ($this->selector);
23
+        VoidCore::removeObjects($this->selector);
24
+        Components::remove($this->selector);
25 25
     }
26 26
 
27
-    public function __destruct ()
27
+    public function __destruct()
28 28
     {
29
-        if (VoidCore::destructObject ($this->selector))
30
-            $this->dispose ();
29
+        if (VoidCore::destructObject($this->selector))
30
+            $this->dispose();
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@
 block discarded – undo
26 26
 
27 27
     public function __destruct ()
28 28
     {
29
-        if (VoidCore::destructObject ($this->selector))
30
-            $this->dispose ();
29
+        if (VoidCore::destructObject ($this->selector)) {
30
+                    $this->dispose ();
31
+        }
31 32
     }
32 33
 }
Please login to merge, or discard this patch.
engine/components/system/ImageList.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class ImageList extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.ImageList';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+    protected ?string $assembly  = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class ImageList extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.ImageList';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+	protected ?string $assembly = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
engine/components/system/Timer.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class Timer extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.Timer';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+    protected ?string $assembly  = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class Timer extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.Timer';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+	protected ?string $assembly = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
engine/components/dialogs/CommonDialog.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 abstract class CommonDialog extends Component
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.CommonDialog';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+    protected ?string $assembly  = 'System.Windows.Forms';
9 9
 
10 10
     public function execute (): int
11 11
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 abstract class CommonDialog extends Component
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.CommonDialog';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+	protected ?string $assembly = 'System.Windows.Forms';
9 9
 
10
-    public function execute (): int
10
+    public function execute(): int
11 11
     {
12
-        return $this->callMethod ('ShowDialog');
12
+        return $this->callMethod('ShowDialog');
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
engine/components/dialogs/FolderBrowserDialog.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.FolderBrowserDialog';
8 8
 	
9
-    public function get_path ()
9
+    public function get_path()
10 10
     {
11
-        return $this->getProperty ('SelectedPath');
11
+        return $this->getProperty('SelectedPath');
12 12
     }
13 13
 }
Please login to merge, or discard this patch.
engine/components/dialogs/MessageBox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
     protected ?string $classname = 'System.Windows.Forms.MessageBox';
8 8
     protected ?string $assembly  = 'System.Windows.Forms';
9 9
     
10
-    public function __construct ()
10
+    public function __construct()
11 11
     {
12
-        parent::__construct ($this->classname, $this->assembly);
12
+        parent::__construct($this->classname, $this->assembly);
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
engine/components/system/Process.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@
 block discarded – undo
6 6
 
7 7
 class Process extends Component
8 8
 {
9
-	protected ?string $classname = 'System.Diagnostics.Process';
10
-	protected ?string $assembly  = 'System';
9
+    protected ?string $classname = 'System.Diagnostics.Process';
10
+    protected ?string $assembly  = 'System';
11 11
 
12
-	public function __construct (int $pid = null)
13
-	{
12
+    public function __construct (int $pid = null)
13
+    {
14 14
         $this->selector = VoidCore::getClass ($this->classname, $this->assembly);
15 15
 
16
-		if ($pid !== null)
16
+        if ($pid !== null)
17 17
             $this->selector = $pid == getmypid () ?
18 18
                 VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
19 19
                 VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
20 20
 
21
-		Components::add ($this);
22
-	}
21
+        Components::add ($this);
22
+    }
23 23
 	
24
-	public static function getProcessById (int $pid)
25
-	{
26
-		return new self ($pid);
27
-	}
24
+    public static function getProcessById (int $pid)
25
+    {
26
+        return new self ($pid);
27
+    }
28 28
 	
29
-	public static function getCurrentProcess ()
30
-	{
31
-		return new self (getmypid ());
32
-	}
29
+    public static function getCurrentProcess ()
30
+    {
31
+        return new self (getmypid ());
32
+    }
33 33
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,25 +9,24 @@
 block discarded – undo
9 9
 	protected ?string $classname = 'System.Diagnostics.Process';
10 10
 	protected ?string $assembly  = 'System';
11 11
 
12
-	public function __construct (int $pid = null)
12
+	public function __construct(int $pid = null)
13 13
 	{
14
-        $this->selector = VoidCore::getClass ($this->classname, $this->assembly);
14
+        $this->selector = VoidCore::getClass($this->classname, $this->assembly);
15 15
 
16 16
 		if ($pid !== null)
17
-            $this->selector = $pid == getmypid () ?
18
-                VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
19
-                VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
17
+            $this->selector = $pid == getmypid() ?
18
+                VoidCore::callMethod($this->selector, 'GetCurrentProcess') : VoidCore::callMethod($this->selector, 'GetProcessById', $pid);
20 19
 
21
-		Components::add ($this);
20
+		Components::add($this);
22 21
 	}
23 22
 	
24
-	public static function getProcessById (int $pid)
23
+	public static function getProcessById(int $pid)
25 24
 	{
26
-		return new self ($pid);
25
+		return new self($pid);
27 26
 	}
28 27
 	
29
-	public static function getCurrentProcess ()
28
+	public static function getCurrentProcess()
30 29
 	{
31
-		return new self (getmypid ());
30
+		return new self(getmypid());
32 31
 	}
33 32
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,10 +13,11 @@
 block discarded – undo
13 13
 	{
14 14
         $this->selector = VoidCore::getClass ($this->classname, $this->assembly);
15 15
 
16
-		if ($pid !== null)
17
-            $this->selector = $pid == getmypid () ?
16
+		if ($pid !== null) {
17
+		            $this->selector = $pid == getmypid () ?
18 18
                 VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
19 19
                 VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
20
+		}
20 21
 
21 22
 		Components::add ($this);
22 23
 	}
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/interpreter.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 
98 98
                         try
99 99
                         {
100
-							if (strpos ($propertyName, '->') !== false && self::$allow_multimethods_calls)
100
+                            if (strpos ($propertyName, '->') !== false && self::$allow_multimethods_calls)
101 101
                                 eval ('namespace VoidEngine; '. $preset .' _c('. self::$objects[$name]->selector .')->'. $propertyName .' = '. $propertyValue .';');
102 102
                             
103 103
                             else self::$objects[$name]->$propertyName = eval ("namespace VoidEngine; $preset return $propertyValue;");
Please login to merge, or discard this patch.
Braces   +67 added lines, -65 removed lines patch added patch discarded remove patch
@@ -33,15 +33,17 @@  discard block
 block discarded – undo
33 33
                     $name  = $node->args['name'];
34 34
                     $args  = [];
35 35
 
36
-                    if (isset (self::$objects[$name]))
37
-                        break;
36
+                    if (isset (self::$objects[$name])) {
37
+                                            break;
38
+                    }
38 39
 
39 40
                     if (isset ($node->args['args']))
40 41
                     {
41 42
                         $args = $node->args['args'];
42 43
 
43
-                        foreach ($args as $arg_id => $arg)
44
-                            $args[$arg_id] = self::formatLine ($arg, self::$objects);
44
+                        foreach ($args as $arg_id => $arg) {
45
+                                                    $args[$arg_id] = self::formatLine ($arg, self::$objects);
46
+                        }
45 47
                     }
46 48
 
47 49
                     try
@@ -51,15 +53,12 @@  discard block
 block discarded – undo
51 53
                         try
52 54
                         {
53 55
                             self::$objects[$name]->name = $name;
54
-                        }
55
-
56
-                        catch (\Throwable $e) {}
57
-                    }
58
-
59
-                    catch (\Throwable $e)
56
+                        } catch (\Throwable $e) {}
57
+                    } catch (\Throwable $e)
60 58
                     {
61
-                        if (self::$throw_errors)
62
-                            throw new \Exception ('Interpeter couldn\'t create object "'. $class .'" with name "'. $name .'" at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
59
+                        if (self::$throw_errors) {
60
+                                                    throw new \Exception ('Interpeter couldn\'t create object "'. $class .'" with name "'. $name .'" at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
61
+                        }
63 62
                     }
64 63
                 break;
65 64
 
@@ -78,13 +77,15 @@  discard block
 block discarded – undo
78 77
                             $use = $ouse = substr ($use, ($pos = strpos ($use, '(') + 1), strpos ($use, ')') - $pos);
79 78
                             $use = explode (' ', $use);
80 79
 
81
-                            foreach ($use as $id => $useParam)  
82
-                                if (isset (self::$objects[$useParam]) && $use[$id + 1][0] == '$')
80
+                            foreach ($use as $id => $useParam) {
81
+                                                            if (isset (self::$objects[$useParam]) && $use[$id + 1][0] == '$')
83 82
                                 {
84 83
                                     $fname = $use[$id + 1];
84
+                            }
85 85
 
86
-                                    if (substr ($fname, strlen ($fname) - 1) == ',')
87
-                                        $fname = substr ($fname, 0, -1);
86
+                                    if (substr ($fname, strlen ($fname) - 1) == ',') {
87
+                                                                            $fname = substr ($fname, 0, -1);
88
+                                    }
88 89
 
89 90
                                     $preset .= "$fname = $useParam; ";
90 91
 
@@ -93,27 +94,26 @@  discard block
 block discarded – undo
93 94
 
94 95
                             $preset        = self::formatLine ($preset, self::$objects);
95 96
                             $propertyValue = self::formatLine (str_replace ($ouse, implode (' ', $use), $propertyValue), self::$objects);
97
+                        } else {
98
+                            $propertyValue = self::formatLine ($propertyValue, self::$objects);
96 99
                         }
97 100
 
98
-                        else $propertyValue = self::formatLine ($propertyValue, self::$objects);
99
-
100 101
                         try
101 102
                         {
102
-							if (strpos ($propertyName, '->') !== false && self::$allow_multimethods_calls)
103
-                                eval ('namespace VoidEngine; '. $preset .' _c('. self::$objects[$name]->selector .')->'. $propertyName .' = '. $propertyValue .';');
104
-                            
105
-                            else self::$objects[$name]->$propertyName = eval ("namespace VoidEngine; $preset return $propertyValue;");
106
-                        }
107
-
108
-                        catch (\Throwable $e)
103
+							if (strpos ($propertyName, '->') !== false && self::$allow_multimethods_calls) {
104
+							                                eval ('namespace VoidEngine; '. $preset .' _c('. self::$objects[$name]->selector .')->'. $propertyName .' = '. $propertyValue .';');
105
+							} else {
106
+                                self::$objects[$name]->$propertyName = eval ("namespace VoidEngine; $preset return $propertyValue;");
107
+                            }
108
+                        } catch (\Throwable $e)
109 109
                         {
110
-                            if (self::$throw_errors)
111
-                                throw new \Exception ('Interpeter couldn\'t set property "'. $propertyName .'" with value "'. $propertyValue .'" at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
110
+                            if (self::$throw_errors) {
111
+                                                            throw new \Exception ('Interpeter couldn\'t set property "'. $propertyName .'" with value "'. $propertyValue .'" at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
112
+                            }
112 113
                         }
114
+                    } elseif (self::$throw_errors) {
115
+                                            throw new \Exception ('Setting property to an non-object at line "'. $node->line);
113 116
                     }
114
-
115
-                    elseif (self::$throw_errors)
116
-                        throw new \Exception ('Setting property to an non-object at line "'. $node->line);
117 117
                 break;
118 118
 
119 119
                 case METHOD_CALL:
@@ -124,29 +124,28 @@  discard block
 block discarded – undo
124 124
                         $methodName = $node->args['name'];
125 125
                         $methodArgs = $node->args['args'];
126 126
 
127
-                        foreach ($methodArgs as $arg_id => $arg)
128
-                            $methodArgs[$arg_id] = self::formatLine ($arg, self::$objects);
127
+                        foreach ($methodArgs as $arg_id => $arg) {
128
+                                                    $methodArgs[$arg_id] = self::formatLine ($arg, self::$objects);
129
+                        }
129 130
 
130 131
                         try
131 132
                         {
132
-                            if (strpos ($methodName, '->') !== false && self::$allow_multimethods_calls)
133
-                                eval ('namespace VoidEngine; _c('. self::$objects[$name]->selector .')->'. $methodName .' ('. implode (', ', $methodArgs) .');');
134
-
135
-                            elseif (sizeof ($methodArgs) > 0)
136
-                                self::$objects[$name]->$methodName (...eval ('namespace VoidEngine; return ['. implode (', ', $methodArgs) .'];'));
137
-
138
-                            else self::$objects[$name]->$methodName ();
139
-                        }
140
-
141
-                        catch (\Throwable $e)
133
+                            if (strpos ($methodName, '->') !== false && self::$allow_multimethods_calls) {
134
+                                                            eval ('namespace VoidEngine; _c('. self::$objects[$name]->selector .')->'. $methodName .' ('. implode (', ', $methodArgs) .');');
135
+                            } elseif (sizeof ($methodArgs) > 0) {
136
+                                                            self::$objects[$name]->$methodName (...eval ('namespace VoidEngine; return ['. implode (', ', $methodArgs) .'];'));
137
+                            } else {
138
+                                self::$objects[$name]->$methodName ();
139
+                            }
140
+                        } catch (\Throwable $e)
142 141
                         {
143
-                            if (self::$throw_errors)
144
-                                throw new \Exception ('Interpeter couldn\'t call method "'. $methodName .'" with arguments '. json_encode ($methodArgs) .' at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
142
+                            if (self::$throw_errors) {
143
+                                                            throw new \Exception ('Interpeter couldn\'t call method "'. $methodName .'" with arguments '. json_encode ($methodArgs) .' at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
144
+                            }
145 145
                         }
146
+                    } elseif (self::$throw_errors) {
147
+                                            throw new \Exception ('Calling method to an non-object at line "'. $node->line .'"');
146 148
                     }
147
-
148
-                    elseif (self::$throw_errors)
149
-                        throw new \Exception ('Calling method to an non-object at line "'. $node->line .'"');
150 149
                 break;
151 150
 
152 151
                 case STYLES_IMPORTING:
@@ -156,11 +155,10 @@  discard block
 block discarded – undo
156 155
 
157 156
                         if (!file_exists ($path))
158 157
                         {
159
-                            if (self::$throw_errors)
160
-                                throw new \Exception ('Trying to import nonexistent style at line "'. $node->line .'"');
161
-                        }
162
-                        
163
-                        elseif (!isset (self::$imported_styles[$path]))
158
+                            if (self::$throw_errors) {
159
+                                                            throw new \Exception ('Trying to import nonexistent style at line "'. $node->line .'"');
160
+                            }
161
+                        } elseif (!isset (self::$imported_styles[$path]))
164 162
                         {
165 163
                             \VLF\VST\Interpreter::run (\VLF\VST\Parser::parse (file_get_contents ($path)));
166 164
 
@@ -178,16 +176,17 @@  discard block
 block discarded – undo
178 176
 
179 177
             if ($node->type == OBJECT_DEFINITION)
180 178
             {
181
-                if (isset (\VLF\VST\Interpreter::$default_styles[$node->args['class']]))
182
-                    $nodes = array_merge ($nodes, \VLF\VST\Interpreter::$default_styles[$node->args['class']]);
179
+                if (isset (\VLF\VST\Interpreter::$default_styles[$node->args['class']])) {
180
+                                    $nodes = array_merge ($nodes, \VLF\VST\Interpreter::$default_styles[$node->args['class']]);
181
+                }
183 182
 
184
-                if (isset ($node->args['styles']))
185
-                    foreach ($node->args['styles'] as $style)
183
+                if (isset ($node->args['styles'])) {
184
+                                    foreach ($node->args['styles'] as $style)
186 185
                         if (isset (\VLF\VST\Interpreter::$styles[$style]))
187 186
                             $nodes = array_merge ($nodes, \VLF\VST\Interpreter::$styles[$style]);
188
-
189
-                        elseif (self::$throw_errors)
190
-                            throw new \Exception ('Trying to set undefined style "'. $style .'" to object at line "'. $node->line .'"');
187
+                } elseif (self::$throw_errors) {
188
+                                                    throw new \Exception ('Trying to set undefined style "'. $style .'" to object at line "'. $node->line .'"');
189
+                        }
191 190
             }
192 191
 
193 192
             self::$objects = self::run (new AST (array_map (
@@ -228,8 +227,9 @@  discard block
 block discarded – undo
228 227
 
229 228
             $nReplacement = [];
230 229
 
231
-            foreach ($replacement as $replaceTo => $nLn)
232
-                $nReplacement[$omap[$replaceTo]] = $replaceTo;
230
+            foreach ($replacement as $replaceTo => $nLn) {
231
+                            $nReplacement[$omap[$replaceTo]] = $replaceTo;
232
+            }
233 233
 
234 234
             $replacement = $nReplacement;
235 235
             $blacklist   = array_flip (['\'', '"', '$']);
@@ -238,10 +238,11 @@  discard block
 block discarded – undo
238 238
             {
239 239
                 $replaced = false;
240 240
 
241
-                foreach ($replacement as $name => $replaceAt)
242
-                    if (substr ($line, $i, ($l = strlen ($name))) == $name && !isset ($blacklist[$line[$i - 1]]))
241
+                foreach ($replacement as $name => $replaceAt) {
242
+                                    if (substr ($line, $i, ($l = strlen ($name))) == $name && !isset ($blacklist[$line[$i - 1]]))
243 243
                     {
244 244
                         $newLine .= $replaceAt;
245
+                }
245 246
 
246 247
                         $i += $l - 1;
247 248
                         $replaced = true;
@@ -249,8 +250,9 @@  discard block
 block discarded – undo
249 250
                         break;
250 251
                     }
251 252
 
252
-                if (!$replaced)
253
-                    $newLine .= $line[$i];
253
+                if (!$replaced) {
254
+                                    $newLine .= $line[$i];
255
+                }
254 256
             }
255 257
 
256 258
             $line = $newLine;
Please login to merge, or discard this patch.
Spacing   +49 added lines, -50 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
      * 
23 23
      * @return array - возвращает список созданных объектов
24 24
      */
25
-    public static function run (AST $tree, Node $parent = null): array
25
+    public static function run(AST $tree, Node $parent = null): array
26 26
     {
27
-        foreach ($tree->getNodes () as $node)
27
+        foreach ($tree->getNodes() as $node)
28 28
         {
29 29
             switch ($node->type)
30 30
             {
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
                         $args = $node->args['args'];
42 42
 
43 43
                         foreach ($args as $arg_id => $arg)
44
-                            $args[$arg_id] = self::formatLine ($arg, self::$objects);
44
+                            $args[$arg_id] = self::formatLine($arg, self::$objects);
45 45
                     }
46 46
 
47 47
                     try
48 48
                     {
49
-                        self::$objects[$name] = eval ("namespace VoidEngine; return new $class (". implode (', ', $args) .");");
49
+                        self::$objects[$name] = eval ("namespace VoidEngine; return new $class (".implode(', ', $args).");");
50 50
 
51 51
                         try
52 52
                         {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                     catch (\Throwable $e)
60 60
                     {
61 61
                         if (self::$throw_errors)
62
-                            throw new \Exception ('Interpeter couldn\'t create object "'. $class .'" with name "'. $name .'" at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
62
+                            throw new \Exception('Interpeter couldn\'t create object "'.$class.'" with name "'.$name.'" at line "'.$node->line.'". Exception info:'."\n\n".(string) $e, 0, $e);
63 63
                     }
64 64
                 break;
65 65
 
@@ -72,35 +72,35 @@  discard block
 block discarded – undo
72 72
                         $propertyValue = $node->args['value'];
73 73
                         $preset        = '';
74 74
 
75
-                        if (preg_match ('/function \((.*)\) use \((.*)\)/', $propertyValue))
75
+                        if (preg_match('/function \((.*)\) use \((.*)\)/', $propertyValue))
76 76
                         {
77
-                            $use = substr ($propertyValue, strpos ($propertyValue, 'use'));
78
-                            $use = $ouse = substr ($use, ($pos = strpos ($use, '(') + 1), strpos ($use, ')') - $pos);
79
-                            $use = explode (' ', $use);
77
+                            $use = substr($propertyValue, strpos($propertyValue, 'use'));
78
+                            $use = $ouse = substr($use, ($pos = strpos($use, '(') + 1), strpos($use, ')') - $pos);
79
+                            $use = explode(' ', $use);
80 80
 
81 81
                             foreach ($use as $id => $useParam)  
82 82
                                 if (isset (self::$objects[$useParam]) && $use[$id + 1][0] == '$')
83 83
                                 {
84 84
                                     $fname = $use[$id + 1];
85 85
 
86
-                                    if (substr ($fname, strlen ($fname) - 1) == ',')
87
-                                        $fname = substr ($fname, 0, -1);
86
+                                    if (substr($fname, strlen($fname) - 1) == ',')
87
+                                        $fname = substr($fname, 0, -1);
88 88
 
89 89
                                     $preset .= "$fname = $useParam; ";
90 90
 
91 91
                                     unset ($use[$id]);
92 92
                                 }
93 93
 
94
-                            $preset        = self::formatLine ($preset, self::$objects);
95
-                            $propertyValue = self::formatLine (str_replace ($ouse, implode (' ', $use), $propertyValue), self::$objects);
94
+                            $preset        = self::formatLine($preset, self::$objects);
95
+                            $propertyValue = self::formatLine(str_replace($ouse, implode(' ', $use), $propertyValue), self::$objects);
96 96
                         }
97 97
 
98
-                        else $propertyValue = self::formatLine ($propertyValue, self::$objects);
98
+                        else $propertyValue = self::formatLine($propertyValue, self::$objects);
99 99
 
100 100
                         try
101 101
                         {
102
-							if (strpos ($propertyName, '->') !== false && self::$allow_multimethods_calls)
103
-                                eval ('namespace VoidEngine; '. $preset .' _c('. self::$objects[$name]->selector .')->'. $propertyName .' = '. $propertyValue .';');
102
+							if (strpos($propertyName, '->') !== false && self::$allow_multimethods_calls)
103
+                                eval ('namespace VoidEngine; '.$preset.' _c('.self::$objects[$name]->selector.')->'.$propertyName.' = '.$propertyValue.';');
104 104
                             
105 105
                             else self::$objects[$name]->$propertyName = eval ("namespace VoidEngine; $preset return $propertyValue;");
106 106
                         }
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
                         catch (\Throwable $e)
109 109
                         {
110 110
                             if (self::$throw_errors)
111
-                                throw new \Exception ('Interpeter couldn\'t set property "'. $propertyName .'" with value "'. $propertyValue .'" at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
111
+                                throw new \Exception('Interpeter couldn\'t set property "'.$propertyName.'" with value "'.$propertyValue.'" at line "'.$node->line.'". Exception info:'."\n\n".(string) $e, 0, $e);
112 112
                         }
113 113
                     }
114 114
 
115 115
                     elseif (self::$throw_errors)
116
-                        throw new \Exception ('Setting property to an non-object at line "'. $node->line);
116
+                        throw new \Exception('Setting property to an non-object at line "'.$node->line);
117 117
                 break;
118 118
 
119 119
                 case METHOD_CALL:
@@ -125,44 +125,44 @@  discard block
 block discarded – undo
125 125
                         $methodArgs = $node->args['args'];
126 126
 
127 127
                         foreach ($methodArgs as $arg_id => $arg)
128
-                            $methodArgs[$arg_id] = self::formatLine ($arg, self::$objects);
128
+                            $methodArgs[$arg_id] = self::formatLine($arg, self::$objects);
129 129
 
130 130
                         try
131 131
                         {
132
-                            if (strpos ($methodName, '->') !== false && self::$allow_multimethods_calls)
133
-                                eval ('namespace VoidEngine; _c('. self::$objects[$name]->selector .')->'. $methodName .' ('. implode (', ', $methodArgs) .');');
132
+                            if (strpos($methodName, '->') !== false && self::$allow_multimethods_calls)
133
+                                eval ('namespace VoidEngine; _c('.self::$objects[$name]->selector.')->'.$methodName.' ('.implode(', ', $methodArgs).');');
134 134
 
135
-                            elseif (sizeof ($methodArgs) > 0)
136
-                                self::$objects[$name]->$methodName (...eval ('namespace VoidEngine; return ['. implode (', ', $methodArgs) .'];'));
135
+                            elseif (sizeof($methodArgs) > 0)
136
+                                self::$objects[$name]->$methodName(...eval ('namespace VoidEngine; return ['.implode(', ', $methodArgs).'];'));
137 137
 
138
-                            else self::$objects[$name]->$methodName ();
138
+                            else self::$objects[$name]->$methodName();
139 139
                         }
140 140
 
141 141
                         catch (\Throwable $e)
142 142
                         {
143 143
                             if (self::$throw_errors)
144
-                                throw new \Exception ('Interpeter couldn\'t call method "'. $methodName .'" with arguments '. json_encode ($methodArgs) .' at line "'. $node->line .'". Exception info:'. "\n\n". (string) $e, 0, $e);
144
+                                throw new \Exception('Interpeter couldn\'t call method "'.$methodName.'" with arguments '.json_encode($methodArgs).' at line "'.$node->line.'". Exception info:'."\n\n".(string) $e, 0, $e);
145 145
                         }
146 146
                     }
147 147
 
148 148
                     elseif (self::$throw_errors)
149
-                        throw new \Exception ('Calling method to an non-object at line "'. $node->line .'"');
149
+                        throw new \Exception('Calling method to an non-object at line "'.$node->line.'"');
150 150
                 break;
151 151
 
152 152
                 case STYLES_IMPORTING:
153 153
                     foreach ($node->args['imports'] as $style)
154 154
                     {
155
-                        $path = eval ('namespace VoidEngine; return '. self::formatLine ($style, self::$objects) .';');
155
+                        $path = eval ('namespace VoidEngine; return '.self::formatLine($style, self::$objects).';');
156 156
 
157
-                        if (!file_exists ($path))
157
+                        if (!file_exists($path))
158 158
                         {
159 159
                             if (self::$throw_errors)
160
-                                throw new \Exception ('Trying to import nonexistent style at line "'. $node->line .'"');
160
+                                throw new \Exception('Trying to import nonexistent style at line "'.$node->line.'"');
161 161
                         }
162 162
                         
163 163
                         elseif (!isset (self::$imported_styles[$path]))
164 164
                         {
165
-                            \VLF\VST\Interpreter::run (\VLF\VST\Parser::parse (file_get_contents ($path)));
165
+                            \VLF\VST\Interpreter::run(\VLF\VST\Parser::parse(file_get_contents($path)));
166 166
 
167 167
                             self::$imported_styles[$path] = true;
168 168
                         }
@@ -170,28 +170,28 @@  discard block
 block discarded – undo
170 170
                 break;
171 171
 
172 172
                 case RUNTIME_EXECUTION:
173
-                    eval (self::formatLine ($node->args['code'], self::$objects));
173
+                    eval (self::formatLine($node->args['code'], self::$objects));
174 174
                 break;
175 175
             }
176 176
 
177
-            $nodes = $node->getNodes ();
177
+            $nodes = $node->getNodes();
178 178
 
179 179
             if ($node->type == OBJECT_DEFINITION)
180 180
             {
181 181
                 if (isset (\VLF\VST\Interpreter::$default_styles[$node->args['class']]))
182
-                    $nodes = array_merge ($nodes, \VLF\VST\Interpreter::$default_styles[$node->args['class']]);
182
+                    $nodes = array_merge($nodes, \VLF\VST\Interpreter::$default_styles[$node->args['class']]);
183 183
 
184 184
                 if (isset ($node->args['styles']))
185 185
                     foreach ($node->args['styles'] as $style)
186 186
                         if (isset (\VLF\VST\Interpreter::$styles[$style]))
187
-                            $nodes = array_merge ($nodes, \VLF\VST\Interpreter::$styles[$style]);
187
+                            $nodes = array_merge($nodes, \VLF\VST\Interpreter::$styles[$style]);
188 188
 
189 189
                         elseif (self::$throw_errors)
190
-                            throw new \Exception ('Trying to set undefined style "'. $style .'" to object at line "'. $node->line .'"');
190
+                            throw new \Exception('Trying to set undefined style "'.$style.'" to object at line "'.$node->line.'"');
191 191
             }
192 192
 
193
-            self::$objects = self::run (new AST (array_map (
194
-                fn ($node) => $node->export (), $nodes)), $node);
193
+            self::$objects = self::run(new AST(array_map(
194
+                fn($node) => $node->export(), $nodes)), $node);
195 195
         }
196 196
 
197 197
         return self::$objects;
@@ -205,26 +205,25 @@  discard block
 block discarded – undo
205 205
      * 
206 206
      * @return string - возвращает форматированную строку
207 207
      */
208
-    public static function formatLine (string $line, array $objects = []): string
208
+    public static function formatLine(string $line, array $objects = []): string
209 209
     {
210
-        if (sizeof ($objects) > 0)
210
+        if (sizeof($objects) > 0)
211 211
         {
212
-            $len     = strlen ($line);
212
+            $len     = strlen($line);
213 213
             $newLine = '';
214 214
 
215
-            $replacement = array_map (function ($object)
215
+            $replacement = array_map(function($object)
216 216
             {
217
-                return \VoidEngine\Components::exists ($object->selector) !== false ? 
218
-                    '\VoidEngine\_c('. $object->selector .')' :
219
-                    'unserialize (\''. serialize ($object) .'\')';
217
+                return \VoidEngine\Components::exists($object->selector) !== false ? 
218
+                    '\VoidEngine\_c('.$object->selector.')' : 'unserialize (\''.serialize($object).'\')';
220 219
             }, $objects);
221 220
 
222
-            $replacement = array_map (function ($name)
221
+            $replacement = array_map(function($name)
223 222
             {
224
-                return strlen ($name = trim ($name)) + substr_count ($name, '_');
225
-            }, $omap = array_flip ($replacement));
223
+                return strlen($name = trim($name)) + substr_count($name, '_');
224
+            }, $omap = array_flip($replacement));
226 225
 
227
-            arsort ($replacement);
226
+            arsort($replacement);
228 227
 
229 228
             $nReplacement = [];
230 229
 
@@ -232,14 +231,14 @@  discard block
 block discarded – undo
232 231
                 $nReplacement[$omap[$replaceTo]] = $replaceTo;
233 232
 
234 233
             $replacement = $nReplacement;
235
-            $blacklist   = array_flip (['\'', '"', '$']);
234
+            $blacklist   = array_flip(['\'', '"', '$']);
236 235
 
237 236
             for ($i = 0; $i < $len; ++$i)
238 237
             {
239 238
                 $replaced = false;
240 239
 
241 240
                 foreach ($replacement as $name => $replaceAt)
242
-                    if (substr ($line, $i, ($l = strlen ($name))) == $name && !isset ($blacklist[$line[$i - 1]]))
241
+                    if (substr($line, $i, ($l = strlen($name))) == $name && !isset ($blacklist[$line[$i - 1]]))
243 242
                     {
244 243
                         $newLine .= $replaceAt;
245 244
 
Please login to merge, or discard this patch.