Passed
Push — master ( 4b7a9f...0f5812 )
by Observer
01:18
created
engine/components/ListView.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 {
12 12
     public $class = 'System.Windows.Forms.ListViewItem';
13 13
 
14
-    public function __construct (string $text = '')
14
+    public function __construct(string $text = '')
15 15
     {
16
-        parent::__construct (null, $this->class);
16
+        parent::__construct(null, $this->class);
17 17
 
18 18
         $this->text = $text;
19 19
     }
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 {
24 24
     public $class = 'System.Windows.Forms.ColumnHeader';
25 25
 
26
-    public function __construct (string $text = '')
26
+    public function __construct(string $text = '')
27 27
     {
28
-        parent::__construct (null, $this->class);
28
+        parent::__construct(null, $this->class);
29 29
 
30 30
         $this->text = $text;
31 31
     }
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 {
36 36
     public $class = 'System.Windows.Forms.ListViewGroup';
37 37
 
38
-    public function __construct (string $text = '')
38
+    public function __construct(string $text = '')
39 39
     {
40
-        parent::__construct (null, $this->class);
40
+        parent::__construct(null, $this->class);
41 41
 
42 42
         $this->header = $text;
43 43
     }
Please login to merge, or discard this patch.
core/script.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 chdir (CORE_DIR);
9 9
 
10 10
 if (file_exists ('../engine/VoidEngine.php'))
11
-	require '../engine/VoidEngine.php';
11
+    require '../engine/VoidEngine.php';
12 12
 
13 13
 elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php'))
14
-	require FRAMEWORK_DIR .'/engine/VoidEngine.php';
14
+    require FRAMEWORK_DIR .'/engine/VoidEngine.php';
15 15
 
16 16
 else message ('VoidEngine not founded');
17 17
 
18 18
 $app = '../../app/start.php';
19 19
 
20 20
 if (file_exists ($app))
21
-	require $app;
21
+    require $app;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@
 block discarded – undo
2 2
 
3 3
 namespace VoidEngine;
4 4
 
5
-define ('FRAMEWORK_DIR', getenv ('AppData') .'\VoidFramework');
5
+define('FRAMEWORK_DIR', getenv('AppData').'\VoidFramework');
6 6
 
7 7
 const CORE_DIR = __DIR__;
8
-chdir (CORE_DIR);
8
+chdir(CORE_DIR);
9 9
 
10
-if (file_exists ('../engine/VoidEngine.php'))
10
+if (file_exists('../engine/VoidEngine.php'))
11 11
 	require '../engine/VoidEngine.php';
12 12
 
13
-elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php'))
14
-	require FRAMEWORK_DIR .'/engine/VoidEngine.php';
13
+elseif (file_exists(FRAMEWORK_DIR.'/engine/VoidEngine.php'))
14
+	require FRAMEWORK_DIR.'/engine/VoidEngine.php';
15 15
 
16
-else message ('VoidEngine not founded');
16
+else message('VoidEngine not founded');
17 17
 
18 18
 $app = '../../app/start.php';
19 19
 
20
-if (file_exists ($app))
20
+if (file_exists($app))
21 21
 	require $app;
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,15 +7,16 @@
 block discarded – undo
7 7
 const CORE_DIR = __DIR__;
8 8
 chdir (CORE_DIR);
9 9
 
10
-if (file_exists ('../engine/VoidEngine.php'))
10
+if (file_exists ('../engine/VoidEngine.php')) {
11 11
 	require '../engine/VoidEngine.php';
12
-
13
-elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php'))
12
+} elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) {
14 13
 	require FRAMEWORK_DIR .'/engine/VoidEngine.php';
15
-
16
-else message ('VoidEngine not founded');
14
+} else {
15
+    message ('VoidEngine not founded');
16
+}
17 17
 
18 18
 $app = '../../app/start.php';
19 19
 
20
-if (file_exists ($app))
20
+if (file_exists ($app)) {
21 21
 	require $app;
22
+}
Please login to merge, or discard this patch.
engine/VoidEngine.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 const ENGINE_VERSION = '3.3.0 build-2019/08/24';
37 37
 const ENGINE_DIR = __DIR__;
38 38
 
39
-chdir (ENGINE_DIR);
39
+chdir(ENGINE_DIR);
40 40
 
41 41
 $GLOBALS['error_status'] = true;
42 42
 
43 43
 $GLOBALS['__debug'] = [
44
-    'start_time' => microtime (true)
44
+    'start_time' => microtime(true)
45 45
 ];
46 46
 
47
-$GLOBALS['__ub_write_handler'] = function (...$args)
47
+$GLOBALS['__ub_write_handler'] = function(...$args)
48 48
 {
49
-    pre (...$args);
49
+    pre(...$args);
50 50
 };
51 51
 
52 52
 require 'common/EngineInterfaces.php';
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 require 'components/Designer.php';
106 106
 require 'components/EventGrid.php';
107 107
 
108
-if (is_dir ('extensions'))
109
-    foreach (scandir ('extensions') as $ext)
110
-        if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php'))
108
+if (is_dir('extensions'))
109
+    foreach (scandir('extensions') as $ext)
110
+        if (is_dir('extensions/'.$ext) && file_exists($ext = 'extensions/'.$ext.'/main.php'))
111 111
             require $ext;
112 112
 
113
-gc_collect_cycles ();
113
+gc_collect_cycles();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,9 +105,10 @@
 block discarded – undo
105 105
 require 'components/Designer.php';
106 106
 require 'components/EventGrid.php';
107 107
 
108
-if (is_dir ('extensions'))
108
+if (is_dir ('extensions')) {
109 109
     foreach (scandir ('extensions') as $ext)
110 110
         if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php'))
111 111
             require $ext;
112
+}
112 113
 
113 114
 gc_collect_cycles ();
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/parser.php 2 patches
Spacing   +78 added lines, -80 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
      * АААААААААААААААААААААААА
32 32
      */
33 33
 
34
-    public function __construct (string $content, array $settings = [])
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
         // ДА БАГ ЭТО, НЕ ПИ%ДИ!!! И Я ПОНЯТИЯ НЕ ИМЕЮ КАК И ПОЧЕМУ!!!
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
             if (isset ($this->$name))
46 46
                 $this->$name = $setting;
47 47
 
48
-            else throw new \Exception ('Trying to setting up undefined property "'. $name .'"');
48
+            else throw new \Exception('Trying to setting up undefined property "'.$name.'"');
49 49
         }
50 50
 
51
-        if ($this->use_caching && file_exists ($file = VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache'))
51
+        if ($this->use_caching && file_exists($file = VLF_EXT_DIR.'/cache/'.sha1($content).'.cache'))
52 52
         {
53
-            $info = unserialize (gzinflate (file_get_contents ($file)));
53
+            $info = unserialize(gzinflate(file_get_contents($file)));
54 54
 
55
-            if ($info[0] == sha1 (file_get_contents (__FILE__)))
55
+            if ($info[0] == sha1(file_get_contents(__FILE__)))
56 56
             {
57 57
                 $this->tree  = $info[1][0];
58 58
                 $this->links = $info[1][1];
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
                 return;
61 61
             }
62 62
 
63
-            else unlink ($file);
63
+            else unlink($file);
64 64
         }
65 65
 
66
-        $info = $this->generateSyntaxTree ($content);
66
+        $info = $this->generateSyntaxTree($content);
67 67
 
68 68
         $this->tree  = $info[0];
69 69
         $this->links = $info[1];
70 70
 
71 71
         if ($this->use_caching)
72 72
         {
73
-            if (!is_dir (dirname (__DIR__) .'/cache'))
74
-                mkdir (dirname (__DIR__) .'/cache');
73
+            if (!is_dir(dirname(__DIR__).'/cache'))
74
+                mkdir(dirname(__DIR__).'/cache');
75 75
 
76
-            file_put_contents (VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache', gzdeflate (serialize ([sha1 (file_get_contents (__FILE__)), $info])));
76
+            file_put_contents(VLF_EXT_DIR.'/cache/'.sha1($content).'.cache', gzdeflate(serialize([sha1(file_get_contents(__FILE__)), $info])));
77 77
         }
78 78
     }
79 79
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
      * 
86 86
      * @return array - возвращает АСД
87 87
      */
88
-    protected function generateSyntaxTree (string $content): array
88
+    protected function generateSyntaxTree(string $content): array
89 89
     {
90
-        $lines          = $this->linesFilter ($untouched_lines = explode ($this->divider, $content));
90
+        $lines          = $this->linesFilter($untouched_lines = explode($this->divider, $content));
91 91
         $current_object = null;
92 92
         $parent_objects = [];
93 93
         $skip_at        = -1;
@@ -95,18 +95,18 @@  discard block
 block discarded – undo
95 95
         $links          = [];
96 96
 
97 97
         if ($this->debug_mode)
98
-            pre ($lines);
98
+            pre($lines);
99 99
 
100 100
         foreach ($lines as $id => $line)
101 101
         {
102 102
             if ($skip_at > $id)
103 103
                 continue;
104 104
 
105
-            $height = $this->getLineHeight ($line);
106
-            $words  = $this->linesFilter (explode (' ', $line));
105
+            $height = $this->getLineHeight($line);
106
+            $words  = $this->linesFilter(explode(' ', $line));
107 107
 
108 108
             if ($this->debug_mode)
109
-                pre ($words);
109
+                pre($words);
110 110
 
111 111
             /**
112 112
              * Высокоинтеллектуальный фикс
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 $updated = false;
129 129
 
130 130
                 if ($this->debug_mode)
131
-                    pre ($current_object);
131
+                    pre($current_object);
132 132
 
133 133
                 while (isset ($tree[$current_object]['info']['subparent_link']) && $tree[$link = $tree[$current_object]['info']['subparent_link']->link]['hard'] < $tree[$current_object]['hard'])
134 134
                 {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                     $updated        = true;
137 137
 
138 138
                     if ($this->debug_mode)
139
-                        pre ($current_object);
139
+                        pre($current_object);
140 140
                 }
141 141
 
142 142
                 if (
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
                     break;
152 152
 
153 153
                 if ($this->debug_mode)
154
-                    pre ($current_object);
154
+                    pre($current_object);
155 155
             }
156 156
 
157 157
             /**
158 158
              * Button ...
159 159
              */
160
-            if (class_exists ($words[0]) || class_exists ('\VoidEngine\\'. $words[0]))
160
+            if (class_exists($words[0]) || class_exists('\VoidEngine\\'.$words[0]))
161 161
             {
162 162
                 if (!isset ($words[1]))
163
-                    throw new \Exception ('Object name mustn\'t be empty at line "'. $line .'"');
163
+                    throw new \Exception('Object name mustn\'t be empty at line "'.$line.'"');
164 164
 
165 165
                 /**
166 166
                  * Button NewButton
@@ -206,39 +206,38 @@  discard block
 block discarded – undo
206 206
                         'syntax_nodes' => []
207 207
                     ];
208 208
 
209
-                    if (($begin = strpos ($line, '(')) !== false)
209
+                    if (($begin = strpos($line, '(')) !== false)
210 210
                     {
211 211
                         ++$begin;
212 212
                         
213
-                        $end = strrpos ($line, ')');
213
+                        $end = strrpos($line, ')');
214 214
 
215 215
                         if ($end === false)
216
-                            throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
216
+                            throw new \Exception('Line "'.$line.'" have arguments list initialization, but not have list ending');
217 217
 
218 218
                         elseif ($begin < $end)
219 219
                         {
220 220
                             $arguments = [];
221
-                            $parsed    = explode (',', substr ($line, $begin, $end - $begin));
221
+                            $parsed    = explode(',', substr($line, $begin, $end - $begin));
222 222
 
223 223
                             foreach ($parsed as $argument_id => $argument)
224 224
                             {
225
-                                $argument = trim ($argument);
225
+                                $argument = trim($argument);
226 226
 
227
-                                if (strlen ($argument) > 0)
227
+                                if (strlen($argument) > 0)
228 228
                                     $arguments[] = isset ($links[$argument]) ?
229
-                                        new VLFLink ($argument, $links[$argument]) :
230
-                                        $argument;
229
+                                        new VLFLink($argument, $links[$argument]) : $argument;
231 230
 
232
-                                else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
231
+                                else throw new \Exception('Argument '.($argument_id + 1).' mustn\'t have zero length at line "'.$line.'"');
233 232
                             }
234 233
 
235 234
                             $tree[$id]['info']['arguments'] = $arguments;
236 235
 
237
-                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0)
238
-                                throw new \Exception ('You mustn\'t write any chars after arguments definition');
236
+                            if (!$this->ignore_postobject_info && trim(substr($line, $end)) > 0)
237
+                                throw new \Exception('You mustn\'t write any chars after arguments definition');
239 238
                         }
240 239
 
241
-                        $tree[$id]['info']['subparent_link'] = new VLFLink ($tree[$current_object]['info']['object_name'], $current_object);
240
+                        $tree[$id]['info']['subparent_link'] = new VLFLink($tree[$current_object]['info']['object_name'], $current_object);
242 241
                     }
243 242
 
244 243
                     /**
@@ -248,7 +247,7 @@  discard block
 block discarded – undo
248 247
                     elseif ($current_object !== null && $tree[$current_object]['hard'] < $height)
249 248
                     {
250 249
                         $tree[$id]['info']['arguments'] = [
251
-                            new VLFLink ($tree[$current_object]['info']['object_name'], $current_object)
250
+                            new VLFLink($tree[$current_object]['info']['object_name'], $current_object)
252 251
                         ];
253 252
 
254 253
                         $parent_objects[$id] = $current_object;
@@ -295,17 +294,17 @@  discard block
 block discarded – undo
295 294
                 {
296 295
                     if ($words[0][1] == '^')
297 296
                     {
298
-                        $parsed = $this->parseSubText ($untouched_lines, $id, $height);
297
+                        $parsed = $this->parseSubText($untouched_lines, $id, $height);
299 298
 
300 299
                         $comment .= $parsed[0];
301 300
                         $skip_at  = $parsed[1];
302 301
                     }
303 302
 
304
-                    else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
303
+                    else throw new \Exception('Unknown char founded after syntax-control symbol at line "'.$line.'"');
305 304
                 }
306 305
                 
307 306
                 if ($this->debug_mode)
308
-                    pre ("Comment:\n\n$comment");
307
+                    pre("Comment:\n\n$comment");
309 308
             }
310 309
 
311 310
             /**
@@ -317,19 +316,19 @@  discard block
 block discarded – undo
317 316
              */
318 317
             elseif ($words[0][0] == '%')
319 318
             {
320
-                $code = substr ($line, strlen ($words[0]));
319
+                $code = substr($line, strlen($words[0]));
321 320
 
322 321
                 if (isset ($words[0][1]))
323 322
                 {
324 323
                     if ($words[0][1] == '^')
325 324
                     {
326
-                        $parsed = $this->parseSubText ($untouched_lines, $id, $height);
325
+                        $parsed = $this->parseSubText($untouched_lines, $id, $height);
327 326
 
328 327
                         $code   .= $parsed[0];
329 328
                         $skip_at = $parsed[1];
330 329
                     }
331 330
 
332
-                    else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
331
+                    else throw new \Exception('Unknown char founded after syntax-control symbol at line "'.$line.'"');
333 332
                 }
334 333
                 
335 334
                 $tree[$id] = [
@@ -354,7 +353,7 @@  discard block
 block discarded – undo
354 353
              * Form MyForm
355 354
              *     Button MyButton
356 355
              */
357
-            elseif (is_int ($current_object) && isset ($tree[$current_object]['hard']))
356
+            elseif (is_int($current_object) && isset ($tree[$current_object]['hard']))
358 357
             {
359 358
                 if ($height <= $tree[$current_object]['hard'] && isset ($parent_objects[$current_object]))
360 359
                 {
@@ -380,16 +379,16 @@  discard block
 block discarded – undo
380 379
                 /**
381 380
                  * property_name: property_value
382 381
                  */
383
-                $postChar = substr ($words[0], strlen ($words[0]) - 1);
382
+                $postChar = substr($words[0], strlen($words[0]) - 1);
384 383
 
385 384
                 if ($postChar == ':' || $postChar == '^')
386 385
                 {
387 386
                     if (!isset ($words[1]))
388
-                        throw new \Exception ('Property value mustn\'t be empty at line "'. $line .'"');
387
+                        throw new \Exception('Property value mustn\'t be empty at line "'.$line.'"');
389 388
 
390
-                    $propertyName     = substr ($words[0], 0, -1);
391
-                    $propertyValue    = implode (' ', array_slice ($words, 1));
392
-                    $propertyRawValue = ltrim (substr ($line, strlen ($words[0])));
389
+                    $propertyName     = substr($words[0], 0, -1);
390
+                    $propertyValue    = implode(' ', array_slice($words, 1));
391
+                    $propertyRawValue = ltrim(substr($line, strlen($words[0])));
393 392
 
394 393
                     /**
395 394
                      * property_name:^ property_value_1
@@ -397,10 +396,10 @@  discard block
 block discarded – undo
397 396
                      */
398 397
                     if ($postChar == '^')
399 398
                     {
400
-                        $parsed = $this->parseSubText ($untouched_lines, $id, $height);
399
+                        $parsed = $this->parseSubText($untouched_lines, $id, $height);
401 400
 
402 401
                         $skip_at           = $parsed[1];
403
-                        $propertyName      = substr ($propertyName, 0, -1);
402
+                        $propertyName      = substr($propertyName, 0, -1);
404 403
                         $propertyRawValue .= $parsed[0];
405 404
                         $propertyValue     = $propertyRawValue;
406 405
                     }
@@ -421,7 +420,7 @@  discard block
 block discarded – undo
421 420
                     ];
422 421
 
423 422
                     if (isset ($links[$info['info']['property_value']]))
424
-                        $info['info']['property_value'] = new VLFLink ($info['info']['property_value'], $links[$info['info']['property_value']]);
423
+                        $info['info']['property_value'] = new VLFLink($info['info']['property_value'], $links[$info['info']['property_value']]);
425 424
 
426 425
                     $tree[$current_object]['syntax_nodes'][] = $info;
427 426
                 }
@@ -429,37 +428,36 @@  discard block
 block discarded – undo
429 428
                 /**
430 429
                  * ->method_name ([method_arguments])
431 430
                  */
432
-                elseif (substr ($words[0], 0, 2) == '->')
431
+                elseif (substr($words[0], 0, 2) == '->')
433 432
                 {
434 433
                     $arguments = [];
435 434
                     
436
-                    if (($begin = strpos ($line, '(')) !== false)
435
+                    if (($begin = strpos($line, '(')) !== false)
437 436
                     {
438 437
                         ++$begin;
439 438
                         
440
-                        $end = strrpos ($line, ')');
439
+                        $end = strrpos($line, ')');
441 440
 
442 441
                         if ($end === false)
443
-                            throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
442
+                            throw new \Exception('Line "'.$line.'" have arguments list initialization, but not have list ending');
444 443
 
445 444
                         elseif ($begin < $end)
446 445
                         {
447
-                            $parsed = explode (',', substr ($line, $begin, $end - $begin));
446
+                            $parsed = explode(',', substr($line, $begin, $end - $begin));
448 447
 
449 448
                             foreach ($parsed as $argument_id => $argument)
450 449
                             {
451
-                                $argument = trim ($argument);
450
+                                $argument = trim($argument);
452 451
 
453
-                                if (strlen ($argument) > 0)
452
+                                if (strlen($argument) > 0)
454 453
                                     $arguments[] = isset ($links[$argument]) ?
455
-                                        new VLFLink ($argument, $links[$argument]) :
456
-                                        $argument;
454
+                                        new VLFLink($argument, $links[$argument]) : $argument;
457 455
 
458
-                                else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
456
+                                else throw new \Exception('Argument '.($argument_id + 1).' mustn\'t have zero length at line "'.$line.'"');
459 457
                             }
460 458
 
461
-                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0)
462
-                                throw new \Exception ('You mustn\'t write any chars after arguments definition');
459
+                            if (!$this->ignore_postobject_info && trim(substr($line, $end)) > 0)
460
+                                throw new \Exception('You mustn\'t write any chars after arguments definition');
463 461
                         }
464 462
                     }
465 463
 
@@ -467,7 +465,7 @@  discard block
 block discarded – undo
467 465
                      * ->show
468 466
                      */
469 467
                     elseif (!$this->ignore_unexpected_method_args)
470
-                        throw new \Exception ('Unexpected method arguments list at line "'. $line .'"');
468
+                        throw new \Exception('Unexpected method arguments list at line "'.$line.'"');
471 469
 
472 470
                     $tree[$current_object]['syntax_nodes'][] = [
473 471
                         'type'  => VLF_METHOD_CALL,
@@ -476,7 +474,7 @@  discard block
 block discarded – undo
476 474
                         'words' => $words,
477 475
 
478 476
                         'info' => [
479
-                            'method_name'      => substr ($words[0], 2),
477
+                            'method_name'      => substr($words[0], 2),
480 478
                             'method_arguments' => $arguments
481 479
                         ],
482 480
 
@@ -499,7 +497,7 @@  discard block
 block discarded – undo
499 497
                  */
500 498
                 else
501 499
                 {
502
-                    $parsed  = $this->parseSubText ($untouched_lines, $id, $height);
500
+                    $parsed  = $this->parseSubText($untouched_lines, $id, $height);
503 501
                     $skip_at = $parsed[1];
504 502
                     
505 503
                     $tree[$id] = [
@@ -509,7 +507,7 @@  discard block
 block discarded – undo
509 507
                         'words' => $words,
510 508
 
511 509
                         'info' => [
512
-                            'object_vlf_info' => $line ."\n". $parsed[0]
510
+                            'object_vlf_info' => $line."\n".$parsed[0]
513 511
                         ],
514 512
 
515 513
                         'syntax_nodes' => []
@@ -520,7 +518,7 @@  discard block
 block discarded – undo
520 518
             /**
521 519
              * Что-то загадочное, таинственное, неизвестное человечеству
522 520
              */
523
-            else throw new \Exception ('Unknown structures founded at line "'. $line .'"');
521
+            else throw new \Exception('Unknown structures founded at line "'.$line.'"');
524 522
         }
525 523
 
526 524
         return [$tree, $links];
@@ -536,7 +534,7 @@  discard block
 block discarded – undo
536 534
      * 
537 535
      * @return array - возвращает спарсенные подстроки
538 536
      */
539
-    protected function parseSubText (array $lines, $begin_id, int $down_height): array
537
+    protected function parseSubText(array $lines, $begin_id, int $down_height): array
540 538
     {
541 539
         $parsed = "\n";
542 540
 
@@ -545,17 +543,17 @@  discard block
 block discarded – undo
545 543
             if ($line_id <= $begin_id)
546 544
                 continue;
547 545
 
548
-            if (!(bool)(trim ($line)))
546
+            if (!(bool) (trim($line)))
549 547
             {
550 548
                 $parsed .= "\n";
551 549
             
552 550
                 continue;
553 551
             }
554 552
 
555
-            $height = $this->getLineHeight ($line);
553
+            $height = $this->getLineHeight($line);
556 554
 
557 555
             if ($this->debug_mode)
558
-                pre ("$height, $down_height, $line");
556
+                pre("$height, $down_height, $line");
559 557
 
560 558
             if ($height > $down_height)
561 559
                 $parsed .= "$line\n";
@@ -566,7 +564,7 @@  discard block
 block discarded – undo
566 564
         return [$parsed, $line_id];
567 565
     }
568 566
 
569
-    public function __get ($name) // Возвращалка переменных парсера
567
+    public function __get($name) // Возвращалка переменных парсера
570 568
     {
571 569
         return isset ($this->$name) ?
572 570
             $this->$name : false;
@@ -580,14 +578,14 @@  discard block
 block discarded – undo
580 578
      * 
581 579
      * @return int - высота строки
582 580
      */
583
-    protected function getLineHeight (string &$line): int
581
+    protected function getLineHeight(string &$line): int
584 582
     {
585 583
         $i = 0;
586 584
 
587 585
         while (isset ($line[$i]) && $line[$i] == "\t")
588 586
             ++$i;
589 587
         
590
-        return strlen ($line = str_repeat ('    ', $i) . substr ($line, $i)) - strlen ($line = trim ($line));
588
+        return strlen($line = str_repeat('    ', $i).substr($line, $i)) - strlen($line = trim($line));
591 589
     }
592 590
 
593 591
     /**
@@ -598,14 +596,14 @@  discard block
 block discarded – undo
598 596
      * 
599 597
      * @return array - возвращает очищенный массив
600 598
      */
601
-    protected function linesFilter (array $segments): array
599
+    protected function linesFilter(array $segments): array
602 600
     {
603
-        return array_filter ($segments, function ($text)
601
+        return array_filter($segments, function($text)
604 602
         {
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');
603
+            if ($this->strong_line_parser && preg_match('/[^a-z0-9]/i', $text))
604
+                throw new \Exception('Line "'.$text.'" mustn\'t have any not-alphabet or not-numeric characters');
607 605
             
608
-            return strlen (trim ($text)) > 0;
606
+            return strlen(trim($text)) > 0;
609 607
         });
610 608
     }
611 609
 }
Please login to merge, or discard this 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 = 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 (VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache', gzdeflate (serialize ([sha1 (file_get_contents (__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/common/Others.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     {
48 48
         return [
49 49
             'text' => $e->getMessage (), 
50
-			'line' => $e->getLine ()
50
+            'line' => $e->getLine ()
51 51
         ];
52 52
     }
53 53
 
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 
166 166
 function substr_icount (string $haystack, string $needle, ...$params): int
167 167
 {
168
-	return substr_count (strtolower ($haystack), strtolower ($needle), ...$params);
168
+    return substr_count (strtolower ($haystack), strtolower ($needle), ...$params);
169 169
 }
170 170
 
171 171
 function str_replace_assoc (string $subject, array $replacements): string
172 172
 {
173
-	return str_replace (array_keys ($replacements), array_values ($replacements), $subject);
173
+    return str_replace (array_keys ($replacements), array_values ($replacements), $subject);
174 174
 }
175 175
 
176 176
 function pre (...$args): void
177 177
 {
178
-	message (sizeof ($args) < 2 ? current ($args) : $args);
178
+    message (sizeof ($args) < 2 ? current ($args) : $args);
179 179
 }
180 180
 
181 181
 function messageBox (string $message, string $caption = '', ...$args)
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
                     }
334 334
 
335 335
                     catch (\Throwable $e)
336
-					{
337
-						continue;
338
-					}
336
+                    {
337
+                        continue;
338
+                    }
339 339
 
340 340
                 return false;
341 341
             }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         call_user_func ($function, $self);
359 359
     };
360 360
     
361
-	$timer->start ();
361
+    $timer->start ();
362 362
     
363 363
     return $timer;
364 364
 }
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     
379 379
     $timer->start ();
380 380
     
381
-	return $timer;
381
+    return $timer;
382 382
 }
383 383
 
384 384
 class Clipboard
Please login to merge, or discard this patch.
Spacing   +133 added lines, -134 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace VoidEngine;
4 4
 
5
-function err_status (bool $status = null): bool
5
+function err_status(bool $status = null): bool
6 6
 {
7 7
     $oldStatus = $GLOBALS['error_status'];
8 8
 
@@ -12,175 +12,175 @@  discard block
 block discarded – undo
12 12
     return $oldStatus;
13 13
 }
14 14
 
15
-function err_no (): bool
15
+function err_no(): bool
16 16
 {
17
-    return err_status (false);
17
+    return err_status(false);
18 18
 }
19 19
 
20
-function err_yes (): bool
20
+function err_yes(): bool
21 21
 {
22
-    return err_status (true);
22
+    return err_status(true);
23 23
 }
24 24
 
25
-function run (string $path, ...$args)
25
+function run(string $path, ...$args)
26 26
 {
27
-    return (new Process)->start ($path, ...$args);
27
+    return (new Process)->start($path, ...$args);
28 28
 }
29 29
 
30
-function vbs_exec (string $code)
30
+function vbs_exec(string $code)
31 31
 {
32
-    file_put_contents ($path = getenv ('temp') .'/'. crc32 ($code) .'.vbs', $code);
32
+    file_put_contents($path = getenv('temp').'/'.crc32($code).'.vbs', $code);
33 33
 
34
-    (new \COM ('WScript.Shell'))->Run ($path, 0, true);
34
+    (new \COM('WScript.Shell'))->Run($path, 0, true);
35 35
 
36
-    unlink ($path);
36
+    unlink($path);
37 37
 }
38 38
 
39
-function php_errors_check (string $code): ?array
39
+function php_errors_check(string $code): ?array
40 40
 {
41 41
     try
42 42
     {
43
-        eval ('return; '. $code);
43
+        eval ('return; '.$code);
44 44
     }
45 45
 
46 46
     catch (\Throwable $e)
47 47
     {
48 48
         return [
49
-            'text' => $e->getMessage (), 
50
-			'line' => $e->getLine ()
49
+            'text' => $e->getMessage(), 
50
+			'line' => $e->getLine()
51 51
         ];
52 52
     }
53 53
 
54 54
     return null;
55 55
 }
56 56
 
57
-function enum (string $name): array
57
+function enum(string $name): array
58 58
 {
59 59
     return [
60
-        substr ($name, strrpos ($name, '.') + 1),
61
-        ($name = substr ($name, 0, strrpos ($name, '.'))) .', '. substr ($name, 0, strrpos ($name, '.'))
60
+        substr($name, strrpos($name, '.') + 1),
61
+        ($name = substr($name, 0, strrpos($name, '.'))).', '.substr($name, 0, strrpos($name, '.'))
62 62
     ];
63 63
 }
64 64
 
65
-function getNetArray (string $type, array $items = []): WFObject
65
+function getNetArray(string $type, array $items = []): WFObject
66 66
 {
67
-    $array = (new WFClass ('System.Array', null))
68
-        ->createInstance (VoidEngine::objectType ($type), $size = sizeof ($items));
67
+    $array = (new WFClass('System.Array', null))
68
+        ->createInstance(VoidEngine::objectType($type), $size = sizeof($items));
69 69
 
70 70
     for ($i = 0; $i < $size; ++$i)
71
-        $array[$i] = array_shift ($items);
71
+        $array[$i] = array_shift($items);
72 72
     
73 73
     return $array;
74 74
 }
75 75
 
76
-function dir_create (string $path, int $mode = 0777): void
76
+function dir_create(string $path, int $mode = 0777): void
77 77
 {
78
-    if (!is_dir ($path))
79
-        mkdir ($path, $mode, true);
78
+    if (!is_dir($path))
79
+        mkdir($path, $mode, true);
80 80
 }
81 81
 
82
-function dir_delete (string $path): bool
82
+function dir_delete(string $path): bool
83 83
 {
84
-    if (!is_dir ($path))
84
+    if (!is_dir($path))
85 85
         return false;
86 86
 
87
-    foreach (array_slice (scandir ($path), 2) as $file)
88
-        if (is_dir ($file = $path .'/'. $file))
87
+    foreach (array_slice(scandir($path), 2) as $file)
88
+        if (is_dir($file = $path.'/'.$file))
89 89
         {
90
-            dir_delete ($file);
90
+            dir_delete($file);
91 91
 
92
-            if (is_dir ($file))
93
-                rmdir ($file);
92
+            if (is_dir($file))
93
+                rmdir($file);
94 94
         }
95 95
 
96
-        else unlink ($file);
96
+        else unlink($file);
97 97
 
98
-    rmdir ($path);
98
+    rmdir($path);
99 99
 
100 100
     return true;
101 101
 }
102 102
 
103
-function dir_clean (string $path): void
103
+function dir_clean(string $path): void
104 104
 {
105
-    dir_delete ($path);
106
-    dir_create ($path);
105
+    dir_delete($path);
106
+    dir_create($path);
107 107
 }
108 108
 
109
-function dir_copy (string $from, string $to): bool
109
+function dir_copy(string $from, string $to): bool
110 110
 {
111
-    if (!is_dir ($from))
111
+    if (!is_dir($from))
112 112
         return false;
113 113
 
114
-    if (!is_dir ($to))
115
-        dir_create ($to);
114
+    if (!is_dir($to))
115
+        dir_create($to);
116 116
 
117
-    foreach (array_slice (scandir ($from), 2) as $file)
118
-        if (is_dir ($f = $from .'/'. $file))
119
-            dir_copy ($f, $to .'/'. $file);
117
+    foreach (array_slice(scandir($from), 2) as $file)
118
+        if (is_dir($f = $from.'/'.$file))
119
+            dir_copy($f, $to.'/'.$file);
120 120
 
121
-        else copy ($f, $to .'/'. $file);
121
+        else copy($f, $to.'/'.$file);
122 122
 
123 123
     return true;
124 124
 }
125 125
 
126
-function getARGBColor (string $color)
126
+function getARGBColor(string $color)
127 127
 {
128
-    return (new WFClass ('System.Drawing.ColorTranslator'))->fromHtml ($color);
128
+    return (new WFClass('System.Drawing.ColorTranslator'))->fromHtml($color);
129 129
 }
130 130
 
131
-function replaceSl (string $string): string
131
+function replaceSl(string $string): string
132 132
 {
133
-    return str_replace ('\\', '/', $string);
133
+    return str_replace('\\', '/', $string);
134 134
 }
135 135
 
136
-function replaceSr (string $string): string
136
+function replaceSr(string $string): string
137 137
 {
138
-    return str_replace ('/', '\\', $string);
138
+    return str_replace('/', '\\', $string);
139 139
 }
140 140
 
141
-function basenameNoExt (string $path): string
141
+function basenameNoExt(string $path): string
142 142
 {
143
-    return pathinfo ($path, PATHINFO_FILENAME);
143
+    return pathinfo($path, PATHINFO_FILENAME);
144 144
 }
145 145
 
146
-function file_ext (string $path): string
146
+function file_ext(string $path): string
147 147
 {
148
-    return strtolower (pathinfo ($path, PATHINFO_EXTENSION));
148
+    return strtolower(pathinfo($path, PATHINFO_EXTENSION));
149 149
 }
150 150
 
151
-function filepathNoExt (string $path): string
151
+function filepathNoExt(string $path): string
152 152
 {
153
-    return dirname ($path) .'/'. basenameNoExt ($path);
153
+    return dirname($path).'/'.basenameNoExt($path);
154 154
 }
155 155
 
156
-function array_first (array $array)
156
+function array_first(array $array)
157 157
 {
158
-    return array_shift ($array);
158
+    return array_shift($array);
159 159
 }
160 160
 
161
-function array_end (array $array)
161
+function array_end(array $array)
162 162
 {
163
-    return array_pop ($array);
163
+    return array_pop($array);
164 164
 }
165 165
 
166
-function substr_icount (string $haystack, string $needle, ...$params): int
166
+function substr_icount(string $haystack, string $needle, ...$params): int
167 167
 {
168
-	return substr_count (strtolower ($haystack), strtolower ($needle), ...$params);
168
+	return substr_count(strtolower($haystack), strtolower($needle), ...$params);
169 169
 }
170 170
 
171
-function str_replace_assoc (string $subject, array $replacements): string
171
+function str_replace_assoc(string $subject, array $replacements): string
172 172
 {
173
-	return str_replace (array_keys ($replacements), array_values ($replacements), $subject);
173
+	return str_replace(array_keys($replacements), array_values($replacements), $subject);
174 174
 }
175 175
 
176
-function pre (...$args): void
176
+function pre(...$args): void
177 177
 {
178
-	message (sizeof ($args) < 2 ? current ($args) : $args);
178
+	message(sizeof($args) < 2 ? current ($args) : $args);
179 179
 }
180 180
 
181
-function messageBox (string $message, string $caption = '', ...$args)
181
+function messageBox(string $message, string $caption = '', ...$args)
182 182
 {
183
-    return (new MessageBox)->show ($message, $caption, ...$args);
183
+    return (new MessageBox)->show($message, $caption, ...$args);
184 184
 }
185 185
 
186 186
 class Components
@@ -188,47 +188,47 @@  discard block
 block discarded – undo
188 188
     static $components = [];
189 189
     static $events = [];
190 190
 
191
-    public static function addComponent (int $selector, object $object): void
191
+    public static function addComponent(int $selector, object $object): void
192 192
     {
193 193
         self::$components[$selector] = $object;
194 194
         self::$events[$selector] = [];
195 195
     }
196 196
 
197
-    public static function getComponent (int $selector)
197
+    public static function getComponent(int $selector)
198 198
     {
199 199
         return isset (self::$components[$selector]) ?
200 200
             self::$components[$selector] : false;
201 201
     }
202 202
 
203
-    public static function componentExists (int $selector): bool
203
+    public static function componentExists(int $selector): bool
204 204
     {
205 205
         return isset (self::$components[$selector]);
206 206
     }
207 207
 
208
-    public static function setComponentEvent (int $selector, string $eventName, string $code): void
208
+    public static function setComponentEvent(int $selector, string $eventName, string $code): void
209 209
     {
210
-        self::$events[$selector][strtolower ($eventName)] = $code;
210
+        self::$events[$selector][strtolower($eventName)] = $code;
211 211
     }
212 212
 
213
-    public static function getComponentEvent (int $selector, string $eventName)
213
+    public static function getComponentEvent(int $selector, string $eventName)
214 214
     {
215
-        $eventName = strtolower ($eventName);
215
+        $eventName = strtolower($eventName);
216 216
 
217 217
         return isset (self::$events[$selector][$eventName]) ?
218 218
             self::$events[$selector][$eventName] : false;
219 219
     }
220 220
 
221
-    public static function removeComponentEvent (int $selector, string $eventName): void
221
+    public static function removeComponentEvent(int $selector, string $eventName): void
222 222
     {
223
-        unset (self::$events[$selector][strtolower ($eventName)]);
223
+        unset (self::$events[$selector][strtolower($eventName)]);
224 224
     }
225 225
 
226
-    public static function removeComponent (int $selector): void
226
+    public static function removeComponent(int $selector): void
227 227
     {
228 228
         unset (self::$components[$selector], self::$events[$selector]);
229 229
     }
230 230
 
231
-    public static function cleanJunk (): void
231
+    public static function cleanJunk(): void
232 232
     {
233 233
         // TODO: более строгие правила очистки мусорных объектов
234 234
         
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
         {
237 237
             try
238 238
             {
239
-                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))
239
+                if ($object->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')))
240 240
                     continue;
241 241
             }
242 242
 
243 243
             catch (\Exception $e) {}
244 244
             
245
-            VoidEngine::destructObject ($selector);
245
+            VoidEngine::destructObject($selector);
246 246
 
247
-            if (!VoidEngine::objectExists ($selector))
247
+            if (!VoidEngine::objectExists($selector))
248 248
             {
249 249
                 unset (self::$components[$selector]);
250 250
 
@@ -255,32 +255,32 @@  discard block
 block discarded – undo
255 255
     }
256 256
 }
257 257
 
258
-function _c (int $selector)
258
+function _c(int $selector)
259 259
 {
260
-    return Components::getComponent ($selector);
260
+    return Components::getComponent($selector);
261 261
 }
262 262
 
263
-function c ($name, bool $returnAllSimilarObjects = false)
263
+function c($name, bool $returnAllSimilarObjects = false)
264 264
 {
265
-    if (is_int ($name) && is_object ($object = _c ($name)))
265
+    if (is_int($name) && is_object($object = _c($name)))
266 266
         return $object;
267 267
 
268 268
     else
269 269
     {
270
-        $path    = explode ('->', $name);
270
+        $path    = explode('->', $name);
271 271
         $similar = [];
272 272
 
273 273
         foreach (Components::$components as $object)
274 274
             try
275 275
             {
276
-                if ($object->name == end ($path))
276
+                if ($object->name == end($path))
277 277
                 {
278
-                    if (sizeof ($path) > 1)
278
+                    if (sizeof($path) > 1)
279 279
                         try
280 280
                         {
281
-                            if (is_object ($parent = _c($object->parent->selector)))
281
+                            if (is_object($parent = _c($object->parent->selector)))
282 282
                             {
283
-                                if (c(join ('->', array_slice ($path, 0, -1))) == $parent)
283
+                                if (c(join('->', array_slice($path, 0, -1))) == $parent)
284 284
                                 {
285 285
                                     if ($returnAllSimilarObjects)
286 286
                                         $similar[] = $object;
@@ -314,18 +314,18 @@  discard block
 block discarded – undo
314 314
                 continue;
315 315
             }
316 316
 
317
-        if (sizeof ($path) == 2)
317
+        if (sizeof($path) == 2)
318 318
         {
319 319
             $objects = c($path[1], true);
320 320
 
321
-            if (is_array ($objects))
321
+            if (is_array($objects))
322 322
             {
323 323
                 foreach ($objects as $id => $object)
324 324
                     try
325 325
                     {
326
-                        while (is_object ($parent = _c($object->parent->selector)))
326
+                        while (is_object($parent = _c($object->parent->selector)))
327 327
                         {
328
-                            if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
328
+                            if ($parent->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
329 329
                                 return $objects[$id];
330 330
 
331 331
                             else $object = $parent;
@@ -343,70 +343,70 @@  discard block
 block discarded – undo
343 343
             else return false;
344 344
         }
345 345
 
346
-        else return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
346
+        else return $returnAllSimilarObjects && sizeof($similar) > 0 ?
347 347
             $similar : false;
348 348
     }
349 349
 }
350 350
 
351
-function setTimer (int $interval, callable $function): Timer
351
+function setTimer(int $interval, callable $function): Timer
352 352
 {
353 353
     $timer = new Timer;
354 354
     $timer->interval = $interval;
355 355
     
356
-    $timer->tickEvent = function ($self) use ($function)
356
+    $timer->tickEvent = function($self) use ($function)
357 357
     {
358
-        call_user_func ($function, $self);
358
+        call_user_func($function, $self);
359 359
     };
360 360
     
361
-	$timer->start ();
361
+	$timer->start();
362 362
     
363 363
     return $timer;
364 364
 }
365 365
 
366 366
 // FIXME: выполняется несколько раз, а не единожды
367
-function setTimeout (int $timeout, callable $function): Timer
367
+function setTimeout(int $timeout, callable $function): Timer
368 368
 {
369 369
     $timer = new Timer;
370 370
     $timer->interval = $timeout;
371 371
     
372
-    $timer->tickEvent = function ($self) use ($function)
372
+    $timer->tickEvent = function($self) use ($function)
373 373
     {
374
-        call_user_func ($function, $self);
374
+        call_user_func($function, $self);
375 375
 
376
-        $self->stop ();
376
+        $self->stop();
377 377
     };
378 378
     
379
-    $timer->start ();
379
+    $timer->start();
380 380
     
381 381
 	return $timer;
382 382
 }
383 383
 
384 384
 class Clipboard
385 385
 {
386
-    public static function getText ()
386
+    public static function getText()
387 387
     {
388
-        return (new WFClass ('System.Windows.Forms.Clipboard'))->getText ();
388
+        return (new WFClass('System.Windows.Forms.Clipboard'))->getText();
389 389
     }
390 390
     
391
-    public static function setText (string $text): void
391
+    public static function setText(string $text): void
392 392
     {
393
-        (new WFClass ('System.Windows.Forms.Clipboard'))->setText ($text);
393
+        (new WFClass('System.Windows.Forms.Clipboard'))->setText($text);
394 394
     }
395 395
     
396
-    public static function getFiles (): array
396
+    public static function getFiles(): array
397 397
     {
398
-        return (new WFClass ('System.Windows.Forms.Clipboard'))->getFileDropList ()->list;
398
+        return (new WFClass('System.Windows.Forms.Clipboard'))->getFileDropList()->list;
399 399
     }
400 400
     
401
-    public static function setFiles (array $files): void
401
+    public static function setFiles(array $files): void
402 402
     {
403
-        $collection = new WFObject ('System.Collections.Specialized.StringCollection');
403
+        $collection = new WFObject('System.Collections.Specialized.StringCollection');
404 404
 
405 405
         foreach ($files as $file)
406
-            $collection->add ((string) $file);
406
+            $collection->add((string) $file);
407 407
 
408
-        (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection);
409
-        VoidEngine::removeObjects ($collection->selector);
408
+        (new WFClass('System.Windows.Forms.Clipboard'))->setFileDropList($collection);
409
+        VoidEngine::removeObjects($collection->selector);
410 410
     }
411 411
 }
412 412
 
@@ -414,14 +414,13 @@  discard block
 block discarded – undo
414 414
 {
415 415
     protected $cursor;
416 416
 
417
-    public function __construct (int $handle = null)
417
+    public function __construct(int $handle = null)
418 418
     {
419 419
         $handle !== null ?
420
-            $this->cursor = new WFObject ('System.Windows.Forms.Cursor', 'auto', $handle) :
421
-            $this->cursor = new WFClass ('System.Windows.Forms.Cursor');
420
+            $this->cursor = new WFObject('System.Windows.Forms.Cursor', 'auto', $handle) : $this->cursor = new WFClass('System.Windows.Forms.Cursor');
422 421
     }
423 422
 
424
-    public function getPosition (): array
423
+    public function getPosition(): array
425 424
     {
426 425
         $pos = $this->cursor->position;
427 426
 
@@ -432,35 +431,35 @@  discard block
 block discarded – undo
432 431
     }
433 432
 }
434 433
 
435
-function get_cursor_x (int $handle = null): int
434
+function get_cursor_x(int $handle = null): int
436 435
 {
437
-    $cursor = new Cursor ($handle);
436
+    $cursor = new Cursor($handle);
438 437
 
439
-    return $cursor->getPosition ()[0];
438
+    return $cursor->getPosition()[0];
440 439
 }
441 440
 
442
-function get_cursor_y (int $handle = null): int
441
+function get_cursor_y(int $handle = null): int
443 442
 {
444
-    $cursor = new Cursor ($handle);
443
+    $cursor = new Cursor($handle);
445 444
 
446
-    return $cursor->getPosition ()[1];
445
+    return $cursor->getPosition()[1];
447 446
 }
448 447
 
449
-function get_cursor_pos (int $handle = null): array
448
+function get_cursor_pos(int $handle = null): array
450 449
 {
451
-    $cursor = new Cursor ($handle);
450
+    $cursor = new Cursor($handle);
452 451
 
453
-    return $cursor->getPosition ();
452
+    return $cursor->getPosition();
454 453
 }
455 454
 
456
-set_error_handler (function (...$args)
455
+set_error_handler(function(...$args)
457 456
 {
458 457
     if ($GLOBALS['error_status'])
459
-        pre ($args);
458
+        pre($args);
460 459
 });
461 460
 
462
-set_exception_handler (function (...$args)
461
+set_exception_handler(function(...$args)
463 462
 {
464 463
     if ($GLOBALS['error_status'])
465
-        pre ($args);
464
+        pre($args);
466 465
 });
Please login to merge, or discard this patch.
Braces   +85 added lines, -75 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
 {
7 7
     $oldStatus = $GLOBALS['error_status'];
8 8
 
9
-    if ($status !== null)
10
-        $GLOBALS['error_status'] = $status;
9
+    if ($status !== null) {
10
+            $GLOBALS['error_status'] = $status;
11
+    }
11 12
 
12 13
     return $oldStatus;
13 14
 }
@@ -41,9 +42,7 @@  discard block
 block discarded – undo
41 42
     try
42 43
     {
43 44
         eval ('return; '. $code);
44
-    }
45
-
46
-    catch (\Throwable $e)
45
+    } catch (\Throwable $e)
47 46
     {
48 47
         return [
49 48
             'text' => $e->getMessage (), 
@@ -67,34 +66,39 @@  discard block
 block discarded – undo
67 66
     $array = (new WFClass ('System.Array', null))
68 67
         ->createInstance (VoidEngine::objectType ($type), $size = sizeof ($items));
69 68
 
70
-    for ($i = 0; $i < $size; ++$i)
71
-        $array[$i] = array_shift ($items);
69
+    for ($i = 0; $i < $size; ++$i) {
70
+            $array[$i] = array_shift ($items);
71
+    }
72 72
     
73 73
     return $array;
74 74
 }
75 75
 
76 76
 function dir_create (string $path, int $mode = 0777): void
77 77
 {
78
-    if (!is_dir ($path))
79
-        mkdir ($path, $mode, true);
80
-}
78
+    if (!is_dir ($path)) {
79
+            mkdir ($path, $mode, true);
80
+    }
81
+    }
81 82
 
82 83
 function dir_delete (string $path): bool
83 84
 {
84
-    if (!is_dir ($path))
85
-        return false;
85
+    if (!is_dir ($path)) {
86
+            return false;
87
+    }
86 88
 
87
-    foreach (array_slice (scandir ($path), 2) as $file)
88
-        if (is_dir ($file = $path .'/'. $file))
89
+    foreach (array_slice (scandir ($path), 2) as $file) {
90
+            if (is_dir ($file = $path .'/'. $file))
89 91
         {
90 92
             dir_delete ($file);
93
+    }
91 94
 
92
-            if (is_dir ($file))
93
-                rmdir ($file);
95
+            if (is_dir ($file)) {
96
+                            rmdir ($file);
97
+            }
98
+        } else {
99
+            unlink ($file);
94 100
         }
95 101
 
96
-        else unlink ($file);
97
-
98 102
     rmdir ($path);
99 103
 
100 104
     return true;
@@ -108,17 +112,22 @@  discard block
 block discarded – undo
108 112
 
109 113
 function dir_copy (string $from, string $to): bool
110 114
 {
111
-    if (!is_dir ($from))
112
-        return false;
115
+    if (!is_dir ($from)) {
116
+            return false;
117
+    }
113 118
 
114
-    if (!is_dir ($to))
115
-        dir_create ($to);
119
+    if (!is_dir ($to)) {
120
+            dir_create ($to);
121
+    }
116 122
 
117
-    foreach (array_slice (scandir ($from), 2) as $file)
118
-        if (is_dir ($f = $from .'/'. $file))
123
+    foreach (array_slice (scandir ($from), 2) as $file) {
124
+            if (is_dir ($f = $from .'/'. $file))
119 125
             dir_copy ($f, $to .'/'. $file);
126
+    }
120 127
 
121
-        else copy ($f, $to .'/'. $file);
128
+        else {
129
+            copy ($f, $to .'/'. $file);
130
+        }
122 131
 
123 132
     return true;
124 133
 }
@@ -236,11 +245,10 @@  discard block
 block discarded – undo
236 245
         {
237 246
             try
238 247
             {
239
-                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))
240
-                    continue;
241
-            }
242
-
243
-            catch (\Exception $e) {}
248
+                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms'))) {
249
+                                    continue;
250
+                }
251
+            } catch (\Exception $e) {}
244 252
             
245 253
             VoidEngine::destructObject ($selector);
246 254
 
@@ -248,8 +256,9 @@  discard block
 block discarded – undo
248 256
             {
249 257
                 unset (self::$components[$selector]);
250 258
 
251
-                if (isset (self::$events[$selector]))
252
-                    unset (self::$events[$selector]);
259
+                if (isset (self::$events[$selector])) {
260
+                                    unset (self::$events[$selector]);
261
+                }
253 262
             }
254 263
         }
255 264
     }
@@ -262,16 +271,15 @@  discard block
 block discarded – undo
262 271
 
263 272
 function c ($name, bool $returnAllSimilarObjects = false)
264 273
 {
265
-    if (is_int ($name) && is_object ($object = _c ($name)))
266
-        return $object;
267
-
268
-    else
274
+    if (is_int ($name) && is_object ($object = _c ($name))) {
275
+            return $object;
276
+    } else
269 277
     {
270 278
         $path    = explode ('->', $name);
271 279
         $similar = [];
272 280
 
273
-        foreach (Components::$components as $object)
274
-            try
281
+        foreach (Components::$components as $object) {
282
+                    try
275 283
             {
276 284
                 if ($object->name == end ($path))
277 285
                 {
@@ -284,32 +292,30 @@  discard block
 block discarded – undo
284 292
                                 {
285 293
                                     if ($returnAllSimilarObjects)
286 294
                                         $similar[] = $object;
295
+        }
287 296
 
288
-                                    else return $object;
297
+                                    else {
298
+                                        return $object;
299
+                                    }
300
+                                } else {
301
+                                    continue;
289 302
                                 }
290
-
291
-                                else continue;
303
+                            } else {
304
+                                continue;
292 305
                             }
293
-
294
-                            else continue;
295
-                        }
296
-
297
-                        catch (\Throwable $e)
306
+                        } catch (\Throwable $e)
298 307
                         {
299 308
                             continue;
300
-                        }
301
-
302
-                    else
309
+                        } else
303 310
                     {
304
-                        if ($returnAllSimilarObjects)
305
-                            $similar[] = $object;
306
-
307
-                        else return $object;
311
+                        if ($returnAllSimilarObjects) {
312
+                                                    $similar[] = $object;
313
+                        } else {
314
+                            return $object;
315
+                        }
308 316
                     }
309 317
                 }
310
-            }
311
-
312
-            catch (\Exception $e)
318
+            } catch (\Exception $e)
313 319
             {
314 320
                 continue;
315 321
             }
@@ -320,31 +326,32 @@  discard block
 block discarded – undo
320 326
 
321 327
             if (is_array ($objects))
322 328
             {
323
-                foreach ($objects as $id => $object)
324
-                    try
329
+                foreach ($objects as $id => $object) {
330
+                                    try
325 331
                     {
326 332
                         while (is_object ($parent = _c($object->parent->selector)))
327 333
                         {
328 334
                             if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
329 335
                                 return $objects[$id];
336
+                }
330 337
 
331
-                            else $object = $parent;
338
+                            else {
339
+                                $object = $parent;
340
+                            }
332 341
                         }
333
-                    }
334
-
335
-                    catch (\Throwable $e)
342
+                    } catch (\Throwable $e)
336 343
 					{
337 344
 						continue;
338 345
 					}
339 346
 
340 347
                 return false;
348
+            } else {
349
+                return false;
341 350
             }
342
-
343
-            else return false;
344
-        }
345
-
346
-        else return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
351
+        } else {
352
+            return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
347 353
             $similar : false;
354
+        }
348 355
     }
349 356
 }
350 357
 
@@ -402,8 +409,9 @@  discard block
 block discarded – undo
402 409
     {
403 410
         $collection = new WFObject ('System.Collections.Specialized.StringCollection');
404 411
 
405
-        foreach ($files as $file)
406
-            $collection->add ((string) $file);
412
+        foreach ($files as $file) {
413
+                    $collection->add ((string) $file);
414
+        }
407 415
 
408 416
         (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection);
409 417
         VoidEngine::removeObjects ($collection->selector);
@@ -455,12 +463,14 @@  discard block
 block discarded – undo
455 463
 
456 464
 set_error_handler (function (...$args)
457 465
 {
458
-    if ($GLOBALS['error_status'])
459
-        pre ($args);
460
-});
466
+    if ($GLOBALS['error_status']) {
467
+            pre ($args);
468
+    }
469
+    });
461 470
 
462 471
 set_exception_handler (function (...$args)
463 472
 {
464
-    if ($GLOBALS['error_status'])
465
-        pre ($args);
466
-});
473
+    if ($GLOBALS['error_status']) {
474
+            pre ($args);
475
+    }
476
+    });
Please login to merge, or discard this patch.
engine/components/PictureBox.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,48 +4,48 @@
 block discarded – undo
4 4
 
5 5
 class PictureBox extends Control
6 6
 {
7
-	public $class = 'System.Windows.Forms.PictureBox';
7
+    public $class = 'System.Windows.Forms.PictureBox';
8 8
 
9
-	protected $image;
9
+    protected $image;
10 10
 	
11
-	public function __construct (Component $parent = null)
12
-	{
11
+    public function __construct (Component $parent = null)
12
+    {
13 13
         parent::__construct ($parent, $this->class);
14 14
         
15
-		$this->image = new PictureBoxImage ($this->selector);
16
-	}
15
+        $this->image = new PictureBoxImage ($this->selector);
16
+    }
17 17
 }
18 18
 
19 19
 class PictureBoxImage
20 20
 {
21
-	protected $selector;
21
+    protected $selector;
22 22
     protected $pictureBoxSelector;
23 23
     protected $clipboard;
24 24
     
25
-	public function __construct (int $pictureBoxSelector)
26
-	{
27
-		$this->pictureBoxSelector = $pictureBoxSelector;
28
-		$this->selector			  = VoidEngine::getProperty ($pictureBoxSelector, 'Image');
29
-		$this->clipboard		  = new WFClass ('System.Windows.Forms.Clipboard');
30
-	}
25
+    public function __construct (int $pictureBoxSelector)
26
+    {
27
+        $this->pictureBoxSelector = $pictureBoxSelector;
28
+        $this->selector			  = VoidEngine::getProperty ($pictureBoxSelector, 'Image');
29
+        $this->clipboard		  = new WFClass ('System.Windows.Forms.Clipboard');
30
+    }
31 31
 	
32
-	public function loadFromFile (string $file)
33
-	{
32
+    public function loadFromFile (string $file)
33
+    {
34 34
         VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', (new Image ())->loadFromFile ($file)->selector);
35
-	}
35
+    }
36 36
 	
37
-	public function saveToFile (string $file)
38
-	{
39
-		VoidEngine::callMethod ($this->selector, 'Save', $file);
40
-	}
37
+    public function saveToFile (string $file)
38
+    {
39
+        VoidEngine::callMethod ($this->selector, 'Save', $file);
40
+    }
41 41
 	
42
-	public function loadFromClipboard ()
43
-	{
44
-		VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ());
45
-	}
42
+    public function loadFromClipboard ()
43
+    {
44
+        VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ());
45
+    }
46 46
 	
