Passed
Push — master ( 70a5dd...72f7b3 )
by Observer
01:54
created
bin/qero-packages/autoload.php 3 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,10 @@
 block discarded – undo
17 17
 
18 18
 spl_autoload_register (function ($class) use ($classes)
19 19
 {
20
-    if (isset ($classes[$class]))
21
-        include __DIR__ .'/'. $classes[$class];
22
-});
20
+    if (isset ($classes[$class])) {
21
+            include __DIR__ .'/'. $classes[$class];
22
+    }
23
+    });
23 24
 
24 25
 $required_packages = array
25 26
 (
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
 $required_packages = array
25 25
 (
26
-	array ('github:winforms-php/VoidFramework', '3.5.4'),
27
-	array ('github:KRypt0nn/ConsoleArgs', '1.5'),
28
-	array ('github:winforms-php/VoidBuilder', '1.2')
26
+    array ('github:winforms-php/VoidFramework', '3.5.4'),
27
+    array ('github:KRypt0nn/ConsoleArgs', '1.5'),
28
+    array ('github:winforms-php/VoidBuilder', '1.2')
29 29
 );
Please login to merge, or discard this patch.
Spacing   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,20 +10,18 @@
 block discarded – undo
10 10
 require 'winforms-php/VoidBuilder/VoidBuilder.php';
11 11
 
12 12
 
13
-$classes = array
14
-(
13
+$classes = array(
15 14
     
16 15
 );
17 16
 
18
-spl_autoload_register (function ($class) use ($classes)
17
+spl_autoload_register(function($class) use ($classes)
19 18
 {
20 19
     if (isset ($classes[$class]))
21
-        include __DIR__ .'/'. $classes[$class];
20
+        include __DIR__.'/'.$classes[$class];
22 21
 });
23 22
 
24
-$required_packages = array
25
-(
26
-	array ('github:winforms-php/VoidFramework', '3.5.4'),
27
-	array ('github:KRypt0nn/ConsoleArgs', '1.5'),
28
-	array ('github:winforms-php/VoidBuilder', '1.2')
23
+$required_packages = array(
24
+	array('github:winforms-php/VoidFramework', '3.5.4'),
25
+	array('github:KRypt0nn/ConsoleArgs', '1.5'),
26
+	array('github:winforms-php/VoidBuilder', '1.2')
29 27
 );
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/common/Globals.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2,50 +2,50 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace VoidEngine;
4 4
 
5
-register_superglobals ('APPLICATION', 'SCREEN');
5
+register_superglobals('APPLICATION', 'SCREEN');
6 6
 
7 7
 $APPLICATION = new class
8 8
 {
9 9
     public WFClass $application;
10 10
     public string $executablePath;
11 11
     
12
-    public function __construct ()
12
+    public function __construct()
13 13
     {
14
-        $this->application    = new WFClass ('System.Windows.Forms.Application');
14
+        $this->application    = new WFClass('System.Windows.Forms.Application');
15 15
         $this->executablePath = $this->application->executablePath;
16 16
     }
17 17
     
18
-    public function run ($form = null): void
18
+    public function run($form = null): void
19 19
     {
20 20
         if ($form instanceof WFObject)
21
-            $this->application->run ($form->selector);
21
+            $this->application->run($form->selector);
22 22
         
23
-        elseif (is_int ($form) && VoidEngine::objectExists ($form))
24
-            $this->application->run ($form);
23
+        elseif (is_int($form) && VoidEngine::objectExists($form))
24
+            $this->application->run($form);
25 25
         
26 26
         elseif ($form === null)
27
-            $this->application->run ();
27
+            $this->application->run();
28 28
 
29
-        else throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector');
29
+        else throw new \Exception('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector');
30 30
     }
31 31
     
32
-    public function restart (): void
32
+    public function restart(): void
33 33
     {
34
-        $this->application->restart ();
35
-        $this->close ();
34
+        $this->application->restart();
35
+        $this->close();
36 36
     }
37 37
     
38
-    public function close (): void
38
+    public function close(): void
39 39
     {
40
-        $this->application->exit ();
40
+        $this->application->exit();
41 41
     }
42 42
 
43
-    public function __call (string $name, array $args)
43
+    public function __call(string $name, array $args)
44 44
     {
45
-        return $this->application->$name (...$args);
45
+        return $this->application->$name(...$args);
46 46
     }
47 47
 
48
-    public function __get (string $name)
48
+    public function __get(string $name)
49 49
     {
50 50
         return $this->application->$name;
51 51
     }
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 {
56 56
     public WFObject $screen;
57 57
     
58
-    public function __construct ()
58
+    public function __construct()
59 59
     {
60
-        $this->screen = new WFClass ('System.Windows.Forms.Screen');
60
+        $this->screen = new WFClass('System.Windows.Forms.Screen');
61 61
     }
62 62
     
63
-    public function __get ($name)
63
+    public function __get($name)
64 64
     {
65
-        switch (strtolower ($name))
65
+        switch (strtolower($name))
66 66
         {
67 67
             case 'width':
68 68
             case 'w':
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         }
81 81
     }
82 82
     
83
-    public function __debugInfo (): array
83
+    public function __debugInfo(): array
84 84
     {
85 85
         return [
86 86
             $this->w,
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/common/Others.php 2 patches
Spacing   +122 added lines, -123 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['__debug']['error_status'];
8 8
 
@@ -12,203 +12,203 @@  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
187 187
 {
188 188
     static array $components = [];
189 189
 
190
-    public static function addComponent (int $selector, object $object): void
190
+    public static function addComponent(int $selector, object $object): void
191 191
     {
192 192
         self::$components[$selector] = $object;
193 193
     }
194 194
 
195
-    public static function getComponent (int $selector)
195
+    public static function getComponent(int $selector)
196 196
     {
197 197
         return isset (self::$components[$selector]) ?
198 198
             self::$components[$selector] : false;
199 199
     }
200 200
 
201
-    public static function componentExists (int $selector): bool
201
+    public static function componentExists(int $selector): bool
202 202
     {
203 203
         return isset (self::$components[$selector]);
204 204
     }
205 205
 
206
-    public static function removeComponent (int $selector): void
206
+    public static function removeComponent(int $selector): void
207 207
     {
208 208
         unset (self::$components[$selector]);
209 209
     }
210 210
 
211
-    public static function cleanJunk (): void
211
+    public static function cleanJunk(): void
212 212
     {
213 213
         // TODO: более строгие правила очистки мусорных объектов
214 214
         
@@ -216,46 +216,46 @@  discard block
 block discarded – undo
216 216
         {
217 217
             try
218 218
             {
219
-                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))
219
+                if ($object->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')))
220 220
                     continue;
221 221
             }
222 222
 
223 223
             catch (\Exception $e) {}
224 224
             
225
-            VoidEngine::destructObject ($selector);
225
+            VoidEngine::destructObject($selector);
226 226
 
227
-            if (!VoidEngine::objectExists ($selector))
227
+            if (!VoidEngine::objectExists($selector))
228 228
                 unset (self::$components[$selector]);
229 229
         }
230 230
     }
231 231
 }
232 232
 
233
-function _c (int $selector)
233
+function _c(int $selector)
234 234
 {
235
-    return Components::getComponent ($selector);
235
+    return Components::getComponent($selector);
236 236
 }
237 237
 
238
-function c ($name, bool $returnAllSimilarObjects = false)
238
+function c($name, bool $returnAllSimilarObjects = false)
239 239
 {
240
-    if (is_int ($name) && is_object ($object = _c ($name)))
240
+    if (is_int($name) && is_object($object = _c($name)))
241 241
         return $object;
242 242
 
243 243
     else
244 244
     {
245
-        $path    = explode ('->', $name);
245
+        $path    = explode('->', $name);
246 246
         $similar = [];
247 247
 
248 248
         foreach (Components::$components as $object)
249 249
             try
250 250
             {
251
-                if ($object->name == end ($path))
251
+                if ($object->name == end($path))
252 252
                 {
253
-                    if (sizeof ($path) > 1)
253
+                    if (sizeof($path) > 1)
254 254
                         try
255 255
                         {
256
-                            if (is_object ($parent = _c($object->parent->selector)))
256
+                            if (is_object($parent = _c($object->parent->selector)))
257 257
                             {
258
-                                if (c(join ('->', array_slice ($path, 0, -1))) == $parent)
258
+                                if (c(join('->', array_slice($path, 0, -1))) == $parent)
259 259
                                 {
260 260
                                     if ($returnAllSimilarObjects)
261 261
                                         $similar[] = $object;
@@ -289,18 +289,18 @@  discard block
 block discarded – undo
289 289
                 continue;
290 290
             }
291 291
 
292
-        if (sizeof ($path) == 2)
292
+        if (sizeof($path) == 2)
293 293
         {
294 294
             $objects = c($path[1], true);
295 295
 
296
-            if (is_array ($objects))
296
+            if (is_array($objects))
297 297
             {
298 298
                 foreach ($objects as $id => $object)
299 299
                     try
300 300
                     {
301
-                        while (is_object ($parent = _c($object->parent->selector)))
301
+                        while (is_object($parent = _c($object->parent->selector)))
302 302
                         {
303
-                            if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
303
+                            if ($parent->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
304 304
                                 return $objects[$id];
305 305
 
306 306
                             else $object = $parent;
@@ -318,70 +318,70 @@  discard block
 block discarded – undo
318 318
             else return false;
319 319
         }
320 320
 
321
-        else return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
321
+        else return $returnAllSimilarObjects && sizeof($similar) > 0 ?
322 322
             $similar : false;
323 323
     }
324 324
 }
325 325
 
326
-function setTimer (int $interval, callable $function): Timer
326
+function setTimer(int $interval, callable $function): Timer
327 327
 {
328 328
     $timer = new Timer;
329 329
     $timer->interval = $interval;
330 330
     
331
-    $timer->tickEvent = function ($self) use ($function)
331
+    $timer->tickEvent = function($self) use ($function)
332 332
     {
333
-        call_user_func ($function, $self);
333
+        call_user_func($function, $self);
334 334
     };
335 335
     
336
-	$timer->start ();
336
+	$timer->start();
337 337
     
338 338
     return $timer;
339 339
 }
340 340
 
341 341
 // FIXME: выполняется несколько раз, а не единожды
342
-function setTimeout (int $timeout, callable $function): Timer
342
+function setTimeout(int $timeout, callable $function): Timer
343 343
 {
344 344
     $timer = new Timer;
345 345
     $timer->interval = $timeout;
346 346
     
347
-    $timer->tickEvent = function ($self) use ($function)
347
+    $timer->tickEvent = function($self) use ($function)
348 348
     {
349
-        call_user_func ($function, $self);
349
+        call_user_func($function, $self);
350 350
 
351
-        $self->stop ();
351
+        $self->stop();
352 352
     };
353 353
     
354
-    $timer->start ();
354
+    $timer->start();
355 355
     
356 356
 	return $timer;
357 357
 }
358 358
 
359 359
 class Clipboard
360 360
 {
361
-    public static function getText ()
361
+    public static function getText()
362 362
     {
363
-        return (new WFClass ('System.Windows.Forms.Clipboard'))->getText ();
363
+        return (new WFClass('System.Windows.Forms.Clipboard'))->getText();
364 364
     }
365 365
     
366
-    public static function setText (string $text): void
366
+    public static function setText(string $text): void
367 367
     {
368
-        (new WFClass ('System.Windows.Forms.Clipboard'))->setText ($text);
368
+        (new WFClass('System.Windows.Forms.Clipboard'))->setText($text);
369 369
     }
370 370
     
371
-    public static function getFiles (): array
371
+    public static function getFiles(): array
372 372
     {
373
-        return (new WFClass ('System.Windows.Forms.Clipboard'))->getFileDropList ()->list;
373
+        return (new WFClass('System.Windows.Forms.Clipboard'))->getFileDropList()->list;
374 374
     }
375 375
     
376
-    public static function setFiles (array $files): void
376
+    public static function setFiles(array $files): void
377 377
     {
378
-        $collection = new WFObject ('System.Collections.Specialized.StringCollection');
378
+        $collection = new WFObject('System.Collections.Specialized.StringCollection');
379 379
 
380 380
         foreach ($files as $file)
381
-            $collection->add ((string) $file);
381
+            $collection->add((string) $file);
382 382
 
383
-        (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection);
384
-        VoidEngine::removeObjects ($collection->selector);
383
+        (new WFClass('System.Windows.Forms.Clipboard'))->setFileDropList($collection);
384
+        VoidEngine::removeObjects($collection->selector);
385 385
     }
386 386
 }
387 387
 
@@ -389,14 +389,13 @@  discard block
 block discarded – undo
389 389
 {
390 390
     protected $cursor;
391 391
 
392
-    public function __construct (int $handle = null)
392
+    public function __construct(int $handle = null)
393 393
     {
394 394
         $handle !== null ?
395
-            $this->cursor = new WFObject ('System.Windows.Forms.Cursor', 'auto', $handle) :
396
-            $this->cursor = new WFClass ('System.Windows.Forms.Cursor');
395
+            $this->cursor = new WFObject('System.Windows.Forms.Cursor', 'auto', $handle) : $this->cursor = new WFClass('System.Windows.Forms.Cursor');
397 396
     }
398 397
 
399
-    public function getPosition (): array
398
+    public function getPosition(): array
400 399
     {
401 400
         $pos = $this->cursor->position;
402 401
 
@@ -407,22 +406,22 @@  discard block
 block discarded – undo
407 406
     }
408 407
 }
409 408
 
410
-function get_cursor_x (int $handle = null): int
409
+function get_cursor_x(int $handle = null): int
411 410
 {
412
-    return (new Cursor ($handle))->getPosition ()[0];
411
+    return (new Cursor($handle))->getPosition()[0];
413 412
 }
414 413
 
415
-function get_cursor_y (int $handle = null): int
414
+function get_cursor_y(int $handle = null): int
416 415
 {
417
-    return (new Cursor ($handle))->getPosition ()[1];
416
+    return (new Cursor($handle))->getPosition()[1];
418 417
 }
419 418
 
420
-function get_cursor_pos (int $handle = null): array
419
+function get_cursor_pos(int $handle = null): array
421 420
 {
422
-    return (new Cursor ($handle))->getPosition ();
421
+    return (new Cursor($handle))->getPosition();
423 422
 }
424 423
 
425
-set_error_handler (function ($no, $str, $file, $line)
424
+set_error_handler(function($no, $str, $file, $line)
426 425
 {
427 426
     // Мог ли я здесь сделать более адекватный код с использованием pow/sqrt? Да, мог
428 427
     // Почему не сделал? Скорость важнее
@@ -445,7 +444,7 @@  discard block
 block discarded – undo
445 444
     ];
446 445
 
447 446
     if ($GLOBALS['__debug']['error_status'])
448
-        message ([
447
+        message([
449 448
             'type'      => $errarr[$no],
450 449
             'text'      => $str,
451 450
             'file'      => $file,
Please login to merge, or discard this patch.
Braces   +81 added lines, -72 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
 {
7 7
     $oldStatus = $GLOBALS['__debug']['error_status'];
8 8
 
9
-    if ($status !== null)
10
-        $GLOBALS['__debug']['error_status'] = $status;
9
+    if ($status !== null) {
10
+            $GLOBALS['__debug']['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
 }
@@ -216,16 +225,16 @@  discard block
 block discarded – undo
216 225
         {
217 226
             try
218 227
             {
219
-                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))
220
-                    continue;
221
-            }
222
-
223
-            catch (\Exception $e) {}
228
+                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms'))) {
229
+                                    continue;
230
+                }
231
+            } catch (\Exception $e) {}
224 232
             
225 233
             VoidEngine::destructObject ($selector);
226 234
 
227
-            if (!VoidEngine::objectExists ($selector))
228
-                unset (self::$components[$selector]);
235
+            if (!VoidEngine::objectExists ($selector)) {
236
+                            unset (self::$components[$selector]);
237
+            }
229 238
         }
230 239
     }
231 240
 }
@@ -237,16 +246,15 @@  discard block
 block discarded – undo
237 246
 
238 247
 function c ($name, bool $returnAllSimilarObjects = false)
239 248
 {
240
-    if (is_int ($name) && is_object ($object = _c ($name)))
241
-        return $object;
242
-
243
-    else
249
+    if (is_int ($name) && is_object ($object = _c ($name))) {
250
+            return $object;
251
+    } else
244 252
     {
245 253
         $path    = explode ('->', $name);
246 254
         $similar = [];
247 255
 
248
-        foreach (Components::$components as $object)
249
-            try
256
+        foreach (Components::$components as $object) {
257
+                    try
250 258
             {
251 259
                 if ($object->name == end ($path))
252 260
                 {
@@ -259,32 +267,30 @@  discard block
 block discarded – undo
259 267
                                 {
260 268
                                     if ($returnAllSimilarObjects)
261 269
                                         $similar[] = $object;
270
+        }
262 271
 
263
-                                    else return $object;
272
+                                    else {
273
+                                        return $object;
274
+                                    }
275
+                                } else {
276
+                                    continue;
264 277
                                 }
265
-
266
-                                else continue;
278
+                            } else {
279
+                                continue;
267 280
                             }
268
-
269
-                            else continue;
270
-                        }
271
-
272
-                        catch (\Throwable $e)
281
+                        } catch (\Throwable $e)
273 282
                         {
274 283
                             continue;
275
-                        }
276
-
277
-                    else
284
+                        } else
278 285
                     {
279
-                        if ($returnAllSimilarObjects)
280
-                            $similar[] = $object;
281
-
282
-                        else return $object;
286
+                        if ($returnAllSimilarObjects) {
287
+                                                    $similar[] = $object;
288
+                        } else {
289
+                            return $object;
290
+                        }
283 291
                     }
284 292
                 }
285
-            }
286
-
287
-            catch (\Exception $e)
293
+            } catch (\Exception $e)
288 294
             {
289 295
                 continue;
290 296
             }
@@ -295,31 +301,32 @@  discard block
 block discarded – undo
295 301
 
296 302
             if (is_array ($objects))
297 303
             {
298
-                foreach ($objects as $id => $object)
299
-                    try
304
+                foreach ($objects as $id => $object) {
305
+                                    try
300 306
                     {
301 307
                         while (is_object ($parent = _c($object->parent->selector)))
302 308
                         {
303 309
                             if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
304 310
                                 return $objects[$id];
311
+                }
305 312
 
306
-                            else $object = $parent;
313
+                            else {
314
+                                $object = $parent;
315
+                            }
307 316
                         }
308
-                    }
309
-
310
-                    catch (\Throwable $e)
317
+                    } catch (\Throwable $e)
311 318
 					{
312 319
 						continue;
313 320
 					}
314 321
 
315 322
                 return false;
323
+            } else {
324
+                return false;
316 325
             }
317
-
318
-            else return false;
319
-        }
320
-
321
-        else return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
326
+        } else {
327
+            return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
322 328
             $similar : false;
329
+        }
323 330
     }
324 331
 }
325 332
 
@@ -377,8 +384,9 @@  discard block
 block discarded – undo
377 384
     {
378 385
         $collection = new WFObject ('System.Collections.Specialized.StringCollection');
379 386
 
380
-        foreach ($files as $file)
381
-            $collection->add ((string) $file);
387
+        foreach ($files as $file) {
388
+                    $collection->add ((string) $file);
389
+        }
382 390
 
383 391
         (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection);
384 392
         VoidEngine::removeObjects ($collection->selector);
@@ -444,11 +452,12 @@  discard block
 block discarded – undo
444 452
         16384 => 'E_USER_DEPRECATED'
445 453
     ];
446 454
 
447
-    if ($GLOBALS['__debug']['error_status'])
448
-        message ([
455
+    if ($GLOBALS['__debug']['error_status']) {
456
+            message ([
449 457
             'type'      => $errarr[$no],
450 458
             'text'      => $str,
451 459
             'file'      => $file,
452 460
             'line'      => $line
453 461
         ], 'PHP Script Error');
454
-});
462
+    }
463
+    });
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/VoidEngine.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 const ENGINE_VERSION = '3.5.4 build-2019/09/15';
37 37
 const ENGINE_DIR = __DIR__;
38 38
 
39
-chdir (ENGINE_DIR);
39
+chdir(ENGINE_DIR);
40 40
 
41 41
 $GLOBALS['__debug'] = [
42
-    'start_time'   => microtime (true),
42
+    'start_time'   => microtime(true),
43 43
     'error_status' => true
44 44
 ];
45 45
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 require 'common/Others.php';
50 50
 require 'common/Events.php';
51 51
 
52
-define ('VoidEngine\CORE_VERSION', $APPLICATION->productVersion);
52
+define('VoidEngine\CORE_VERSION', $APPLICATION->productVersion);
53 53
 
54 54
 require 'components/Component.php';
55 55
 require 'components/Control.php';
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 require 'components/FastColoredTextBox.php';
98 98
 require 'components/Scintilla.php';
99 99
 
100
-if (is_dir ('extensions'))
101
-    foreach (scandir ('extensions') as $ext)
102
-        if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php'))
100
+if (is_dir('extensions'))
101
+    foreach (scandir('extensions') as $ext)
102
+        if (is_dir('extensions/'.$ext) && file_exists($ext = 'extensions/'.$ext.'/main.php'))
103 103
             require $ext;
Please login to merge, or discard this patch.
bin/app/system/debug/DebugHook.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,29 +10,29 @@  discard block
 block discarded – undo
10 10
 
11 11
 $debugger = new class
12 12
 {
13
-    static function debugOutput ($data): void
13
+    static function debugOutput($data): void
14 14
     {
15
-        file_put_contents ('__debug_answer', serialize ([
16
-            'timestamp' => time (),
15
+        file_put_contents('__debug_answer', serialize([
16
+            'timestamp' => time(),
17 17
             'data'      => $data
18 18
         ]));
19 19
 
20
-        while (file_exists ('__debug_answer'))
21
-            usleep (100);
20
+        while (file_exists('__debug_answer'))
21
+            usleep(100);
22 22
     }
23 23
 
24
-    static function seekObjects (WFObject $object): array
24
+    static function seekObjects(WFObject $object): array
25 25
     {
26 26
         $objects = [$object->selector];
27 27
 
28 28
         try
29 29
         {
30
-            $object->controls->foreach (function ($value) use (&$objects)
30
+            $object->controls->foreach(function($value) use (&$objects)
31 31
             {
32
-                $objects = array_merge ($objects, self::seekObjects ($value));
32
+                $objects = array_merge($objects, self::seekObjects($value));
33 33
             });
34 34
 
35
-            return array_unique ($objects);
35
+            return array_unique($objects);
36 36
         }
37 37
 
38 38
         catch (\Throwable $e)
@@ -42,33 +42,33 @@  discard block
 block discarded – undo
42 42
     }
43 43
 };
44 44
 
45
-set_error_handler (function (...$args) use ($debugger)
45
+set_error_handler(function(...$args) use ($debugger)
46 46
 {
47
-    $debugger::debugOutput ([
47
+    $debugger::debugOutput([
48 48
         'type' => 'errorCatched',
49 49
         'info' => $args
50 50
     ]);
51 51
 });
52 52
 
53
-set_exception_handler (function (...$args) use ($debugger)
53
+set_exception_handler(function(...$args) use ($debugger)
54 54
 {
55
-    $debugger::debugOutput ([
55
+    $debugger::debugOutput([
56 56
         'type' => 'exceptionCatched',
57 57
         'info' => $args
58 58
     ]);
59 59
 });
60 60
 
61
-setTimer (500, function () use ($debugger)
61
+setTimer(500, function() use ($debugger)
62 62
 {
63 63
     $debug = &$GLOBALS['__DEBUG'];
64 64
 
65 65
     if (!isset ($debug['last_timestamp']))
66 66
         $debug['last_timestamp'] = 0;
67 67
 
68
-    elseif (file_exists ('__debug_request'))
68
+    elseif (file_exists('__debug_request'))
69 69
     {
70
-        $request = unserialize (file_get_contents ('__debug_request'));
71
-        unlink ('__debug_request');
70
+        $request = unserialize(file_get_contents('__debug_request'));
71
+        unlink('__debug_request');
72 72
 
73 73
         if ($request['timestamp'] > $debug['last_timestamp'])
74 74
         {
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
                     $referenced = [];
81 81
 
82 82
                     foreach (Components::$components as $selector => $component)
83
-                        $referenced = array_merge ($referenced, array_diff ($debugger::seekObjects ($component), $component->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) ? 
83
+                        $referenced = array_merge($referenced, array_diff($debugger::seekObjects($component), $component->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')) ? 
84 84
                             [] : [$selector]));
85 85
 
86 86
                     // array_slice потому, что первым компонентом в списке всегда будет таймер debug hooker'а
87
-                    $debugger::debugOutput (array_slice (array_map (function ($object) use ($referenced)
87
+                    $debugger::debugOutput(array_slice(array_map(function($object) use ($referenced)
88 88
                     {
89
-                        return array_merge ($object->__debugInfo (), [
90
-                            'status' => array_search ($object->selector, $referenced) !== false ? 1 : (
91
-                                $object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Control', 'System.Windows.Forms')) ? 0 : 2
89
+                        return array_merge($object->__debugInfo(), [
90
+                            'status' => array_search($object->selector, $referenced) !== false ? 1 : (
91
+                                $object->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Control', 'System.Windows.Forms')) ? 0 : 2
92 92
                             ),
93 93
 
94 94
                             'name' => $object->name
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
                         try
102 102
                         {
103 103
                             if (!isset ($debug['colors'][$selector]))
104
-                                $debug['colors'][$selector] = VoidEngine::getProperty ($selector, ['BackColor', 'color']);
104
+                                $debug['colors'][$selector] = VoidEngine::getProperty($selector, ['BackColor', 'color']);
105 105
 
106
-                            VoidEngine::setProperty ($selector, 'BackColor', [clYellow, 'color']);
106
+                            VoidEngine::setProperty($selector, 'BackColor', [clYellow, 'color']);
107 107
                         }
108 108
 
109 109
                         catch (\Throwable $e)
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                     foreach ($request['arguments']['selectors'] as $selector)
117 117
                         try
118 118
                         {
119
-                            VoidEngine::setProperty ($selector, 'BackColor', [$debug['colors'][$selector], 'color']);
119
+                            VoidEngine::setProperty($selector, 'BackColor', [$debug['colors'][$selector], 'color']);
120 120
                         }
121 121
 
122 122
                         catch (\Throwable $e)
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                     foreach ($request['arguments']['selectors'] as $selector)
130 130
                         try
131 131
                         {
132
-                            VoidEngine::callMethod ($selector, 'Dispose');
132
+                            VoidEngine::callMethod($selector, 'Dispose');
133 133
                         }
134 134
                         
135 135
                         catch (\Throwable $e)
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                             continue;
138 138
                         }
139 139
 
140
-                    VoidEngine::removeObjects (...$request['arguments']['selectors']);
140
+                    VoidEngine::removeObjects(...$request['arguments']['selectors']);
141 141
                 break;
142 142
             }
143 143
         }
Please login to merge, or discard this patch.
Braces   +26 added lines, -30 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
             'data'      => $data
18 18
         ]));
19 19
 
20
-        while (file_exists ('__debug_answer'))
21
-            usleep (100);
20
+        while (file_exists ('__debug_answer')) {
21
+                    usleep (100);
22
+        }
22 23
     }
23 24
 
24 25
     static function seekObjects (WFObject $object): array
@@ -33,9 +34,7 @@  discard block
 block discarded – undo
33 34
             });
34 35
 
35 36
             return array_unique ($objects);
36
-        }
37
-
38
-        catch (\Throwable $e)
37
+        } catch (\Throwable $e)
39 38
         {
40 39
             return $objects;
41 40
         }
@@ -62,10 +61,9 @@  discard block
 block discarded – undo
62 61
 {
63 62
     $debug = &$GLOBALS['__DEBUG'];
64 63
 
65
-    if (!isset ($debug['last_timestamp']))
66
-        $debug['last_timestamp'] = 0;
67
-
68
-    elseif (file_exists ('__debug_request'))
64
+    if (!isset ($debug['last_timestamp'])) {
65
+            $debug['last_timestamp'] = 0;
66
+    } elseif (file_exists ('__debug_request'))
69 67
     {
70 68
         $request = unserialize (file_get_contents ('__debug_request'));
71 69
         unlink ('__debug_request');
@@ -79,9 +77,10 @@  discard block
 block discarded – undo
79 77
                 case 'get_objects':
80 78
                     $referenced = [];
81 79
 
82
-                    foreach (Components::$components as $selector => $component)
83
-                        $referenced = array_merge ($referenced, array_diff ($debugger::seekObjects ($component), $component->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) ? 
84
-                            [] : [$selector]));
80
+                    foreach (Components::$components as $selector => $component) {
81
+                                            $referenced = array_merge ($referenced, array_diff ($debugger::seekObjects ($component), $component->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) ? 
82
+                            [] : [$selector]));
83
+                    }
85 84
 
86 85
                     // array_slice потому, что первым компонентом в списке всегда будет таймер debug hooker'а
87 86
                     $debugger::debugOutput (array_slice (array_map (function ($object) use ($referenced)
@@ -97,42 +96,39 @@  discard block
 block discarded – undo
97 96
                 break;
98 97
 
99 98
                 case 'bulb_objects':
100
-                    foreach ($request['arguments']['selectors'] as $selector)
101
-                        try
99
+                    foreach ($request['arguments']['selectors'] as $selector) {
100
+                                            try
102 101
                         {
103 102
                             if (!isset ($debug['colors'][$selector]))
104
-                                $debug['colors'][$selector] = VoidEngine::getProperty ($selector, ['BackColor', 'color']);
103
+                                $debug['colors'][$selector] = VoidEngine::getProperty ($selector, ['BackColor', 'color']);
104
+                    }
105 105
 
106 106
                             VoidEngine::setProperty ($selector, 'BackColor', [clYellow, 'color']);
107
-                        }
108
-
109
-                        catch (\Throwable $e)
107
+                        } catch (\Throwable $e)
110 108
                         {
111 109
                             continue;
112 110
                         }
113 111
                 break;
114 112
 
115 113
                 case 'unbulb_objects':
116
-                    foreach ($request['arguments']['selectors'] as $selector)
117
-                        try
114
+                    foreach ($request['arguments']['selectors'] as $selector) {
115
+                                            try
118 116
                         {
119
-                            VoidEngine::setProperty ($selector, 'BackColor', [$debug['colors'][$selector], 'color']);
120
-                        }
121
-
122
-                        catch (\Throwable $e)
117
+                            VoidEngine::setProperty ($selector, 'BackColor', [$debug['colors'][$selector], 'color']);
118
+                    }
119
+                        } catch (\Throwable $e)
123 120
                         {
124 121
                             continue;
125 122
                         }
126 123
                 break;
127 124
 
128 125
                 case 'remove_objects':
129
-                    foreach ($request['arguments']['selectors'] as $selector)
130
-                        try
126
+                    foreach ($request['arguments']['selectors'] as $selector) {
127
+                                            try
131 128
                         {
132
-                            VoidEngine::callMethod ($selector, 'Dispose');
133
-                        }
134
-                        
135
-                        catch (\Throwable $e)
129
+                            VoidEngine::callMethod ($selector, 'Dispose');
130
+                    }
131
+                        } catch (\Throwable $e)
136 132
                         {
137 133
                             continue;
138 134
                         }
Please login to merge, or discard this patch.
bin/app/php/ClassWorker.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 
5 5
 class ClassWorker
6 6
 {
7
-    public static function applyClass (string $code, string $class, string $apply): string
7
+    public static function applyClass(string $code, string $class, string $apply): string
8 8
     {
9
-        $code = self::stripComments ($code);
9
+        $code = self::stripComments($code);
10 10
 
11 11
         $split1 = $split2 = false;
12 12
 
13
-        $len      = strlen ($code);
14
-        $classLen = strlen ($class);
13
+        $len      = strlen($code);
14
+        $classLen = strlen($class);
15 15
 
16 16
         $class_predefined = false;
17 17
         $class_close = null;
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 
27 27
             elseif (!$split1 && !$split2)
28 28
             {
29
-                if ($code[$i] == 'c' && substr ($code, $i, 5) == 'class')
29
+                if ($code[$i] == 'c' && substr($code, $i, 5) == 'class')
30 30
                 {
31 31
                     for ($j = $i + 5; $j < $len; ++$j)
32
-                        if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
32
+                        if (in_array($code[$j], ["\n", "\r", "\t", ' ']))
33 33
                             continue;
34 34
 
35 35
                         else
36 36
                         {
37
-                            if (substr ($code, $j, $classLen) == $class)
37
+                            if (substr($code, $j, $classLen) == $class)
38 38
                                 $class_predefined = true;
39 39
 
40 40
                             $i = $j;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                         --$class_close;
58 58
 
59 59
                     if ($class_close === 0)
60
-                        return substr ($code, 0, $i) . $apply . substr ($code, $i);
60
+                        return substr($code, 0, $i).$apply.substr($code, $i);
61 61
                 }
62 62
             }
63 63
         }
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
         return $code;
66 66
     }
67 67
 
68
-    public static function getAvailableClassMethods (string $code, string $class): array
68
+    public static function getAvailableClassMethods(string $code, string $class): array
69 69
     {
70
-        $code = self::stripComments ($code);
70
+        $code = self::stripComments($code);
71 71
 
72 72
         $split1 = $split2 = false;
73 73
 
74
-        $len      = strlen ($code);
75
-        $classLen = strlen ($class);
74
+        $len      = strlen($code);
75
+        $classLen = strlen($class);
76 76
 
77 77
         $class_predefined = false;
78 78
         $class_close = null;
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
 
90 90
             elseif (!$split1 && !$split2)
91 91
             {
92
-                if ($code[$i] == 'c' && substr ($code, $i, 5) == 'class')
92
+                if ($code[$i] == 'c' && substr($code, $i, 5) == 'class')
93 93
                 {
94 94
                     for ($j = $i + 5; $j < $len; ++$j)
95
-                        if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
95
+                        if (in_array($code[$j], ["\n", "\r", "\t", ' ']))
96 96
                             continue;
97 97
 
98 98
                         else
99 99
                         {
100
-                            if (substr ($code, $j, $classLen) == $class)
100
+                            if (substr($code, $j, $classLen) == $class)
101 101
                                 $class_predefined = true;
102 102
 
103 103
                             $i = $j;
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 
109 109
                 elseif ($class_predefined == true)
110 110
                 {
111
-                    if ($code[$i] == 's' && substr ($code, $i, 6) == 'static')
111
+                    if ($code[$i] == 's' && substr($code, $i, 6) == 'static')
112 112
                     {
113 113
                         for ($j = $i + 6; $j < $len; ++$j)
114
-                            if (!in_array ($code[$j], ["\n", "\r", "\t", ' ']))
114
+                            if (!in_array($code[$j], ["\n", "\r", "\t", ' ']))
115 115
                                 break;
116 116
 
117
-                        if ($code[$j] == 'f' && substr ($code, $j, 8) == 'function')
117
+                        if ($code[$j] == 'f' && substr($code, $j, 8) == 'function')
118 118
                         {
119 119
                             for ($j = $j + 8; $j < $len; ++$j)
120
-                                if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
120
+                                if (in_array($code[$j], ["\n", "\r", "\t", ' ']))
121 121
                                     continue;
122 122
 
123 123
                                 else
124 124
                                 {
125 125
                                     $i = $j;
126
-                                    $methods[] = trim (substr ($code, $j, strpos ($code, '(', $j) - $j));
126
+                                    $methods[] = trim(substr($code, $j, strpos($code, '(', $j) - $j));
127 127
 
128 128
                                     break;
129 129
                                 }
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
         return $methods;
151 151
     }
152 152
 
153
-    public static function stripComments (string $code): string
153
+    public static function stripComments(string $code): string
154 154
     {
155
-        $tokens = token_get_all ("<?php\n\n". $code);
155
+        $tokens = token_get_all("<?php\n\n".$code);
156 156
         $return = '';
157 157
 
158 158
         foreach ($tokens as $token)
159
-            if (is_string ($token))
159
+            if (is_string($token))
160 160
                 $return .= $token;
161 161
 
162 162
             else
@@ -176,6 +176,6 @@  discard block
 block discarded – undo
176 176
                 }
177 177
             }
178 178
 
179
-        return substr ($return, 7);
179
+        return substr($return, 7);
180 180
     }
181 181
 }
Please login to merge, or discard this patch.
Braces   +63 added lines, -64 removed lines patch added patch discarded remove patch
@@ -18,46 +18,45 @@  discard block
 block discarded – undo
18 18
 
19 19
         for ($i = 0; $i < $len; ++$i)
20 20
         {
21
-            if ($code[$i] == '\'' && !$split2)
22
-                $split1 = !$split1;
23
-
24
-            elseif ($code[$i] == '"' && !$split1)
25
-                $split2 = !$split2;
26
-
27
-            elseif (!$split1 && !$split2)
21
+            if ($code[$i] == '\'' && !$split2) {
22
+                            $split1 = !$split1;
23
+            } elseif ($code[$i] == '"' && !$split1) {
24
+                            $split2 = !$split2;
25
+            } elseif (!$split1 && !$split2)
28 26
             {
29 27
                 if ($code[$i] == 'c' && substr ($code, $i, 5) == 'class')
30 28
                 {
31
-                    for ($j = $i + 5; $j < $len; ++$j)
32
-                        if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
33
-                            continue;
29
+                    for ($j = $i + 5; $j < $len; ++$j) {
30
+                                            if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
31
+                            continue;
32
+                    }
34 33
 
35 34
                         else
36 35
                         {
37
-                            if (substr ($code, $j, $classLen) == $class)
38
-                                $class_predefined = true;
36
+                            if (substr ($code, $j, $classLen) == $class) {
37
+                                                            $class_predefined = true;
38
+                            }
39 39
 
40 40
                             $i = $j;
41 41
 
42 42
                             break;
43 43
                         }
44
-                }
45
-
46
-                elseif ($class_predefined == true)
44
+                } elseif ($class_predefined == true)
47 45
                 {
48 46
                     if ($code[$i] == '{')
49 47
                     {
50
-                        if ($class_close === null)
51
-                            $class_close = 1;
52
-
53
-                        else ++$class_close;
54
-                    }
55
-
56
-                    elseif ($code[$i] == '}')
57
-                        --$class_close;
58
-
59
-                    if ($class_close === 0)
60
-                        return substr ($code, 0, $i) . $apply . substr ($code, $i);
48
+                        if ($class_close === null) {
49
+                                                    $class_close = 1;
50
+                        } else {
51
+                            ++$class_close;
52
+                        }
53
+                    } elseif ($code[$i] == '}') {
54
+                                            --$class_close;
55
+                    }
56
+
57
+                    if ($class_close === 0) {
58
+                                            return substr ($code, 0, $i) . $apply . substr ($code, $i);
59
+                    }
61 60
                 }
62 61
             }
63 62
         }
@@ -81,44 +80,44 @@  discard block
 block discarded – undo
81 80
 
82 81
         for ($i = 0; $i < $len; ++$i)
83 82
         {
84
-            if ($code[$i] == '\'' && !$split2)
85
-                $split1 = !$split1;
86
-
87
-            elseif ($code[$i] == '"' && !$split1)
88
-                $split2 = !$split2;
89
-
90
-            elseif (!$split1 && !$split2)
83
+            if ($code[$i] == '\'' && !$split2) {
84
+                            $split1 = !$split1;
85
+            } elseif ($code[$i] == '"' && !$split1) {
86
+                            $split2 = !$split2;
87
+            } elseif (!$split1 && !$split2)
91 88
             {
92 89
                 if ($code[$i] == 'c' && substr ($code, $i, 5) == 'class')
93 90
                 {
94
-                    for ($j = $i + 5; $j < $len; ++$j)
95
-                        if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
96
-                            continue;
91
+                    for ($j = $i + 5; $j < $len; ++$j) {
92
+                                            if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
93
+                            continue;
94
+                    }
97 95
 
98 96
                         else
99 97
                         {
100
-                            if (substr ($code, $j, $classLen) == $class)
101
-                                $class_predefined = true;
98
+                            if (substr ($code, $j, $classLen) == $class) {
99
+                                                            $class_predefined = true;
100
+                            }
102 101
 
103 102
                             $i = $j;
104 103
 
105 104
                             break;
106 105
                         }
107
-                }
108
-
109
-                elseif ($class_predefined == true)
106
+                } elseif ($class_predefined == true)
110 107
                 {
111 108
                     if ($code[$i] == 's' && substr ($code, $i, 6) == 'static')
112 109
                     {
113
-                        for ($j = $i + 6; $j < $len; ++$j)
114
-                            if (!in_array ($code[$j], ["\n", "\r", "\t", ' ']))
115
-                                break;
110
+                        for ($j = $i + 6; $j < $len; ++$j) {
111
+                                                    if (!in_array ($code[$j], ["\n", "\r", "\t", ' ']))
112
+                                break;
113
+                        }
116 114
 
117 115
                         if ($code[$j] == 'f' && substr ($code, $j, 8) == 'function')
118 116
                         {
119
-                            for ($j = $j + 8; $j < $len; ++$j)
120
-                                if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
121
-                                    continue;
117
+                            for ($j = $j + 8; $j < $len; ++$j) {
118
+                                                            if (in_array ($code[$j], ["\n", "\r", "\t", ' ']))
119
+                                    continue;
120
+                            }
122 121
 
123 122
                                 else
124 123
                                 {
@@ -128,21 +127,20 @@  discard block
 block discarded – undo
128 127
                                     break;
129 128
                                 }
130 129
                         }
131
-                    }
132
-                    
133
-                    elseif ($code[$i] == '{')
130
+                    } elseif ($code[$i] == '{')
134 131
                     {
135
-                        if ($class_close === null)
136
-                            $class_close = 1;
137
-
138
-                        else ++$class_close;
139
-                    }
140
-
141
-                    elseif ($code[$i] == '}')
142
-                        --$class_close;
143
-
144
-                    if ($class_close === 0)
145
-                        return $methods;
132
+                        if ($class_close === null) {
133
+                                                    $class_close = 1;
134
+                        } else {
135
+                            ++$class_close;
136
+                        }
137
+                    } elseif ($code[$i] == '}') {
138
+                                            --$class_close;
139
+                    }
140
+
141
+                    if ($class_close === 0) {
142
+                                            return $methods;
143
+                    }
146 144
                 }
147 145
             }
148 146
         }
@@ -155,9 +153,10 @@  discard block
 block discarded – undo
155 153
         $tokens = token_get_all ("<?php\n\n". $code);
156 154
         $return = '';
157 155
 
158
-        foreach ($tokens as $token)
159
-            if (is_string ($token))
160
-                $return .= $token;
156
+        foreach ($tokens as $token) {
157
+                    if (is_string ($token))
158
+                $return .= $token;
159
+        }
161 160
 
162 161
             else
163 162
             {
Please login to merge, or discard this patch.
bin/app/php/Designer.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -78,40 +78,40 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $this->componentAddedEvent = function ($self, $args)
80 80
         {
81
-			if (!isset ($GLOBALS['new_component']))
82
-			{
81
+            if (!isset ($GLOBALS['new_component']))
82
+            {
83 83
                 $name = $args->component->getType ()->toString ();
84 84
 
85 85
                 // pre (VoidEngine::getProperty ($args->component->selector, 'Name'));
86 86
                 
87
-				$GLOBALS['new_component'] = [$this->getComponentName ($args->component->selector), [$name, substr ($name, 0, strrpos ($name, '.'))]];
88
-			}
87
+                $GLOBALS['new_component'] = [$this->getComponentName ($args->component->selector), [$name, substr ($name, 0, strrpos ($name, '.'))]];
88
+            }
89 89
 			
90
-			$this->setComponentToHistory ($GLOBALS['new_component'][1], $GLOBALS['new_component'][0]);
91
-			$components = VoidStudioAPI::getObjects ('main')['PropertiesPanel__SelectedComponent'];
90
+            $this->setComponentToHistory ($GLOBALS['new_component'][1], $GLOBALS['new_component'][0]);
91
+            $components = VoidStudioAPI::getObjects ('main')['PropertiesPanel__SelectedComponent'];
92 92
 
93
-			$components->items->clear ();
94
-			$components->items->addRange (array_keys ($this->objects));
93
+            $components->items->clear ();
94
+            $components->items->addRange (array_keys ($this->objects));
95 95
 
96
-			$components->selectedItem = $GLOBALS['new_component'][0];
97
-			$this->setSelectedComponents ($args->component);
96
+            $components->selectedItem = $GLOBALS['new_component'][0];
97
+            $this->setSelectedComponents ($args->component);
98 98
 
99
-			unset ($GLOBALS['new_component']);
99
+            unset ($GLOBALS['new_component']);
100 100
         };
101 101
 		
102
-		$this->componentRemovedEvent = function ($self, $args)
103
-		{
104
-			$name = $this->getComponentName ($args->component->selector);
105
-			unset ($this->objects[$name]);
102
+        $this->componentRemovedEvent = function ($self, $args)
103
+        {
104
+            $name = $this->getComponentName ($args->component->selector);
105
+            unset ($this->objects[$name]);
106 106
 
107
-			foreach ($this->objects as $objectName => $object)
108
-				if (!is_int ($this->getComponentByName ($objectName)))
109
-					unset ($this->objects[$objectName]);
107
+            foreach ($this->objects as $objectName => $object)
108
+                if (!is_int ($this->getComponentByName ($objectName)))
109
+                    unset ($this->objects[$objectName]);
110 110
 
111
-			$this->currentSelectedItem->items->clear ();
112
-			$this->currentSelectedItem->items->addRange (array_keys ($this->objects));
113
-			$this->currentSelectedItem->selectedItem = $this->getComponentName ($this->getPrimarySelection ()->selector);
114
-		};
111
+            $this->currentSelectedItem->items->clear ();
112
+            $this->currentSelectedItem->items->addRange (array_keys ($this->objects));
113
+            $this->currentSelectedItem->selectedItem = $this->getComponentName ($this->getPrimarySelection ()->selector);
114
+        };
115 115
 
116 116
         // ! Отредактировал что-то здесь?
117 117
         // ! Не забудь отредактировать и в main.vlf
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
             // $desItem->shortcutKeys = 131148;
152 152
             $desItem->clickEvent = function () use ($object, $locker, $locked)
153 153
             {
154
-				$locker->setValue ($object, !$locked);
154
+                $locker->setValue ($object, !$locked);
155 155
 
156
-				$this->propertyGrid->refresh ();
156
+                $this->propertyGrid->refresh ();
157 157
             };
158 158
 
159 159
             $selectAllItem = new ToolStripMenuItem ('Выделить всё');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             $selectAllItem->shortcutKeys = 131137;
162 162
             $selectAllItem->clickEvent = function () use ($self)
163 163
             {
164
-				$self->doAction ('selectAll');
164
+                $self->doAction ('selectAll');
165 165
             };
166 166
 			
167 167
             $cutItem = new ToolStripMenuItem ('Вырезать');
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $cutItem->shortcutKeys = 131160;
170 170
             $cutItem->clickEvent = function () use ($self)
171 171
             {
172
-				$self->doAction ('cut');
172
+                $self->doAction ('cut');
173 173
             };
174 174
 			
175 175
             $copyItem = new ToolStripMenuItem ('Копировать');
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $copyItem->shortcutKeys = 131139;
178 178
             $copyItem->clickEvent = function () use ($self)
179 179
             {
180
-				$self->doAction ('copy');
180
+                $self->doAction ('copy');
181 181
             };
182 182
 			
183 183
             $pasteItem = new ToolStripMenuItem ('Вставить');
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             $pasteItem->shortcutKeys = 131158;
186 186
             $pasteItem->clickEvent = function () use ($self)
187 187
             {
188
-				$self->doAction('paste');
188
+                $self->doAction('paste');
189 189
             };
190 190
 			
191 191
             $undoItem = new ToolStripMenuItem ('Отменить');
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
             $undoItem->shortcutKeys = 131162;
194 194
             $undoItem->clickEvent = function () use ($self)
195 195
             {
196
-				$self->undoEngine->undo ();
196
+                $self->undoEngine->undo ();
197 197
             };
198 198
 			
199 199
             $redoItem = new ToolStripMenuItem ('Повторить');
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $redoItem->shortcutKeys = 131161;
202 202
             $redoItem->clickEvent = function () use ($self)
203 203
             {
204
-				$self->undoEngine->redo ();
204
+                $self->undoEngine->redo ();
205 205
             };
206 206
 
207 207
             $infoItem = new ToolStripMenuItem ('Отладочная информация');
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                 {
213 213
                     pre ($value instanceof Component ? $value : $value->toString () ."\nSelector: ". $value->selector);
214 214
 
215
-					if ((new WFObject(VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))->isAssignableFrom ($value->getType ()))
215
+                    if ((new WFObject(VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))->isAssignableFrom ($value->getType ()))
216 216
                         pre ($self->getSharpCode ($self->form->name));
217 217
                 });
218 218
             };
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $menu->items->addRange ([
222 222
                 $selectAllItem, $copyItem, $pasteItem, $cutItem, $delItem, '-',
223 223
                 $toFrontItem, $toBackItem, $desItem, '-',
224
-				$undoItem, $redoItem, '-',
224
+                $undoItem, $redoItem, '-',
225 225
                 $infoItem
226 226
             ]);
227 227
 
Please login to merge, or discard this patch.
Spacing   +134 added lines, -135 removed lines patch added patch discarded remove patch
@@ -12,20 +12,19 @@  discard block
 block discarded – undo
12 12
     protected $currentSelectedItem;
13 13
     protected $formsList;
14 14
 
15
-    public function __construct (Component $parent, string $formName = 'form', PropertyGrid $propertyGrid, ComboBox $currentSelectedItem, TabControl $formsList, $form = null)
15
+    public function __construct(Component $parent, string $formName = 'form', PropertyGrid $propertyGrid, ComboBox $currentSelectedItem, TabControl $formsList, $form = null)
16 16
     {
17
-        $this->form = $form === null ? new Form :
18
-            EngineAdditions::coupleSelector ($form);
17
+        $this->form = $form === null ? new Form : EngineAdditions::coupleSelector($form);
19 18
 
20
-        if (!is_object ($this->form))
21
-            throw new \Exception ('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
19
+        if (!is_object($this->form))
20
+            throw new \Exception('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
22 21
 
23 22
         $this->propertyGrid        = $propertyGrid;
24 23
         $this->currentSelectedItem = $currentSelectedItem;
25 24
         $this->formsList           = $formsList;
26 25
 
27
-        $this->selector = VoidEngine::createObject ('WinForms_PHP.FormDesigner5', null, $this->form->selector, $formName);
28
-        Components::addComponent ($this->selector, $this);
26
+        $this->selector = VoidEngine::createObject('WinForms_PHP.FormDesigner5', null, $this->form->selector, $formName);
27
+        Components::addComponent($this->selector, $this);
29 28
 
30 29
         $this->form->name = $formName;
31 30
 
@@ -35,281 +34,281 @@  discard block
 block discarded – undo
35 34
             $this->form->size = [400, 360];
36 35
         }
37 36
 
38
-        $this->control = $this->callMethod ('GetControl');
37
+        $this->control = $this->callMethod('GetControl');
39 38
         $this->objects[$formName] = ['System.Windows.Forms.Form', 'System.Windows.Forms'];
40 39
 
41
-        VoidEngine::setProperty ($this->control, 'Parent', $parent->selector);
40
+        VoidEngine::setProperty($this->control, 'Parent', $parent->selector);
42 41
 
43
-        $this->selectionChangedEvent = function ()
42
+        $this->selectionChangedEvent = function()
44 43
         {
45
-            $object = $this->getPrimarySelection ()->selector;
44
+            $object = $this->getPrimarySelection()->selector;
46 45
             
47 46
             $this->propertyGrid->selectedObject = $object;
48
-            $this->currentSelectedItem->selectedItem = $this->getComponentName ($object);
47
+            $this->currentSelectedItem->selectedItem = $this->getComponentName($object);
49 48
         };
50 49
 
51
-        $this->createUniqueMethodNameEvent = function ($self, $args)
50
+        $this->createUniqueMethodNameEvent = function($self, $args)
52 51
         {
53
-            return $this->getComponentName ($args->component->selector) . '_' . $args->eventDescriptor->Name;
52
+            return $this->getComponentName($args->component->selector).'_'.$args->eventDescriptor->Name;
54 53
         };
55 54
         
56
-        $this->getCompatibleMethodsEvent = function ()
55
+        $this->getCompatibleMethodsEvent = function()
57 56
         {
58 57
             $form = $this->formsList->selectedTab->text;
59 58
             
60
-            return getNetArray ('System.String', ClassWorker::getAvailableClassMethods (VoidStudioAPI::$events[$form] ?? '', $form))->selector;
59
+            return getNetArray('System.String', ClassWorker::getAvailableClassMethods(VoidStudioAPI::$events[$form] ?? '', $form))->selector;
61 60
         };
62 61
         
63
-        $this->showCodeEvent = function ($self, $args)
62
+        $this->showCodeEvent = function($self, $args)
64 63
         {
65
-            VoidStudioAPI::openEventEditor ($this->propertyGrid->selectedObject->selector, $args->methodName, $form = c('Designer__FormsList')->selectedTab->text, VoidStudioAPI::getObjects ('main')['Designer__'. $form .'Designer']);
64
+            VoidStudioAPI::openEventEditor($this->propertyGrid->selectedObject->selector, $args->methodName, $form = c('Designer__FormsList')->selectedTab->text, VoidStudioAPI::getObjects('main')['Designer__'.$form.'Designer']);
66 65
         };
67 66
 
68
-        $this->freeMethodEvent = function ($self, $args)
67
+        $this->freeMethodEvent = function($self, $args)
69 68
         {
70 69
             $object = $this->propertyGrid->selectedObject->selector;
71 70
 
72
-            Events::removeObjectEvent ($object, $method = $args->eventDescriptor->Name);
71
+            Events::removeObjectEvent($object, $method = $args->eventDescriptor->Name);
73 72
             unset (VoidStudioAPI::$events[$object][$method]);
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
-                $name = $args->component->getType ()->toString ();
82
+                $name = $args->component->getType()->toString();
84 83
 
85 84
                 // pre (VoidEngine::getProperty ($args->component->selector, 'Name'));
86 85
                 
87
-				$GLOBALS['new_component'] = [$this->getComponentName ($args->component->selector), [$name, substr ($name, 0, strrpos ($name, '.'))]];
86
+				$GLOBALS['new_component'] = [$this->getComponentName($args->component->selector), [$name, substr($name, 0, strrpos($name, '.'))]];
88 87
 			}
89 88
 			
90
-			$this->setComponentToHistory ($GLOBALS['new_component'][1], $GLOBALS['new_component'][0]);
91
-			$components = VoidStudioAPI::getObjects ('main')['PropertiesPanel__SelectedComponent'];
89
+			$this->setComponentToHistory($GLOBALS['new_component'][1], $GLOBALS['new_component'][0]);
90
+			$components = VoidStudioAPI::getObjects('main')['PropertiesPanel__SelectedComponent'];
92 91
 
93
-			$components->items->clear ();
94
-			$components->items->addRange (array_keys ($this->objects));
92
+			$components->items->clear();
93
+			$components->items->addRange(array_keys($this->objects));
95 94
 
96 95
 			$components->selectedItem = $GLOBALS['new_component'][0];
97
-			$this->setSelectedComponents ($args->component);
96
+			$this->setSelectedComponents($args->component);
98 97
 
99 98
 			unset ($GLOBALS['new_component']);
100 99
         };
101 100
 		
102
-		$this->componentRemovedEvent = function ($self, $args)
101
+		$this->componentRemovedEvent = function($self, $args)
103 102
 		{
104
-			$name = $this->getComponentName ($args->component->selector);
103
+			$name = $this->getComponentName($args->component->selector);
105 104
 			unset ($this->objects[$name]);
106 105
 
107 106
 			foreach ($this->objects as $objectName => $object)
108
-				if (!is_int ($this->getComponentByName ($objectName)))
107
+				if (!is_int($this->getComponentByName($objectName)))
109 108
 					unset ($this->objects[$objectName]);
110 109
 
111
-			$this->currentSelectedItem->items->clear ();
112
-			$this->currentSelectedItem->items->addRange (array_keys ($this->objects));
113
-			$this->currentSelectedItem->selectedItem = $this->getComponentName ($this->getPrimarySelection ()->selector);
110
+			$this->currentSelectedItem->items->clear();
111
+			$this->currentSelectedItem->items->addRange(array_keys($this->objects));
112
+			$this->currentSelectedItem->selectedItem = $this->getComponentName($this->getPrimarySelection()->selector);
114 113
 		};
115 114
 
116 115
         // ! Отредактировал что-то здесь?
117 116
         // ! Не забудь отредактировать и в main.vlf
118 117
 
119
-        $this->rightClickEvent = function ($self, $args)
118
+        $this->rightClickEvent = function($self, $args)
120 119
         {
121
-            $delItem = new ToolStripMenuItem ('Удалить');
122
-            $delItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Delete_16x.png');
120
+            $delItem = new ToolStripMenuItem('Удалить');
121
+            $delItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Delete_16x.png');
123 122
             $delItem->shortcutKeys = 46;
124
-            $delItem->clickEvent = function () use ($self)
123
+            $delItem->clickEvent = function() use ($self)
125 124
             {
126
-                $this->removeSelected ();
125
+                $this->removeSelected();
127 126
             };
128 127
 
129
-            $toFrontItem = new ToolStripMenuItem ('На передний план');
130
-            $toFrontItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Front_16x.png');
128
+            $toFrontItem = new ToolStripMenuItem('На передний план');
129
+            $toFrontItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Front_16x.png');
131 130
             // $toFrontItem->shortcutKeys = 131142;
132
-            $toFrontItem->clickEvent = function () use ($self)
131
+            $toFrontItem->clickEvent = function() use ($self)
133 132
             {
134
-                $self->doAction ('bringToFront');
133
+                $self->doAction('bringToFront');
135 134
             };
136 135
 
137
-            $toBackItem = new ToolStripMenuItem ('На задний план');
138
-            $toBackItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Back_16x.png');
136
+            $toBackItem = new ToolStripMenuItem('На задний план');
137
+            $toBackItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Back_16x.png');
139 138
             // $toBackItem->shortcutKeys = 131138;
140
-            $toBackItem->clickEvent = function () use ($self)
139
+            $toBackItem->clickEvent = function() use ($self)
141 140
             {
142
-                $self->doAction ('sendToBack');
141
+                $self->doAction('sendToBack');
143 142
             };
144 143
 
145
-            $locked = ($locker = (new WFClass ('System.ComponentModel.TypeDescriptor', 'System'))
146
-                ->getProperties ($object = $this->propertyGrid->selectedObject->selector)['Locked'])
147
-                ->getValue ($object);
144
+            $locked = ($locker = (new WFClass('System.ComponentModel.TypeDescriptor', 'System'))
145
+                ->getProperties($object = $this->propertyGrid->selectedObject->selector)['Locked'])
146
+                ->getValue($object);
148 147
 			
149
-            $desItem = new ToolStripMenuItem ($locked ? 'Разблокировать' : 'Заблокировать');
150
-            $desItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/'. ($locked ? 'Unlock' : 'Lock') .'_16x.png');
148
+            $desItem = new ToolStripMenuItem($locked ? 'Разблокировать' : 'Заблокировать');
149
+            $desItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/'.($locked ? 'Unlock' : 'Lock').'_16x.png');
151 150
             // $desItem->shortcutKeys = 131148;
152
-            $desItem->clickEvent = function () use ($object, $locker, $locked)
151
+            $desItem->clickEvent = function() use ($object, $locker, $locked)
153 152
             {
154
-				$locker->setValue ($object, !$locked);
153
+				$locker->setValue($object, !$locked);
155 154
 
156
-				$this->propertyGrid->refresh ();
155
+				$this->propertyGrid->refresh();
157 156
             };
158 157
 
159
-            $selectAllItem = new ToolStripMenuItem ('Выделить всё');
160
-            $selectAllItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/SelectAll_16x.png');
158
+            $selectAllItem = new ToolStripMenuItem('Выделить всё');
159
+            $selectAllItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/SelectAll_16x.png');
161 160
             $selectAllItem->shortcutKeys = 131137;
162
-            $selectAllItem->clickEvent = function () use ($self)
161
+            $selectAllItem->clickEvent = function() use ($self)
163 162
             {
164
-				$self->doAction ('selectAll');
163
+				$self->doAction('selectAll');
165 164
             };
166 165
 			
167
-            $cutItem = new ToolStripMenuItem ('Вырезать');
168
-            $cutItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Cut_16x.png');
166
+            $cutItem = new ToolStripMenuItem('Вырезать');
167
+            $cutItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Cut_16x.png');
169 168
             $cutItem->shortcutKeys = 131160;
170
-            $cutItem->clickEvent = function () use ($self)
169
+            $cutItem->clickEvent = function() use ($self)
171 170
             {
172
-				$self->doAction ('cut');
171
+				$self->doAction('cut');
173 172
             };
174 173
 			
175
-            $copyItem = new ToolStripMenuItem ('Копировать');
176
-            $copyItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Copy_16x.png');
174
+            $copyItem = new ToolStripMenuItem('Копировать');
175
+            $copyItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Copy_16x.png');
177 176
             $copyItem->shortcutKeys = 131139;
178
-            $copyItem->clickEvent = function () use ($self)
177
+            $copyItem->clickEvent = function() use ($self)
179 178
             {
180
-				$self->doAction ('copy');
179
+				$self->doAction('copy');
181 180
             };
182 181
 			
183
-            $pasteItem = new ToolStripMenuItem ('Вставить');
184
-            $pasteItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Paste_16x.png');
182
+            $pasteItem = new ToolStripMenuItem('Вставить');
183
+            $pasteItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Paste_16x.png');
185 184
             $pasteItem->shortcutKeys = 131158;
186
-            $pasteItem->clickEvent = function () use ($self)
185
+            $pasteItem->clickEvent = function() use ($self)
187 186
             {
188 187
 				$self->doAction('paste');
189 188
             };
190 189
 			
191
-            $undoItem = new ToolStripMenuItem ('Отменить');
192
-            $undoItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Undo_16x.png');
190
+            $undoItem = new ToolStripMenuItem('Отменить');
191
+            $undoItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Undo_16x.png');
193 192
             $undoItem->shortcutKeys = 131162;
194
-            $undoItem->clickEvent = function () use ($self)
193
+            $undoItem->clickEvent = function() use ($self)
195 194
             {
196
-				$self->undoEngine->undo ();
195
+				$self->undoEngine->undo();
197 196
             };
198 197
 			
199
-            $redoItem = new ToolStripMenuItem ('Повторить');
200
-            $redoItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Redo_16x.png');
198
+            $redoItem = new ToolStripMenuItem('Повторить');
199
+            $redoItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Redo_16x.png');
201 200
             $redoItem->shortcutKeys = 131161;
202
-            $redoItem->clickEvent = function () use ($self)
201
+            $redoItem->clickEvent = function() use ($self)
203 202
             {
204
-				$self->undoEngine->redo ();
203
+				$self->undoEngine->redo();
205 204
             };
206 205
 
207
-            $infoItem = new ToolStripMenuItem ('Отладочная информация');
208
-            $infoItem->image = (new Image)->loadFromFile (APP_DIR .'/system/icons/Debug_16x.png');
209
-            $infoItem->clickEvent = function () use ($self)
206
+            $infoItem = new ToolStripMenuItem('Отладочная информация');
207
+            $infoItem->image = (new Image)->loadFromFile(APP_DIR.'/system/icons/Debug_16x.png');
208
+            $infoItem->clickEvent = function() use ($self)
210 209
             {
211
-                $self->getSelectedComponents ()->foreach (function ($value) use ($self)
210
+                $self->getSelectedComponents()->foreach(function($value) use ($self)
212 211
                 {
213
-                    pre ($value instanceof Component ? $value : $value->toString () ."\nSelector: ". $value->selector);
212
+                    pre($value instanceof Component ? $value : $value->toString()."\nSelector: ".$value->selector);
214 213
 
215
-					if ((new WFObject(VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))->isAssignableFrom ($value->getType ()))
216
-                        pre ($self->getSharpCode ($self->form->name));
214
+					if ((new WFObject(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')))->isAssignableFrom($value->getType()))
215
+                        pre($self->getSharpCode($self->form->name));
217 216
                 });
218 217
             };
219 218
 
220 219
             $menu = new ContextMenuStrip;
221
-            $menu->items->addRange ([
220
+            $menu->items->addRange([
222 221
                 $selectAllItem, $copyItem, $pasteItem, $cutItem, $delItem, '-',
223 222
                 $toFrontItem, $toBackItem, $desItem, '-',
224 223
 				$undoItem, $redoItem, '-',
225 224
                 $infoItem
226 225
             ]);
227 226
 
228
-            $menu->show ($self->form, $self->form->pointToClient (VoidEngine::createObject ('System.Drawing.Point', 'System.Drawing', $args->x, $args->y)));
227
+            $menu->show($self->form, $self->form->pointToClient(VoidEngine::createObject('System.Drawing.Point', 'System.Drawing', $args->x, $args->y)));
229 228
         };
230 229
 
231
-        VoidStudioAPI::addObjects ('main', ['Designer__'. $this->form->name .'Designer' => $this]);
230
+        VoidStudioAPI::addObjects('main', ['Designer__'.$this->form->name.'Designer' => $this]);
232 231
     }
233 232
 
234
-    public function focus (): void
233
+    public function focus(): void
235 234
     {
236
-        $this->form->focus ();
235
+        $this->form->focus();
237 236
     }
238 237
 
239
-    public function getSharpCode (string $formName): string
238
+    public function getSharpCode(string $formName): string
240 239
     {
241
-        $code = $this->callMethod (['GetSharpCode', 'object'], $formName);
240
+        $code = $this->callMethod(['GetSharpCode', 'object'], $formName);
242 241
 
243
-        $code = VoidEngine::callMethod ($code, ['Replace', 'object'], 'public class '. $this->form->name .' : '. $this->form->name, 'public class '. $this->form->name .' : System.Windows.Forms.Form');
244
-        $code = VoidEngine::callMethod ($code, ['Replace', 'object'], '    private ', '    public ');
242
+        $code = VoidEngine::callMethod($code, ['Replace', 'object'], 'public class '.$this->form->name.' : '.$this->form->name, 'public class '.$this->form->name.' : System.Windows.Forms.Form');
243
+        $code = VoidEngine::callMethod($code, ['Replace', 'object'], '    private ', '    public ');
245 244
 
246
-        return VoidEngine::callMethod ($code, 'ToString');
245
+        return VoidEngine::callMethod($code, 'ToString');
247 246
     }
248 247
 
249
-    public function createComponent (array $component, string $componentName): int
248
+    public function createComponent(array $component, string $componentName): int
250 249
     {
251 250
         $this->objects[$componentName] = $component;
252
-        $selector = VoidEngine::createObject (...$component);
251
+        $selector = VoidEngine::createObject(...$component);
253 252
 
254
-        $this->callMethod ('AddComponent', $selector, $componentName);
253
+        $this->callMethod('AddComponent', $selector, $componentName);
255 254
 
256 255
         return $selector;
257 256
     }
258 257
 
259
-    public function setComponentToHistory (array $component, string $componentName): void
258
+    public function setComponentToHistory(array $component, string $componentName): void
260 259
     {
261 260
         $this->objects[$componentName] = $component;
262 261
     }
263 262
 
264
-    public function addComponent (int $selector, string $componentName): void
263
+    public function addComponent(int $selector, string $componentName): void
265 264
     {
266
-        $this->objects[$componentName] = [VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'ToString'), 'auto'];
265
+        $this->objects[$componentName] = [VoidEngine::callMethod(VoidEngine::callMethod($selector, 'GetType'), 'ToString'), 'auto'];
267 266
 
268
-        $this->callMethod ('AddComponent', $selector, $componentName);
267
+        $this->callMethod('AddComponent', $selector, $componentName);
269 268
     }
270 269
 
271
-    public function removeComponent (int $component): void
270
+    public function removeComponent(int $component): void
272 271
     {
273
-        unset ($this->objects[$this->getComponentName ($component)]);
272
+        unset ($this->objects[$this->getComponentName($component)]);
274 273
 
275
-        $this->callMethod ('RemoveComponent', $component);
274
+        $this->callMethod('RemoveComponent', $component);
276 275
     }
277 276
 
278
-    public function removeComponentHistoryByName (string $name): void
277
+    public function removeComponentHistoryByName(string $name): void
279 278
     {
280 279
         unset ($this->objects[$name]);
281 280
     }
282 281
 
283
-    public function removeSelected (): void
282
+    public function removeSelected(): void
284 283
     {
285 284
         $toUnset = [];
286 285
 
287
-        foreach ($this->getSelectedComponents ()->list as $object)
286
+        foreach ($this->getSelectedComponents()->list as $object)
288 287
         {
289
-            if ($object->getType ()->toString () != 'System.Windows.Forms.Form')
290
-                $toUnset[] = $this->getComponentName ($object->selector);
288
+            if ($object->getType()->toString() != 'System.Windows.Forms.Form')
289
+                $toUnset[] = $this->getComponentName($object->selector);
291 290
 
292 291
             else
293 292
             {
294 293
                 if ($this->formsList->items->count > 1)
295 294
                 {
296
-                    if (messageBox ('Вы действительно хотите удалить форму "'. $this->form->name .'"?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
295
+                    if (messageBox('Вы действительно хотите удалить форму "'.$this->form->name.'"?', 'Подтвердите действие', enum('System.Windows.Forms.MessageBoxButtons.YesNo'), enum('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
297 296
                     {
298 297
                         foreach ($this->objects as $name => $obj)
299 298
                             unset ($this->objects[$name]);
300 299
 
301
-                        unset ($this->formsList->items[array_flip ($this->formsList->items->names)[$form = $this->getComponentName ($object->selector)]]);
300
+                        unset ($this->formsList->items[array_flip($this->formsList->items->names)[$form = $this->getComponentName($object->selector)]]);
302 301
 
303 302
                         /*$this->form->dispose ();
304 303
                         VoidEngine::callMethod ($this->control, 'Dispose');*/
305
-                        $this->callMethod ('DeleteSelected');
304
+                        $this->callMethod('DeleteSelected');
306 305
 
307
-                        $designer = VoidStudioAPI::getObjects ('main')['Designer__'. $this->formsList->selectedTab->text .'Designer'];
306
+                        $designer = VoidStudioAPI::getObjects('main')['Designer__'.$this->formsList->selectedTab->text.'Designer'];
308 307
                         
309 308
                         $designer->propertyGrid->selectedObject = $designer->form;
310
-                        $designer->setSelectedComponents ($designer->form);
309
+                        $designer->setSelectedComponents($designer->form);
311 310
 
312
-                        unset (VoidStudioAPI::$objects['main']['Designer__'. $form .'Designer']);
311
+                        unset (VoidStudioAPI::$objects['main']['Designer__'.$form.'Designer']);
313 312
 
314 313
                         return;
315 314
                     }
@@ -317,7 +316,7 @@  discard block
 block discarded – undo
317 316
 
318 317
                 else
319 318
                 {
320
-                    messageBox ('Нельзя удалить единственную форму проекта', 'Ошибка удаления', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
319
+                    messageBox('Нельзя удалить единственную форму проекта', 'Ошибка удаления', enum('System.Windows.Forms.MessageBoxButtons.OK'), enum('System.Windows.Forms.MessageBoxIcon.Error'));
321 320
 
322 321
                     return;
323 322
                 }
@@ -327,52 +326,52 @@  discard block
 block discarded – undo
327 326
         foreach ($toUnset as $name)
328 327
             unset ($this->objects[$name]);
329 328
 
330
-        $this->doAction ('delete');
329
+        $this->doAction('delete');
331 330
 
332 331
         foreach ($this->objects as $objectName => $object)
333
-            if (!is_int ($this->getComponentByName ($objectName)))
332
+            if (!is_int($this->getComponentByName($objectName)))
334 333
                 unset ($this->objects[$objectName]);
335 334
 
336
-        $this->currentSelectedItem->items->clear ();
337
-        $this->currentSelectedItem->items->addRange (array_keys ($this->objects));
338
-        $this->currentSelectedItem->selectedItem = $this->getComponentName ($this->getPrimarySelection ()->selector);
335
+        $this->currentSelectedItem->items->clear();
336
+        $this->currentSelectedItem->items->addRange(array_keys($this->objects));
337
+        $this->currentSelectedItem->selectedItem = $this->getComponentName($this->getPrimarySelection()->selector);
339 338
     }
340 339
 
341
-    public function renameComponent (int $component, string $name, string $fromName = null): void
340
+    public function renameComponent(int $component, string $name, string $fromName = null): void
342 341
     {
343 342
         if ($fromName === null)
344
-            $fromName = $this->getComponentName ($component);
343
+            $fromName = $this->getComponentName($component);
345 344
 
346 345
         $info = $this->objects[$fromName];
347 346
         unset ($this->objects[$fromName]);
348 347
         $this->objects[$name] = $info;
349 348
 
350
-        $this->callMethod ('RenameComponent', $component, $name);
349
+        $this->callMethod('RenameComponent', $component, $name);
351 350
     }
352 351
 
353
-    public function getComponentName (int $component): string
352
+    public function getComponentName(int $component): string
354 353
     {
355
-        return $this->callMethod ('GetComponentName', $component);
354
+        return $this->callMethod('GetComponentName', $component);
356 355
     }
357 356
 
358
-    public function getComponentByName (string $name)
357
+    public function getComponentByName(string $name)
359 358
     {
360
-        return $this->callMethod ('GetComponentByName', $name);
359
+        return $this->callMethod('GetComponentByName', $name);
361 360
     }
362 361
 
363
-    public function getComponentClass (string $name)
362
+    public function getComponentClass(string $name)
364 363
     {
365 364
         return isset ($this->objects[$name]) ?
366 365
             $this->objects[$name] : false;
367 366
     }
368 367
 
369
-    public function addProperty (int $selector, string $name, int $value, bool $readOnly, string $category, string $description, bool $visible)
368
+    public function addProperty(int $selector, string $name, int $value, bool $readOnly, string $category, string $description, bool $visible)
370 369
     {
371
-        $this->callMethod ('AddProperty', $selector, $name, $value, $readOnly, $category, $description, $visible);
370
+        $this->callMethod('AddProperty', $selector, $name, $value, $readOnly, $category, $description, $visible);
372 371
     }
373 372
 
374
-    public function removeProperty (int $selector, string $name)
373
+    public function removeProperty(int $selector, string $name)
375 374
     {
376
-        $this->callMethod ('RemoveProperty', $selector, $name);
375
+        $this->callMethod('RemoveProperty', $selector, $name);
377 376
     }
378 377
 }
Please login to merge, or discard this patch.
Braces   +27 added lines, -23 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
         $this->form = $form === null ? new Form :
18 18
             EngineAdditions::coupleSelector ($form);
19 19
 
20
-        if (!is_object ($this->form))
21
-            throw new \Exception ('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
20
+        if (!is_object ($this->form)) {
21
+                    throw new \Exception ('$form param in "VoidEngine\VoidDesigner" constructor must be instance of "VoidEngine\WFObject" ("VoidEngine\Form") or be object selector');
22
+        }
22 23
 
23 24
         $this->propertyGrid        = $propertyGrid;
24 25
         $this->currentSelectedItem = $currentSelectedItem;
@@ -104,9 +105,10 @@  discard block
 block discarded – undo
104 105
 			$name = $this->getComponentName ($args->component->selector);
105 106
 			unset ($this->objects[$name]);
106 107
 
107
-			foreach ($this->objects as $objectName => $object)
108
-				if (!is_int ($this->getComponentByName ($objectName)))
109
-					unset ($this->objects[$objectName]);
108
+			foreach ($this->objects as $objectName => $object) {
109
+							if (!is_int ($this->getComponentByName ($objectName)))
110
+					unset ($this->objects[$objectName]);
111
+			}
110 112
 
111 113
 			$this->currentSelectedItem->items->clear ();
112 114
 			$this->currentSelectedItem->items->addRange (array_keys ($this->objects));
@@ -212,8 +214,9 @@  discard block
 block discarded – undo
212 214
                 {
213 215
                     pre ($value instanceof Component ? $value : $value->toString () ."\nSelector: ". $value->selector);
214 216
 
215
-					if ((new WFObject(VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))->isAssignableFrom ($value->getType ()))
216
-                        pre ($self->getSharpCode ($self->form->name));
217
+					if ((new WFObject(VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))->isAssignableFrom ($value->getType ())) {
218
+					                        pre ($self->getSharpCode ($self->form->name));
219
+					}
217 220
                 });
218 221
             };
219 222
 
@@ -286,17 +289,17 @@  discard block
 block discarded – undo
286 289
 
287 290
         foreach ($this->getSelectedComponents ()->list as $object)
288 291
         {
289
-            if ($object->getType ()->toString () != 'System.Windows.Forms.Form')
290
-                $toUnset[] = $this->getComponentName ($object->selector);
291
-
292
-            else
292
+            if ($object->getType ()->toString () != 'System.Windows.Forms.Form') {
293
+                            $toUnset[] = $this->getComponentName ($object->selector);
294
+            } else
293 295
             {
294 296
                 if ($this->formsList->items->count > 1)
295 297
                 {
296 298
                     if (messageBox ('Вы действительно хотите удалить форму "'. $this->form->name .'"?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
297 299
                     {
298
-                        foreach ($this->objects as $name => $obj)
299
-                            unset ($this->objects[$name]);
300
+                        foreach ($this->objects as $name => $obj) {
301
+                                                    unset ($this->objects[$name]);
302
+                        }
300 303
 
301 304
                         unset ($this->formsList->items[array_flip ($this->formsList->items->names)[$form = $this->getComponentName ($object->selector)]]);
302 305
 
@@ -313,9 +316,7 @@  discard block
 block discarded – undo
313 316
 
314 317
                         return;
315 318
                     }
316
-                }
317
-
318
-                else
319
+                } else
319 320
                 {
320 321
                     messageBox ('Нельзя удалить единственную форму проекта', 'Ошибка удаления', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
321 322
 
@@ -324,14 +325,16 @@  discard block
 block discarded – undo
324 325
             }
325 326
         }
326 327
 
327
-        foreach ($toUnset as $name)
328
-            unset ($this->objects[$name]);
328
+        foreach ($toUnset as $name) {
329
+                    unset ($this->objects[$name]);
330
+        }
329 331
 
330 332
         $this->doAction ('delete');
331 333
 
332
-        foreach ($this->objects as $objectName => $object)
333
-            if (!is_int ($this->getComponentByName ($objectName)))
334
-                unset ($this->objects[$objectName]);
334
+        foreach ($this->objects as $objectName => $object) {
335
+                    if (!is_int ($this->getComponentByName ($objectName)))
336
+                unset ($this->objects[$objectName]);
337
+        }
335 338
 
336 339
         $this->currentSelectedItem->items->clear ();
337 340
         $this->currentSelectedItem->items->addRange (array_keys ($this->objects));
@@ -340,8 +343,9 @@  discard block
 block discarded – undo
340 343
 
341 344
     public function renameComponent (int $component, string $name, string $fromName = null): void
342 345
     {
343
-        if ($fromName === null)
344
-            $fromName = $this->getComponentName ($component);
346
+        if ($fromName === null) {
347
+                    $fromName = $this->getComponentName ($component);
348
+        }
345 349
 
346 350
         $info = $this->objects[$fromName];
347 351
         unset ($this->objects[$fromName]);
Please login to merge, or discard this patch.
bin/app/php/ProjectManager.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
 {
7 7
     public static string $projectPath = '';
8 8
 
9
-    public static function createProject (string $name = 'default'): bool
9
+    public static function createProject(string $name = 'default'): bool
10 10
     {
11
-        if (!is_dir ($dir = 'C:/Users/'. USERNAME .'/Documents/VoidStudio'))
12
-            dir_create ($dir);
11
+        if (!is_dir($dir = 'C:/Users/'.USERNAME.'/Documents/VoidStudio'))
12
+            dir_create($dir);
13 13
 
14
-        if (is_dir ($dir = $dir .'/'. $name))
14
+        if (is_dir($dir = $dir.'/'.$name))
15 15
         {
16
-            if (messageBox ('Проект "'. $name .'" уже создан. Перезаписать его?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
17
-                dir_clean ($dir);
16
+            if (messageBox('Проект "'.$name.'" уже создан. Перезаписать его?', 'Подтвердите действие', enum('System.Windows.Forms.MessageBoxButtons.YesNo'), enum('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
17
+                dir_clean($dir);
18 18
 
19 19
             else return false;
20 20
         }
21 21
 
22
-        else dir_create ($dir);
22
+        else dir_create($dir);
23 23
 
24 24
         self::$projectPath = $dir;
25 25
 
26
-        VoidStudioAPI::getObjects ('main')['MainForm']->caption    = $name .' — VoidStudio';
27
-        VoidStudioAPI::getObjects ('modules')['MainForm']->caption = $name .' — модули проекта';
28
-        VoidStudioAPI::getObjects ('main')['ToolsPanel__LogList']->items->add ('Проект "'. $name .'" успешно создан');
26
+        VoidStudioAPI::getObjects('main')['MainForm']->caption    = $name.' — VoidStudio';
27
+        VoidStudioAPI::getObjects('modules')['MainForm']->caption = $name.' — модули проекта';
28
+        VoidStudioAPI::getObjects('main')['ToolsPanel__LogList']->items->add('Проект "'.$name.'" успешно создан');
29 29
 
30
-        dir_create ($dir .'/modules');
30
+        dir_create($dir.'/modules');
31 31
         // copy (__DIR__ .'/../Qero/Qero.phar', $dir .'/Qero.phar');
32 32
 
33 33
         // require $dir .'/Qero.phar';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         return true;
36 36
     }
37 37
 
38
-    public static function saveProject (string $file): void
38
+    public static function saveProject(string $file): void
39 39
     {
40 40
         $info = [
41 41
             'forms'   => [],
@@ -43,84 +43,84 @@  discard block
 block discarded – undo
43 43
             'objects' => []
44 44
         ];
45 45
 
46
-        foreach (VoidStudioAPI::getObjects ('main')['Designer__FormsList']->items->names as $item)
46
+        foreach (VoidStudioAPI::getObjects('main')['Designer__FormsList']->items->names as $item)
47 47
         {
48
-            $designer = VoidStudioAPI::getObjects ('main')['Designer__'. $item .'Designer'];
48
+            $designer = VoidStudioAPI::getObjects('main')['Designer__'.$item.'Designer'];
49 49
 
50
-            $info['forms'][$item]   = VoidStudioBuilder::appendDesignerData ($designer->getSharpCode ($item), $designer);
51
-            $info['objects'][$item] = array_keys ($designer->objects);
50
+            $info['forms'][$item]   = VoidStudioBuilder::appendDesignerData($designer->getSharpCode($item), $designer);
51
+            $info['objects'][$item] = array_keys($designer->objects);
52 52
             $info['events'][$item]  = VoidStudioAPI::$events[$item] ?? null;
53 53
         }
54 54
 
55
-        file_put_contents ($file, gzdeflate (serialize ($info), 9));
55
+        file_put_contents($file, gzdeflate(serialize($info), 9));
56 56
 
57
-        if (replaceSl (self::$projectPath) != replaceSl (dirname ($file)))
58
-            dir_copy (self::$projectPath .'/modules', dirname ($file) .'/modules');
57
+        if (replaceSl(self::$projectPath) != replaceSl(dirname($file)))
58
+            dir_copy(self::$projectPath.'/modules', dirname($file).'/modules');
59 59
 
60
-        VoidStudioAPI::getObjects ('main')['ToolsPanel__LogList']->items->add ('Проект успешно сохранён');
60
+        VoidStudioAPI::getObjects('main')['ToolsPanel__LogList']->items->add('Проект успешно сохранён');
61 61
     }
62 62
 
63
-    public static function openProject (string $file): void
63
+    public static function openProject(string $file): void
64 64
     {
65
-        messageBox ('В настоящий момент пересматривается алгоритм открытия проектов, поэтому возможны многочисленные баги (в т.ч. невозможность компиляции открытого проекта)'. "\n\nБудет исправлено в ближайшее время\nС уважением, разработчики проекта WinForms PHP", 'Предупреждение об ошибках', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Warning'));
65
+        messageBox('В настоящий момент пересматривается алгоритм открытия проектов, поэтому возможны многочисленные баги (в т.ч. невозможность компиляции открытого проекта)'."\n\nБудет исправлено в ближайшее время\nС уважением, разработчики проекта WinForms PHP", 'Предупреждение об ошибках', enum('System.Windows.Forms.MessageBoxButtons.OK'), enum('System.Windows.Forms.MessageBoxIcon.Warning'));
66 66
 
67
-        self::$projectPath = dirname ($file); 
67
+        self::$projectPath = dirname($file); 
68 68
 
69
-        $info    = unserialize (gzinflate (file_get_contents ($file)));
70
-        $objects = VoidStudioAPI::getObjects ('main');
69
+        $info    = unserialize(gzinflate(file_get_contents($file)));
70
+        $objects = VoidStudioAPI::getObjects('main');
71 71
 
72 72
         foreach ($objects['Designer__FormsList']->items->names as $form)
73 73
         {
74
-            $designer = VoidStudioAPI::$objects['main']['Designer__'. $form .'Designer'];
74
+            $designer = VoidStudioAPI::$objects['main']['Designer__'.$form.'Designer'];
75 75
 
76
-            $designer->form->dispose ();
77
-            $designer->control->dispose ();
76
+            $designer->form->dispose();
77
+            $designer->control->dispose();
78 78
 
79
-            unset (VoidStudioAPI::$objects['main']['Designer__'. $form .'Designer'], $designer);
79
+            unset (VoidStudioAPI::$objects['main']['Designer__'.$form.'Designer'], $designer);
80 80
         }
81 81
 
82 82
         $objects['PropertiesList__List']->selectedObject = null;
83
-        $objects['Designer__FormsList']->items->clear ();
83
+        $objects['Designer__FormsList']->items->clear();
84 84
 
85 85
         foreach ($info['forms'] as $formName => $form)
86 86
         {
87
-            $sourceForm = (new WFClass ('WinForms_PHP.WFCompiler', ''))->evalCS ("using System;\nusing System.Windows.Forms;\nusing System.Reflection;\nusing System.Linq;\nusing System.ComponentModel;\n\npublic class CodeEvaler\n{\n\tpublic object EvalCode ()\n\t{\n\t\tForm form = new $formName ();\n\n\t\tVoidControlsParser.ParseControlsForOpening (\"$formName\", (Control) form);\n\n\t\treturn form;\n\t}\n}\n\n". file_get_contents (APP_DIR .'/system/presets/compile_parser_preset.cs') ."\n\n". (string)($form), true);
87
+            $sourceForm = (new WFClass('WinForms_PHP.WFCompiler', ''))->evalCS("using System;\nusing System.Windows.Forms;\nusing System.Reflection;\nusing System.Linq;\nusing System.ComponentModel;\n\npublic class CodeEvaler\n{\n\tpublic object EvalCode ()\n\t{\n\t\tForm form = new $formName ();\n\n\t\tVoidControlsParser.ParseControlsForOpening (\"$formName\", (Control) form);\n\n\t\treturn form;\n\t}\n}\n\n".file_get_contents(APP_DIR.'/system/presets/compile_parser_preset.cs')."\n\n".(string) ($form), true);
88 88
 
89 89
             $form = $GLOBALS['__underConstruction'][$formName];
90 90
             unset ($GLOBALS['__underConstruction'], $form[$formName]);
91 91
 
92
-            $formObjects = array_flip ($info['objects'][$formName]);
92
+            $formObjects = array_flip($info['objects'][$formName]);
93 93
 
94 94
             foreach ($form as $name => $selector)
95 95
                 if (!isset ($formObjects[$name]))
96 96
                     unset ($form[$name]);
97 97
 
98
-            $page = new TabPage ($formName);
98
+            $page = new TabPage($formName);
99 99
             $page->backgroundColor = clWhite;
100 100
 
101
-            $objects['Designer__FormsList']->items->add ($page);
101
+            $objects['Designer__FormsList']->items->add($page);
102 102
 
103
-            $designer = new VoidDesigner ($page, $formName, $objects['PropertiesList__List'], $objects['PropertiesPanel__SelectedComponent'], $objects['Designer__FormsList'], $sourceForm);
104
-            $designer->initDesigner ();
103
+            $designer = new VoidDesigner($page, $formName, $objects['PropertiesList__List'], $objects['PropertiesPanel__SelectedComponent'], $objects['Designer__FormsList'], $sourceForm);
104
+            $designer->initDesigner();
105 105
 
106 106
             // VoidStudioAPI::$objects['main']['Designer__'. $formName .'Designer'] = $designer;
107 107
             VoidStudioAPI::$events[$formName] = $info['events'][$formName] ?? null;
108 108
 
109 109
             foreach ($form as $name => $selector)
110
-                $designer->addComponent ($selector, $name);
110
+                $designer->addComponent($selector, $name);
111 111
         }
112 112
 
113 113
         // Components::cleanJunk ();
114 114
 
115 115
         $objects['Designer__FormsList']->selectedTab = $page;
116 116
 
117
-        $objects['PropertiesPanel__SelectedComponent']->items->clear ();
118
-        $objects['PropertiesPanel__SelectedComponent']->items->addRange (array_keys ($designer->objects));
117
+        $objects['PropertiesPanel__SelectedComponent']->items->clear();
118
+        $objects['PropertiesPanel__SelectedComponent']->items->addRange(array_keys($designer->objects));
119 119
         $objects['PropertiesPanel__SelectedComponent']->selectedItem = $formName;
120 120
 
121
-        VoidStudioAPI::getObjects ('main')['MainForm']->caption = basenameNoExt ($file) .' — VoidStudio';
121
+        VoidStudioAPI::getObjects('main')['MainForm']->caption = basenameNoExt($file).' — VoidStudio';
122 122
 
123 123
         $objects['PropertiesList__List']->selectedObject = $designer->form;
124
-        $designer->focus ();
124
+        $designer->focus();
125 125
     }
126 126
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,18 +8,20 @@  discard block
 block discarded – undo
8 8
 
9 9
     public static function createProject (string $name = 'default'): bool
10 10
     {
11
-        if (!is_dir ($dir = 'C:/Users/'. USERNAME .'/Documents/VoidStudio'))
12
-            dir_create ($dir);
11
+        if (!is_dir ($dir = 'C:/Users/'. USERNAME .'/Documents/VoidStudio')) {
12
+                    dir_create ($dir);
13
+        }
13 14
 
14 15
         if (is_dir ($dir = $dir .'/'. $name))
15 16
         {
16
-            if (messageBox ('Проект "'. $name .'" уже создан. Перезаписать его?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
17
-                dir_clean ($dir);
18
-
19
-            else return false;
20
-        }
21
-
22
-        else dir_create ($dir);
17
+            if (messageBox ('Проект "'. $name .'" уже создан. Перезаписать его?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6) {
18
+                            dir_clean ($dir);
19
+            } else {
20
+                return false;
21
+            }
22
+        } else {
23
+            dir_create ($dir);
24
+        }
23 25
 
24 26
         self::$projectPath = $dir;
25 27
 
@@ -54,8 +56,9 @@  discard block
 block discarded – undo
54 56
 
55 57
         file_put_contents ($file, gzdeflate (serialize ($info), 9));
56 58
 
57
-        if (replaceSl (self::$projectPath) != replaceSl (dirname ($file)))
58
-            dir_copy (self::$projectPath .'/modules', dirname ($file) .'/modules');
59
+        if (replaceSl (self::$projectPath) != replaceSl (dirname ($file))) {
60
+                    dir_copy (self::$projectPath .'/modules', dirname ($file) .'/modules');
61
+        }
59 62
 
60 63
         VoidStudioAPI::getObjects ('main')['ToolsPanel__LogList']->items->add ('Проект успешно сохранён');
61 64
     }
@@ -91,9 +94,10 @@  discard block
 block discarded – undo
91 94
 
92 95
             $formObjects = array_flip ($info['objects'][$formName]);
93 96
 
94
-            foreach ($form as $name => $selector)
95
-                if (!isset ($formObjects[$name]))
96
-                    unset ($form[$name]);
97
+            foreach ($form as $name => $selector) {
98
+                            if (!isset ($formObjects[$name]))
99
+                    unset ($form[$name]);
100
+            }
97 101
 
98 102
             $page = new TabPage ($formName);
99 103
             $page->backgroundColor = clWhite;
@@ -106,8 +110,9 @@  discard block
 block discarded – undo
106 110
             // VoidStudioAPI::$objects['main']['Designer__'. $formName .'Designer'] = $designer;
107 111
             VoidStudioAPI::$events[$formName] = $info['events'][$formName] ?? null;
108 112
 
109
-            foreach ($form as $name => $selector)
110
-                $designer->addComponent ($selector, $name);
113
+            foreach ($form as $name => $selector) {
114
+                            $designer->addComponent ($selector, $name);
115
+            }
111 116
         }
112 117
 
113 118
         // Components::cleanJunk ();
Please login to merge, or discard this patch.
bin/app/php/Builder.php 2 patches
Spacing   +51 added lines, -52 removed lines patch added patch discarded remove patch
@@ -6,132 +6,131 @@
 block discarded – undo
6 6
 
7 7
 class VoidStudioBuilder
8 8
 {
9
-    public static function compileProject (string $save, string $enteringPoint, array $references, array $settings = [], bool $printSuccessCompile = false, bool $debug = false): array
9
+    public static function compileProject(string $save, string $enteringPoint, array $references, array $settings = [], bool $printSuccessCompile = false, bool $debug = false): array
10 10
     {
11
-        $savePath   = dirname ($save) .'/'. basenameNoExt ($save);
12
-        $globalCode = file_get_contents (APP_DIR .'/system/presets/compile_parser_preset.cs') ."\n\n";
11
+        $savePath   = dirname($save).'/'.basenameNoExt($save);
12
+        $globalCode = file_get_contents(APP_DIR.'/system/presets/compile_parser_preset.cs')."\n\n";
13 13
         $eventsCode = '';
14 14
         $forms      = [];
15 15
 
16 16
         for ($i = 0; $i < 5; ++$i)
17
-            if (!isset ($settings[$i]) || !strlen (trim ($settings[$i])))
17
+            if (!isset ($settings[$i]) || !strlen(trim($settings[$i])))
18 18
                 $settings[$i] = null;
19 19
 
20
-        $settings = array_slice ($settings, 0, 5);
20
+        $settings = array_slice($settings, 0, 5);
21 21
 
22
-        foreach (VoidStudioAPI::getObjects ('main')['Designer__FormsList']->items->names as $id => $item)
22
+        foreach (VoidStudioAPI::getObjects('main')['Designer__FormsList']->items->names as $id => $item)
23 23
         {
24
-            $designer    = VoidStudioAPI::getObjects ('main')['Designer__'. $item .'Designer'];
25
-            $globalCode .= self::appendDesignerData ($designer->getSharpCode ($item), $designer);
24
+            $designer    = VoidStudioAPI::getObjects('main')['Designer__'.$item.'Designer'];
25
+            $globalCode .= self::appendDesignerData($designer->getSharpCode($item), $designer);
26 26
 
27 27
             $forms[] = $item;
28 28
 
29 29
             if (isset (VoidStudioAPI::$events[$item]))
30 30
             {
31
-                $eventsCode .= VoidStudioAPI::$events[$item] ."\n\n";
31
+                $eventsCode .= VoidStudioAPI::$events[$item]."\n\n";
32 32
 
33 33
                 foreach ($designer->objects as $name => $objectType)
34
-                    foreach ($designer->getComponentEvents ($designer->getComponentByName ($name))->list as $event)
35
-                        $eventsCode .= 'Events::setObjectEvent ($GLOBALS[\'__underConstruction\'][\''. $item .'\'][\''. $name .'\'], \''. $event->eventDescriptor->Name .'\', \'VoidEngine\\'. $item .'::'. $event->methodName .'\');';
34
+                    foreach ($designer->getComponentEvents($designer->getComponentByName($name))->list as $event)
35
+                        $eventsCode .= 'Events::setObjectEvent ($GLOBALS[\'__underConstruction\'][\''.$item.'\'][\''.$name.'\'], \''.$event->eventDescriptor->Name.'\', \'VoidEngine\\'.$item.'::'.$event->methodName.'\');';
36 36
             }
37 37
         }
38 38
 
39
-        dir_clean ($savePath);
40
-        dir_copy (CORE_DIR, $savePath);
39
+        dir_clean($savePath);
40
+        dir_copy(CORE_DIR, $savePath);
41 41
         
42
-        unlink ($savePath .'/script.php');
43
-        unlink ($savePath .'/VoidCore.exe');
42
+        unlink($savePath.'/script.php');
43
+        unlink($savePath.'/VoidCore.exe');
44 44
 
45
-        $errors = VoidEngine::compile ($savePath .'/'. basename ($save), APP_DIR .'/system/icons/Icon.ico', str_replace_assoc (file_get_contents (APP_DIR .'/system/presets/compile_main_preset.php'), [
46
-            '%VoidEngine%' => VoidStudioBuilder::generateCode ($references),
45
+        $errors = VoidEngine::compile($savePath.'/'.basename($save), APP_DIR.'/system/icons/Icon.ico', str_replace_assoc(file_get_contents(APP_DIR.'/system/presets/compile_main_preset.php'), [
46
+            '%VoidEngine%' => VoidStudioBuilder::generateCode($references),
47 47
 
48
-            '%modules%' => (file_exists ($modulesFile = VoidStudioProjectManager::$projectPath .'/modules/Qero.json') && sizeof ($modules = json_decode (file_get_contents ($modulesFile))) ? "require 'qero-packages/autoload.php';\n\n" : "\n\n") . implode ("\n", array_map (function ($module)
48
+            '%modules%' => (file_exists($modulesFile = VoidStudioProjectManager::$projectPath.'/modules/Qero.json') && sizeof($modules = json_decode(file_get_contents($modulesFile))) ? "require 'qero-packages/autoload.php';\n\n" : "\n\n").implode("\n", array_map(function($module)
49 49
             {
50
-                $module = trim (file_get_contents ($module));
50
+                $module = trim(file_get_contents($module));
51 51
     
52
-                if (substr ($module, 0, 2) == '<?')
53
-                    $module = substr ($module, 2);
52
+                if (substr($module, 0, 2) == '<?')
53
+                    $module = substr($module, 2);
54 54
     
55
-                if (substr ($module, 0, 3) == 'php')
56
-                    $module = substr ($module, 3);
55
+                if (substr($module, 0, 3) == 'php')
56
+                    $module = substr($module, 3);
57 57
     
58
-                if (substr ($module, -2) == '?>')
59
-                    $module = substr ($module, 0, -2);
58
+                if (substr($module, -2) == '?>')
59
+                    $module = substr($module, 0, -2);
60 60
     
61 61
                 return "\$module = <<<'__MODULE'\n\n$module\n\n__MODULE;\n\neval (\$module);";
62
-            }, array_merge (glob (VoidStudioProjectManager::$projectPath .'/modules/*.php'), $debug ? [APP_DIR .'/system/debug/DebugHook.php'] : []))),
62
+            }, array_merge(glob(VoidStudioProjectManager::$projectPath.'/modules/*.php'), $debug ? [APP_DIR.'/system/debug/DebugHook.php'] : []))),
63 63
 
64 64
             '%events%'         => $eventsCode,
65 65
             '%entering_point%' => $enteringPoint,
66
-            '%author_id%'      => sha1 (shell_exec ('wmic csproduct'))
67
-        ]), $settings[0], $settings[1], $settings[2], $settings[3], $settings[4], str_replace_assoc (file_get_contents (APP_DIR .'/system/presets/compile_main_preset.cs'), [
68
-            '%forms%' => join ('", "', $forms)
66
+            '%author_id%'      => sha1(shell_exec('wmic csproduct'))
67
+        ]), $settings[0], $settings[1], $settings[2], $settings[3], $settings[4], str_replace_assoc(file_get_contents(APP_DIR.'/system/presets/compile_main_preset.cs'), [
68
+            '%forms%' => join('", "', $forms)
69 69
         ]), $globalCode);
70 70
 
71
-        if (isset ($modules) && sizeof ($modules) > 0)
71
+        if (isset ($modules) && sizeof($modules) > 0)
72 72
         {
73
-            dir_delete (APP_DIR .'/Qero/qero-packages');
73
+            dir_delete(APP_DIR.'/Qero/qero-packages');
74 74
 
75 75
             $manager = new \Qero\PackagesManager\PackagesManager;
76 76
 
77 77
             foreach ($modules as $package)
78
-                $manager->installPackage ($package);
78
+                $manager->installPackage($package);
79 79
 
80
-            dir_copy (APP_DIR .'/Qero/qero-packages', $savePath .'/qero-packages');
81
-            dir_delete (APP_DIR .'/Qero/qero-packages');
80
+            dir_copy(APP_DIR.'/Qero/qero-packages', $savePath.'/qero-packages');
81
+            dir_delete(APP_DIR.'/Qero/qero-packages');
82 82
         }
83 83
 
84 84
         // pre ($errors);
85 85
         // pre ($globalCode->toString ());
86 86
 
87
-        $log = VoidStudioAPI::getObjects ('main')['ToolsPanel__LogList'];
88
-        $log->items->add ('Проект скомпилирован по пути "'. $save .'". '. (($errorsCount = sizeof ($errors)) > 0 ? ('Обнаружено '. $errorsCount .' ошибок') : 'Ошибок не обнаружено'));
87
+        $log = VoidStudioAPI::getObjects('main')['ToolsPanel__LogList'];
88
+        $log->items->add('Проект скомпилирован по пути "'.$save.'". '.(($errorsCount = sizeof($errors)) > 0 ? ('Обнаружено '.$errorsCount.' ошибок') : 'Ошибок не обнаружено'));
89 89
 
90 90
         if ($errorsCount > 0)
91 91
         {
92
-            $log->items->addRange (array_map (function ($error)
92
+            $log->items->addRange(array_map(function($error)
93 93
             {
94
-                return "\t". $error;
94
+                return "\t".$error;
95 95
             }, $errors));
96 96
 
97
-            messageBox ('Обнаружено '. $errorsCount .' ошибок', 'Ошибка компиляции', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
97
+            messageBox('Обнаружено '.$errorsCount.' ошибок', 'Ошибка компиляции', enum('System.Windows.Forms.MessageBoxButtons.OK'), enum('System.Windows.Forms.MessageBoxIcon.Error'));
98 98
         }
99 99
 
100 100
         elseif ($printSuccessCompile)
101
-            messageBox ('Проект успешно скомпилирован', 'Успешная компиляция', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Information'));
101
+            messageBox('Проект успешно скомпилирован', 'Успешная компиляция', enum('System.Windows.Forms.MessageBoxButtons.OK'), enum('System.Windows.Forms.MessageBoxIcon.Information'));
102 102
 
103 103
         return $errors;
104 104
     }
105 105
 
106
-    public static function appendDesignerData (string $code, VoidDesigner $designer): string
106
+    public static function appendDesignerData(string $code, VoidDesigner $designer): string
107 107
     {
108 108
         $offset = 0;
109 109
 
110
-        while (($pos = strpos ($code, ')(resources.GetObject("', $offset)) !== false)
110
+        while (($pos = strpos($code, ')(resources.GetObject("', $offset)) !== false)
111 111
         {
112 112
             $offset   = $pos + 23;
113
-            $property = explode ('.', substr ($code, $offset, ($end = strpos ($code, '")));', $offset)) - $offset));
113
+            $property = explode('.', substr($code, $offset, ($end = strpos($code, '")));', $offset)) - $offset));
114 114
 
115 115
             $object = $property[0] == '$this' ?
116
-                $designer->form->selector :
117
-                $designer->getComponentByName ($property[0]);
116
+                $designer->form->selector : $designer->getComponentByName($property[0]);
118 117
 
119
-            foreach (array_slice ($property, 1) as $path)
120
-                $object = VoidEngine::getProperty ($object, $path);
118
+            foreach (array_slice($property, 1) as $path)
119
+                $object = VoidEngine::getProperty($object, $path);
121 120
 
122
-            $code = str_replace (substr ($code, $pos + 2, $end - $pos), 'WinForms_PHP.ZendProgram.getResource ("'. VoidEngine::exportObject ($object) .'")', $code);
121
+            $code = str_replace(substr($code, $pos + 2, $end - $pos), 'WinForms_PHP.ZendProgram.getResource ("'.VoidEngine::exportObject($object).'")', $code);
123 122
         }
124 123
 
125 124
         return $code;
126 125
     }
127 126
 
128
-    public static function generateCode (array $references, bool $removeNamespaces = true): string
127
+    public static function generateCode(array $references, bool $removeNamespaces = true): string
129 128
     {
130
-        return Builder::generateCode ($references, $removeNamespaces);
129
+        return Builder::generateCode($references, $removeNamespaces);
131 130
     }
132 131
 
133
-    public static function getReferences (string $file, bool $parseExtensions = true): array
132
+    public static function getReferences(string $file, bool $parseExtensions = true): array
134 133
     {
135
-        return Builder::getReferences ($file, $parseExtensions);
134
+        return Builder::getReferences($file, $parseExtensions);
136 135
     }
137 136
 }
Please login to merge, or discard this patch.
Braces   +26 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,9 +13,10 @@  discard block
 block discarded – undo
13 13
         $eventsCode = '';
14 14
         $forms      = [];
15 15
 
16
-        for ($i = 0; $i < 5; ++$i)
17
-            if (!isset ($settings[$i]) || !strlen (trim ($settings[$i])))
18
-                $settings[$i] = null;
16
+        for ($i = 0; $i < 5; ++$i) {
17
+                    if (!isset ($settings[$i]) || !strlen (trim ($settings[$i])))
18
+                $settings[$i] = null;
19
+        }
19 20
 
20 21
         $settings = array_slice ($settings, 0, 5);
21 22
 
@@ -30,9 +31,10 @@  discard block
 block discarded – undo
30 31
             {
31 32
                 $eventsCode .= VoidStudioAPI::$events[$item] ."\n\n";
32 33
 
33
-                foreach ($designer->objects as $name => $objectType)
34
-                    foreach ($designer->getComponentEvents ($designer->getComponentByName ($name))->list as $event)
35
-                        $eventsCode .= 'Events::setObjectEvent ($GLOBALS[\'__underConstruction\'][\''. $item .'\'][\''. $name .'\'], \''. $event->eventDescriptor->Name .'\', \'VoidEngine\\'. $item .'::'. $event->methodName .'\');';
34
+                foreach ($designer->objects as $name => $objectType) {
35
+                                    foreach ($designer->getComponentEvents ($designer->getComponentByName ($name))->list as $event)
36
+                        $eventsCode .= 'Events::setObjectEvent ($GLOBALS[\'__underConstruction\'][\''. $item .'\'][\''. $name .'\'], \''. $event->eventDescriptor->Name .'\', \'VoidEngine\\'. $item .'::'. $event->methodName .'\');';
37
+                }
36 38
             }
37 39
         }
38 40
 
@@ -49,14 +51,17 @@  discard block
 block discarded – undo
49 51
             {
50 52
                 $module = trim (file_get_contents ($module));
51 53
     
52
-                if (substr ($module, 0, 2) == '<?')
53
-                    $module = substr ($module, 2);
54
+                if (substr ($module, 0, 2) == '<?') {
55
+                                    $module = substr ($module, 2);
56
+                }
54 57
     
55
-                if (substr ($module, 0, 3) == 'php')
56
-                    $module = substr ($module, 3);
58
+                if (substr ($module, 0, 3) == 'php') {
59
+                                    $module = substr ($module, 3);
60
+                }
57 61
     
58
-                if (substr ($module, -2) == '?>')
59
-                    $module = substr ($module, 0, -2);
62
+                if (substr ($module, -2) == '?>') {
63
+                                    $module = substr ($module, 0, -2);
64
+                }
60 65
     
61 66
                 return "\$module = <<<'__MODULE'\n\n$module\n\n__MODULE;\n\neval (\$module);";
62 67
             }, array_merge (glob (VoidStudioProjectManager::$projectPath .'/modules/*.php'), $debug ? [APP_DIR .'/system/debug/DebugHook.php'] : []))),
@@ -74,8 +79,9 @@  discard block
 block discarded – undo
74 79
 
75 80
             $manager = new \Qero\PackagesManager\PackagesManager;
76 81
 
77
-            foreach ($modules as $package)
78
-                $manager->installPackage ($package);
82
+            foreach ($modules as $package) {
83
+                            $manager->installPackage ($package);
84
+            }
79 85
 
80 86
             dir_copy (APP_DIR .'/Qero/qero-packages', $savePath .'/qero-packages');
81 87
             dir_delete (APP_DIR .'/Qero/qero-packages');
@@ -95,10 +101,9 @@  discard block
 block discarded – undo
95 101
             }, $errors));
96 102
 
97 103
             messageBox ('Обнаружено '. $errorsCount .' ошибок', 'Ошибка компиляции', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
98
-        }
99
-
100
-        elseif ($printSuccessCompile)
101
-            messageBox ('Проект успешно скомпилирован', 'Успешная компиляция', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Information'));
104
+        } elseif ($printSuccessCompile) {
105
+                    messageBox ('Проект успешно скомпилирован', 'Успешная компиляция', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Information'));
106
+        }
102 107
 
103 108
         return $errors;
104 109
     }
@@ -116,8 +121,9 @@  discard block
 block discarded – undo
116 121
                 $designer->form->selector :
117 122
                 $designer->getComponentByName ($property[0]);
118 123
 
119
-            foreach (array_slice ($property, 1) as $path)
120
-                $object = VoidEngine::getProperty ($object, $path);
124
+            foreach (array_slice ($property, 1) as $path) {
125
+                            $object = VoidEngine::getProperty ($object, $path);
126
+            }
121 127
 
122 128
             $code = str_replace (substr ($code, $pos + 2, $end - $pos), 'WinForms_PHP.ZendProgram.getResource ("'. VoidEngine::exportObject ($object) .'")', $code);
123 129
         }
Please login to merge, or discard this patch.