47
-	public function saveToClipboard ()
48
-	{
49
-		$this->clipboard->setImage (VoidEngine::getProperty ($this->pictureBoxSelector, 'Image'));
50
-	}
47
+    public function saveToClipboard ()
48
+    {
49
+        $this->clipboard->setImage (VoidEngine::getProperty ($this->pictureBoxSelector, 'Image'));
50
+    }
51 51
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
 
9 9
 	protected $image;
10 10
 	
11
-	public function __construct (Component $parent = null)
11
+	public function __construct(Component $parent = null)
12 12
 	{
13
-        parent::__construct ($parent, $this->class);
13
+        parent::__construct($parent, $this->class);
14 14
         
15
-		$this->image = new PictureBoxImage ($this->selector);
15
+		$this->image = new PictureBoxImage($this->selector);
16 16
 	}
17 17
 }
18 18
 
@@ -22,30 +22,30 @@  discard block
 block discarded – undo
22 22
     protected $pictureBoxSelector;
23 23
     protected $clipboard;
24 24
     
25
-	public function __construct (int $pictureBoxSelector)
25
+	public function __construct(int $pictureBoxSelector)
26 26
 	{
27 27
 		$this->pictureBoxSelector = $pictureBoxSelector;
28
-		$this->selector			  = VoidEngine::getProperty ($pictureBoxSelector, 'Image');
29
-		$this->clipboard		  = new WFClass ('System.Windows.Forms.Clipboard');
28
+		$this->selector			  = VoidEngine::getProperty($pictureBoxSelector, 'Image');
29
+		$this->clipboard		  = new WFClass('System.Windows.Forms.Clipboard');
30 30
 	}
31 31
 	
32
-	public function loadFromFile (string $file)
32
+	public function loadFromFile(string $file)
33 33
 	{
34
-        VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', (new Image ())->loadFromFile ($file)->selector);
34
+        VoidEngine::setProperty($this->pictureBoxSelector, 'Image', (new Image())->loadFromFile($file)->selector);
35 35
 	}
36 36
 	
37
-	public function saveToFile (string $file)
37
+	public function saveToFile(string $file)
38 38
 	{
39
-		VoidEngine::callMethod ($this->selector, 'Save', $file);
39
+		VoidEngine::callMethod($this->selector, 'Save', $file);
40 40
 	}
41 41
 	
42
-	public function loadFromClipboard ()
42
+	public function loadFromClipboard()
43 43
 	{
44
-		VoidEngine::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ());
44
+		VoidEngine::setProperty($this->pictureBoxSelector, 'Image', $this->clipboard->getImage());
45 45
 	}
46 46
 	
47
-	public function saveToClipboard ()
47
+	public function saveToClipboard()
48 48
 	{
49
-		$this->clipboard->setImage (VoidEngine::getProperty ($this->pictureBoxSelector, 'Image'));
49
+		$this->clipboard->setImage(VoidEngine::getProperty($this->pictureBoxSelector, 'Image'));
50 50
 	}
51 51
 }
Please login to merge, or discard this patch.
engine/components/Designer.php 2 patches
Spacing   +91 added lines, -92 removed lines patch added patch discarded remove patch
@@ -20,21 +20,20 @@  discard block
 block discarded – undo
20 20
     protected $currentSelectedItem;
21 21
     protected $formsList;
22 22
 
23
-    public function __construct (Component $parent, string $formName = 'form', PropertyGrid $propertyGrid, EventGrid $eventsList, ComboBox $currentSelectedItem, TabControl $formsList, $form = null)
23
+    public function __construct(Component $parent, string $formName = 'form', PropertyGrid $propertyGrid, EventGrid $eventsList, ComboBox $currentSelectedItem, TabControl $formsList, $form = null)
24 24
     {
25
-        $this->form = $form === null ? new Form :
26
-            EngineAdditions::coupleSelector ($form);
25
+        $this->form = $form === null ? new Form : EngineAdditions::coupleSelector($form);
27 26
 
28
-        if (!is_object ($this->form))
29
-            throw new \Exception ('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
27
+        if (!is_object($this->form))
28
+            throw new \Exception('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
30 29
 
31 30
         $this->propertyGrid        = $propertyGrid;
32 31
         $this->eventsList          = $eventsList;
33 32
         $this->currentSelectedItem = $currentSelectedItem;
34 33
         $this->formsList           = $formsList;
35 34
 
36
-        $this->selector = VoidEngine::createObject ('WinForms_PHP.FormDesigner4', null, $this->form->selector, $formName);
37
-        Components::addComponent ($this->selector, $this);
35
+        $this->selector = VoidEngine::createObject('WinForms_PHP.FormDesigner4', null, $this->form->selector, $formName);
36
+        Components::addComponent($this->selector, $this);
38 37
 
39 38
         $this->form->name = $formName;
40 39
 
@@ -44,185 +43,185 @@  discard block
 block discarded – undo
44 43
             $this->form->size = [400, 360];
45 44
         }
46 45
 
47
-        $this->control = $this->callMethod ('GetControl');
46
+        $this->control = $this->callMethod('GetControl');
48 47
         $this->objects[$formName] = ['System.Windows.Forms.Form', 'System.Windows.Forms'];
49 48
 
50
-        VoidEngine::setProperty ($this->control, 'Parent', $parent->selector);
49
+        VoidEngine::setProperty($this->control, 'Parent', $parent->selector);
51 50
 
52
-        VoidEngine::setObjectEvent ($this->control, 'KeyDown', '
51
+        VoidEngine::setObjectEvent($this->control, 'KeyDown', '
53 52
             namespace VoidEngine;
54 53
 
55 54
             if ((new WFObject ($args))->keycode == 46)
56
-                _c('. $this->selector .')->removeSelected ();
55
+                _c('. $this->selector.')->removeSelected ();
57 56
         ');
58 57
 
59
-        VoidEngine::setObjectEvent ($this->selector, 'SelectionChanged', '
58
+        VoidEngine::setObjectEvent($this->selector, 'SelectionChanged', '
60 59
             namespace VoidEngine;
61 60
 
62
-            $objects     = VoidEngine::callMethod ('. $this->selector .', "GetSelectedComponents");
61
+            $objects     = VoidEngine::callMethod ('. $this->selector.', "GetSelectedComponents");
63 62
             $firstObject = VoidEngine::getArrayValue ($objects, 0);
64 63
             
65
-            _c('. $propertyGrid->selector .')->selectedObject = $firstObject;
66
-            _c('. $eventsList->selector .')->selectedObject = $firstObject;
67
-            _c('. $currentSelectedItem->selector .')->selectedItem = _c('. $this->selector .')->getComponentName ($firstObject);
64
+            _c('. $propertyGrid->selector.')->selectedObject = $firstObject;
65
+            _c('. $eventsList->selector.')->selectedObject = $firstObject;
66
+            _c('. $currentSelectedItem->selector.')->selectedItem = _c('.$this->selector.')->getComponentName ($firstObject);
68 67
 
69 68
             if (isset (Components::$events[$firstObject]) && sizeof (Components::$events[$firstObject]) > 0)
70 69
                 foreach (Components::$events[$firstObject] as $eventName => $event)
71
-                    _c('. $eventsList->selector .')->getEventByName ($eventName)->value = "(добавлено)";
70
+                    _c('. $eventsList->selector.')->getEventByName ($eventName)->value = "(добавлено)";
72 71
 
73
-            _c('. $eventsList->selector .')->refresh ();
72
+            _c('. $eventsList->selector.')->refresh ();
74 73
         ');
75 74
     }
76 75
 
77
-    public function initDesigner (): void
76
+    public function initDesigner(): void
78 77
     {
79
-        $this->componentAddedEvent = function ($self, $args)
78
+        $this->componentAddedEvent = function($self, $args)
80 79
         {
81 80
             if (isset ($GLOBALS['new_component']))
82 81
             {
83
-                $self->setComponentToHistory ($GLOBALS['new_component'][1], $GLOBALS['new_component'][0]);
84
-                $components = VoidStudioAPI::getObjects ('main')['PropertiesPanel__SelectedComponent'];
82
+                $self->setComponentToHistory($GLOBALS['new_component'][1], $GLOBALS['new_component'][0]);
83
+                $components = VoidStudioAPI::getObjects('main')['PropertiesPanel__SelectedComponent'];
85 84
 
86
-                $components->items->clear ();
87
-                $components->items->addRange (array_keys ($self->objects));
85
+                $components->items->clear();
86
+                $components->items->addRange(array_keys($self->objects));
88 87
 
89 88
                 $components->selectedItem = $GLOBALS['new_component'][0];
90
-                $self->setSelectedComponents ($args->component);
89
+                $self->setSelectedComponents($args->component);
91 90
 
92 91
                 unset ($GLOBALS['new_component']);
93 92
             }
94 93
         };
95 94
 
96
-        $this->rightClickEvent = function ($self, $args)
95
+        $this->rightClickEvent = function($self, $args)
97 96
         {
98
-            $delItem = new ToolStripMenuItem ('Удалить');
99
-            $delItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Delete_16x.png');
100
-            $delItem->clickEvent = function () use ($self)
97
+            $delItem = new ToolStripMenuItem('Удалить');
98
+            $delItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Delete_16x.png');
99
+            $delItem->clickEvent = function() use ($self)
101 100
             {
102
-                $self->removeSelected ();
101
+                $self->removeSelected();
103 102
             };
104 103
 
105
-            $toFrontItem = new ToolStripMenuItem ('На передний план');
106
-            $toFrontItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Front_16x.png');
107
-            $toFrontItem->clickEvent = function () use ($self)
104
+            $toFrontItem = new ToolStripMenuItem('На передний план');
105
+            $toFrontItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Front_16x.png');
106
+            $toFrontItem->clickEvent = function() use ($self)
108 107
             {
109
-                $self->bringToFrontSelected ();
108
+                $self->bringToFrontSelected();
110 109
             };
111 110
 
112
-            $toBackItem = new ToolStripMenuItem ('На задний план');
113
-            $toBackItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Back_16x.png');
114
-            $toBackItem->clickEvent = function () use ($self)
111
+            $toBackItem = new ToolStripMenuItem('На задний план');
112
+            $toBackItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Back_16x.png');
113
+            $toBackItem->clickEvent = function() use ($self)
115 114
             {
116
-                $self->sendToBackSelected ();
115
+                $self->sendToBackSelected();
117 116
             };
118 117
 
119
-            $infoItem = new ToolStripMenuItem ('Отладочная информация');
120
-            $infoItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Debug_16x.png');
121
-            $infoItem->clickEvent = function () use ($self)
118
+            $infoItem = new ToolStripMenuItem('Отладочная информация');
119
+            $infoItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Debug_16x.png');
120
+            $infoItem->clickEvent = function() use ($self)
122 121
             {
123
-                $self->getSelectedComponents ()->foreach (function ($value) use ($self)
122
+                $self->getSelectedComponents()->foreach(function($value) use ($self)
124 123
                 {
125
-                    pre ($value instanceof Component ? $value : $value->toString () ."\nSelector: ". $value->selector);
124
+                    pre($value instanceof Component ? $value : $value->toString()."\nSelector: ".$value->selector);
126 125
 
127 126
                     // if ($value->getType ()->toString () == 'System.Windows.Forms.Form')
128 127
                     // if ($value->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))
129
-                        pre ($self->getSharpCode ($self->form->name));
128
+                        pre($self->getSharpCode($self->form->name));
130 129
                 });
131 130
             };
132 131
 
133 132
             $menu = new ContextMenuStrip;
134
-            $menu->items->addRange ([
133
+            $menu->items->addRange([
135 134
                 $delItem, '-',
136 135
                 $toFrontItem, $toBackItem, '-',
137 136
                 $infoItem
138 137
             ]);
139 138
 
140
-            $menu->show ($self->form, $self->form->pointToClient (VoidEngine::createObject ('System.Drawing.Point', 'System.Drawing', $args->x, $args->y)));
139
+            $menu->show($self->form, $self->form->pointToClient(VoidEngine::createObject('System.Drawing.Point', 'System.Drawing', $args->x, $args->y)));
141 140
         };
142 141
 
143
-        VoidStudioAPI::addObjects ('main', ['Designer__'. $this->form->name .'Designer' => $this]);
142
+        VoidStudioAPI::addObjects('main', ['Designer__'.$this->form->name.'Designer' => $this]);
144 143
     }
145 144
 
146
-    public function focus (): void
145
+    public function focus(): void
147 146
     {
148
-        $this->form->focus ();
147
+        $this->form->focus();
149 148
     }
150 149
 
151
-    public function getSharpCode (string $formName, bool $asObject = false): string
150
+    public function getSharpCode(string $formName, bool $asObject = false): string
152 151
     {
153
-        $code = $this->callMethod (['GetSharpCode', 'object'], $formName);
152
+        $code = $this->callMethod(['GetSharpCode', 'object'], $formName);
154 153
 
155
-        $code = VoidEngine::callMethod ($code, ['Replace', 'object'], 'public class '. $this->form->name .' : '. $this->form->name, 'public class '. $this->form->name .' : System.Windows.Forms.Form');
156
-        $code = VoidEngine::callMethod ($code, ['Replace', 'object'], '    private ', '    public ');
154
+        $code = VoidEngine::callMethod($code, ['Replace', 'object'], 'public class '.$this->form->name.' : '.$this->form->name, 'public class '.$this->form->name.' : System.Windows.Forms.Form');
155
+        $code = VoidEngine::callMethod($code, ['Replace', 'object'], '    private ', '    public ');
157 156
 
158 157
         return $asObject ?
159
-            $code : VoidEngine::callMethod ($code, 'ToString');
158
+            $code : VoidEngine::callMethod($code, 'ToString');
160 159
     }
161 160
 
162
-    public function createComponent (array $component, string $componentName): int
161
+    public function createComponent(array $component, string $componentName): int
163 162
     {
164 163
         $this->objects[$componentName] = $component;
165
-        $selector = VoidEngine::createObject (...$component);
164
+        $selector = VoidEngine::createObject(...$component);
166 165
 
167
-        $this->callMethod ('AddComponent', $selector, $componentName);
166
+        $this->callMethod('AddComponent', $selector, $componentName);
168 167
 
169 168
         return $selector;
170 169
     }
171 170
 
172
-    public function setComponentToHistory (array $component, string $componentName): void
171
+    public function setComponentToHistory(array $component, string $componentName): void
173 172
     {
174 173
         $this->objects[$componentName] = $component;
175 174
     }
176 175
 
177
-    public function addComponent (int $selector, string $componentName): void
176
+    public function addComponent(int $selector, string $componentName): void
178 177
     {
179
-        $this->objects[$componentName] = [VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'ToString'), 'auto'];
178
+        $this->objects[$componentName] = [VoidEngine::callMethod(VoidEngine::callMethod($selector, 'GetType'), 'ToString'), 'auto'];
180 179
 
181
-        $this->callMethod ('AddComponent', $selector, $componentName);
180
+        $this->callMethod('AddComponent', $selector, $componentName);
182 181
     }
183 182
 
184
-    public function removeComponent (int $component): void
183
+    public function removeComponent(int $component): void
185 184
     {
186
-        unset ($this->objects[$this->getComponentName ($component)]);
185
+        unset ($this->objects[$this->getComponentName($component)]);
187 186
 
188
-        $this->callMethod ('RemoveComponent', $component);
187
+        $this->callMethod('RemoveComponent', $component);
189 188
     }
190 189
 
191
-    public function removeComponentHistoryByName (string $name): void
190
+    public function removeComponentHistoryByName(string $name): void
192 191
     {
193 192
         unset ($this->objects[$name]);
194 193
     }
195 194
 
196
-    public function removeSelected (): void
195
+    public function removeSelected(): void
197 196
     {
198 197
         $toUnset = [];
199 198
 
200
-        foreach ($this->getSelectedComponents ()->list as $object)
199
+        foreach ($this->getSelectedComponents()->list as $object)
201 200
         {
202
-            if ($object->getType ()->toString () != 'System.Windows.Forms.Form')
203
-                $toUnset[] = $this->getComponentName ($object->selector);
201
+            if ($object->getType()->toString() != 'System.Windows.Forms.Form')
202
+                $toUnset[] = $this->getComponentName($object->selector);
204 203
 
205 204
             else
206 205
             {
207 206
                 if ($this->formsList->items->count > 1)
208 207
                 {
209
-                    if (messageBox ('Вы действительно хотите удалить форму "'. $this->form->name .'"?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
208
+                    if (messageBox('Вы действительно хотите удалить форму "'.$this->form->name.'"?', 'Подтвердите действие', enum('System.Windows.Forms.MessageBoxButtons.YesNo'), enum('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
210 209
                     {
211 210
                         foreach ($this->objects as $name => $obj)
212 211
                             unset ($this->objects[$name]);
213 212
 
214
-                        unset ($this->formsList->items[array_flip ($this->formsList->items->names)[$form = $this->getComponentName ($object->selector)]]);
213
+                        unset ($this->formsList->items[array_flip($this->formsList->items->names)[$form = $this->getComponentName($object->selector)]]);
215 214
 
216 215
                         /*$this->form->dispose ();
217 216
                         VoidEngine::callMethod ($this->control, 'Dispose');*/
218
-                        $this->callMethod ('DeleteSelected');
217
+                        $this->callMethod('DeleteSelected');
219 218
 
220
-                        $designer = VoidStudioAPI::getObjects ('main')['Designer__'. $this->formsList->selectedTab->text .'Designer'];
219
+                        $designer = VoidStudioAPI::getObjects('main')['Designer__'.$this->formsList->selectedTab->text.'Designer'];
221 220
                         
222 221
                         $designer->propertyGrid->selectedObject = $designer->form;
223
-                        $designer->setSelectedComponents ($designer->form);
222
+                        $designer->setSelectedComponents($designer->form);
224 223
 
225
-                        unset (VoidStudioAPI::$objects['main']['Designer__'. $form .'Designer']);
224
+                        unset (VoidStudioAPI::$objects['main']['Designer__'.$form.'Designer']);
226 225
 
227 226
                         return;
228 227
                     }
@@ -230,7 +229,7 @@  discard block
 block discarded – undo
230 229
 
231 230
                 else
232 231
                 {
233
-                    messageBox ('Нельзя удалить единственную форму проекта', 'Ошибка удаления', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
232
+                    messageBox('Нельзя удалить единственную форму проекта', 'Ошибка удаления', enum('System.Windows.Forms.MessageBoxButtons.OK'), enum('System.Windows.Forms.MessageBoxIcon.Error'));
234 233
 
235 234
                     return;
236 235
                 }
@@ -240,52 +239,52 @@  discard block
 block discarded – undo
240 239
         foreach ($toUnset as $name)
241 240
             unset ($this->objects[$name]);
242 241
 
243
-        $this->callMethod ('DeleteSelected');
242
+        $this->callMethod('DeleteSelected');
244 243
 
245 244
         foreach ($this->objects as $objectName => $object)
246
-            if (!is_int ($this->getComponentByName ($objectName)))
245
+            if (!is_int($this->getComponentByName($objectName)))
247 246
                 unset ($this->objects[$objectName]);
248 247
 
249
-        $this->currentSelectedItem->items->clear ();
250
-        $this->currentSelectedItem->items->addRange (array_keys ($this->objects));
248
+        $this->currentSelectedItem->items->clear();
249
+        $this->currentSelectedItem->items->addRange(array_keys($this->objects));
251 250
         $this->currentSelectedItem->selectedItem = $this->form->name;
252 251
     }
253 252
 
254
-    public function renameComponent (int $component, string $name, string $fromName = null): void
253
+    public function renameComponent(int $component, string $name, string $fromName = null): void
255 254
     {
256 255
         if ($fromName === null)
257
-            $fromName = $this->getComponentName ($component);
256
+            $fromName = $this->getComponentName($component);
258 257
 
259 258
         $info = $this->objects[$fromName];
260 259
         unset ($this->objects[$fromName]);
261 260
         $this->objects[$name] = $info;
262 261
 
263
-        $this->callMethod ('RenameComponent', $component, $name);
262
+        $this->callMethod('RenameComponent', $component, $name);
264 263
     }
265 264
 
266
-    public function getComponentName (int $component): string
265
+    public function getComponentName(int $component): string
267 266
     {
268
-        return $this->callMethod ('GetComponentName', $component);
267
+        return $this->callMethod('GetComponentName', $component);
269 268
     }
270 269
 
271
-    public function getComponentByName (string $name)
270
+    public function getComponentByName(string $name)
272 271
     {
273
-        return $this->callMethod ('GetComponentByName', $name);
272
+        return $this->callMethod('GetComponentByName', $name);
274 273
     }
275 274
 
276
-    public function getComponentClass (string $name)
275
+    public function getComponentClass(string $name)
277 276
     {
278 277
         return isset ($this->objects[$name]) ?
279 278
             $this->objects[$name] : false;
280 279
     }
281 280
 
282
-    public function addProperty (int $selector, string $name, int $value, bool $readOnly, string $category, string $description, bool $visible)
281
+    public function addProperty(int $selector, string $name, int $value, bool $readOnly, string $category, string $description, bool $visible)
283 282
     {
284
-        $this->callMethod ('AddProperty', $selector, $name, $value, $readOnly, $category, $description, $visible);
283
+        $this->callMethod('AddProperty', $selector, $name, $value, $readOnly, $category, $description, $visible);
285 284
     }
286 285
 
287
-    public function removeProperty (int $selector, string $name)
286
+    public function removeProperty(int $selector, string $name)
288 287
     {
289
-        $this->callMethod ('RemoveProperty', $selector, $name);
288
+        $this->callMethod('RemoveProperty', $selector, $name);
290 289
     }
291 290
 }
Please login to merge, or discard this patch.
Braces   +19 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
         $this->form = $form === null ? new Form :
26 26
             EngineAdditions::coupleSelector ($form);
27 27
 
28
-        if (!is_object ($this->form))
29
-            throw new \Exception ('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
28
+        if (!is_object ($this->form)) {
29
+                    throw new \Exception ('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
30
+        }
30 31
 
31 32
         $this->propertyGrid        = $propertyGrid;
32 33
         $this->eventsList          = $eventsList;
@@ -199,17 +200,17 @@  discard block
 block discarded – undo
199 200
 
200 201
         foreach ($this->getSelectedComponents ()->list as $object)
201 202
         {
202
-            if ($object->getType ()->toString () != 'System.Windows.Forms.Form')
203
-                $toUnset[] = $this->getComponentName ($object->selector);
204
-
205
-            else
203
+            if ($object->getType ()->toString () != 'System.Windows.Forms.Form') {
204
+                            $toUnset[] = $this->getComponentName ($object->selector);
205
+            } else
206 206
             {
207 207
                 if ($this->formsList->items->count > 1)
208 208
                 {
209 209
                     if (messageBox ('Вы действительно хотите удалить форму "'. $this->form->name .'"?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
210 210
                     {
211
-                        foreach ($this->objects as $name => $obj)
212
-                            unset ($this->objects[$name]);
211
+                        foreach ($this->objects as $name => $obj) {
212
+                                                    unset ($this->objects[$name]);
213
+                        }
213 214
 
214 215
                         unset ($this->formsList->items[array_flip ($this->formsList->items->names)[$form = $this->getComponentName ($object->selector)]]);
215 216
 
@@ -226,9 +227,7 @@  discard block
 block discarded – undo
226 227
 
227 228
                         return;
228 229
                     }
229
-                }
230
-
231
-                else
230
+                } else
232 231
                 {
233 232
                     messageBox ('Нельзя удалить единственную форму проекта', 'Ошибка удаления', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
234 233
 
@@ -237,14 +236,16 @@  discard block
 block discarded – undo
237 236
             }
238 237
         }
239 238
 
240
-        foreach ($toUnset as $name)
241
-            unset ($this->objects[$name]);
239
+        foreach ($toUnset as $name) {
240
+                    unset ($this->objects[$name]);
241
+        }
242 242
 
243 243
         $this->callMethod ('DeleteSelected');
244 244
 
245
-        foreach ($this->objects as $objectName => $object)
246
-            if (!is_int ($this->getComponentByName ($objectName)))
245
+        foreach ($this->objects as $objectName => $object) {
246
+                    if (!is_int ($this->getComponentByName ($objectName)))
247 247
                 unset ($this->objects[$objectName]);
248
+        }
248 249
 
249 250
         $this->currentSelectedItem->items->clear ();
250 251
         $this->currentSelectedItem->items->addRange (array_keys ($this->objects));
@@ -253,8 +254,9 @@  discard block
 block discarded – undo
253 254
 
254 255
     public function renameComponent (int $component, string $name, string $fromName = null): void
255 256
     {
256
-        if ($fromName === null)
257
-            $fromName = $this->getComponentName ($component);
257
+        if ($fromName === null) {
258
+                    $fromName = $this->getComponentName ($component);
259
+        }
258 260
 
259 261
         $info = $this->objects[$fromName];
260 262
         unset ($this->objects[$fromName]);
Please login to merge, or discard this patch.
engine/components/Process.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,28 +4,28 @@
 block discarded – undo
4 4
 
5 5
 class Process extends Component
6 6
 {
7
-	public $class 	  = 'System.Diagnostics.Process';
8
-	public $namespace = 'System';
7
+    public $class 	  = 'System.Diagnostics.Process';
8
+    public $namespace = 'System';
9 9
 
10
-	public function __construct (int $pid = null)
11
-	{
10
+    public function __construct (int $pid = null)
11
+    {
12 12
         $this->selector = VoidEngine::createClass ($this->class, $this->namespace);
13 13
 
14
-		if ($pid !== null)
14
+        if ($pid !== null)
15 15
             $this->selector = $pid == getmypid () ?
16 16
                 VoidEngine::callMethod ($this->selector, 'GetCurrentProcess') :
17 17
                 VoidEngine::callMethod ($this->selector, 'GetProcessById', $pid);
18 18
 
19
-		Components::addComponent ($this->selector, $this);
20
-	}
19
+        Components::addComponent ($this->selector, $this);
20
+    }
21 21
 	
22
-	public static function getProcessById (int $pid)
23
-	{
24
-		return new self ($pid);
25
-	}
22
+    public static function getProcessById (int $pid)
23
+    {
24
+        return new self ($pid);
25
+    }
26 26
 	
27
-	public static function getCurrentProcess ()
28
-	{
29
-		return new self (getmypid ());
30
-	}
27
+    public static function getCurrentProcess ()
28
+    {
29
+        return new self (getmypid ());
30
+    }
31 31
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,28 +4,27 @@
 block discarded – undo
4 4
 
5 5
 class Process extends Component
6 6
 {
7
-	public $class 	  = 'System.Diagnostics.Process';
7
+	public $class = 'System.Diagnostics.Process';
8 8
 	public $namespace = 'System';
9 9
 
10
-	public function __construct (int $pid = null)
10
+	public function __construct(int $pid = null)
11 11
 	{
12
-        $this->selector = VoidEngine::createClass ($this->class, $this->namespace);
12
+        $this->selector = VoidEngine::createClass($this->class, $this->namespace);
13 13
 
14 14
 		if ($pid !== null)
15
-            $this->selector = $pid == getmypid () ?
16
-                VoidEngine::callMethod ($this->selector, 'GetCurrentProcess') :
17
-                VoidEngine::callMethod ($this->selector, 'GetProcessById', $pid);
15
+            $this->selector = $pid == getmypid() ?
16
+                VoidEngine::callMethod($this->selector, 'GetCurrentProcess') : VoidEngine::callMethod($this->selector, 'GetProcessById', $pid);
18 17
 
19
-		Components::addComponent ($this->selector, $this);
18
+		Components::addComponent($this->selector, $this);
20 19
 	}
21 20
 	
22
-	public static function getProcessById (int $pid)
21
+	public static function getProcessById(int $pid)
23 22
 	{
24
-		return new self ($pid);
23
+		return new self($pid);
25 24
 	}
26 25
 	
27
-	public static function getCurrentProcess ()
26
+	public static function getCurrentProcess()
28 27
 	{
29
-		return new self (getmypid ());
28
+		return new self(getmypid());
30 29
 	}
31 30
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,11 @@
 block discarded – undo
11 11
 	{
12 12
         $this->selector = VoidEngine::createClass ($this->class, $this->namespace);
13 13
 
14
-		if ($pid !== null)
15
-            $this->selector = $pid == getmypid () ?
14
+		if ($pid !== null) {
15
+		            $this->selector = $pid == getmypid () ?
16 16
                 VoidEngine::callMethod ($this->selector, 'GetCurrentProcess') :
17 17
                 VoidEngine::callMethod ($this->selector, 'GetProcessById', $pid);
18
+		}
18 19
 
19 20
 		Components::addComponent ($this->selector, $this);
20 21
 	}
Please login to merge, or discard this patch.