Passed
Push — master ( ec54f3...451c11 )
by Observer
01:22
created
engine/components/Process.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,28 +4,28 @@
 block discarded – undo
4 4
 
5 5
 class Process extends Component
6 6
 {
7
-	public $class 	  = 'System.Diagnostics.Process';
8
-	public $namespace = 'System';
7
+    public $class 	  = 'System.Diagnostics.Process';
8
+    public $namespace = 'System';
9 9
 
10
-	public function __construct (int $pid = null)
11
-	{
10
+    public function __construct (int $pid = null)
11
+    {
12 12
         $this->selector = VoidEngine::createClass ($this->class, $this->namespace);
13 13
 
14
-		if ($pid !== null)
14
+        if ($pid !== null)
15 15
             $this->selector = $pid == getmypid () ?
16 16
                 VoidEngine::callMethod ($this->selector, 'GetCurrentProcess') :
17 17
                 VoidEngine::callMethod ($this->selector, 'GetProcessById', $pid);
18 18
 
19
-		Components::addComponent ($this->selector, $this);
20
-	}
19
+        Components::addComponent ($this->selector, $this);
20
+    }
21 21
 	
22
-	public static function getProcessById (int $pid)
23
-	{
24
-		return new self ($pid);
25
-	}
22
+    public static function getProcessById (int $pid)
23
+    {
24
+        return new self ($pid);
25
+    }
26 26
 	
27
-	public static function getCurrentProcess ()
28
-	{
29
-		return new self (getmypid ());
30
-	}
27
+    public static function getCurrentProcess ()
28
+    {
29
+        return new self (getmypid ());
30
+    }
31 31
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,28 +4,27 @@
 block discarded – undo
4 4
 
5 5
 class Process extends Component
6 6
 {
7
-	public $class 	  = 'System.Diagnostics.Process';
7
+	public $class = 'System.Diagnostics.Process';
8 8
 	public $namespace = 'System';
9 9
 
10
-	public function __construct (int $pid = null)
10
+	public function __construct(int $pid = null)
11 11
 	{
12
-        $this->selector = VoidEngine::createClass ($this->class, $this->namespace);
12
+        $this->selector = VoidEngine::createClass($this->class, $this->namespace);
13 13
 
14 14
 		if ($pid !== null)
15
-            $this->selector = $pid == getmypid () ?
16
-                VoidEngine::callMethod ($this->selector, 'GetCurrentProcess') :
17
-                VoidEngine::callMethod ($this->selector, 'GetProcessById', $pid);
15
+            $this->selector = $pid == getmypid() ?
16
+                VoidEngine::callMethod($this->selector, 'GetCurrentProcess') : VoidEngine::callMethod($this->selector, 'GetProcessById', $pid);
18 17
 
19
-		Components::addComponent ($this->selector, $this);
18
+		Components::addComponent($this->selector, $this);
20 19
 	}
21 20
 	
22
-	public static function getProcessById (int $pid)
21
+	public static function getProcessById(int $pid)
23 22
 	{
24
-		return new self ($pid);
23
+		return new self($pid);
25 24
 	}
26 25
 	
27
-	public static function getCurrentProcess ()
26
+	public static function getCurrentProcess()
28 27
 	{
29
-		return new self (getmypid ());
28
+		return new self(getmypid());
30 29
 	}
31 30
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,11 @@
 block discarded – undo
11 11
 	{
12 12
         $this->selector = VoidEngine::createClass ($this->class, $this->namespace);
13 13
 
14
-		if ($pid !== null)
15
-            $this->selector = $pid == getmypid () ?
14
+		if ($pid !== null) {
15
+		            $this->selector = $pid == getmypid () ?
16 16
                 VoidEngine::callMethod ($this->selector, 'GetCurrentProcess') :
17 17
                 VoidEngine::callMethod ($this->selector, 'GetProcessById', $pid);
18
+		}
18 19
 
19 20
 		Components::addComponent ($this->selector, $this);
20 21
 	}
Please login to merge, or discard this patch.
engine/VoidEngine.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,8 @@
 block discarded – undo
105 105
 require 'components/FastColoredTextBox.php';
106 106
 require 'components/Scintilla.php';
107 107
 
108
-if (is_dir ('extensions'))
108
+if (is_dir ('extensions')) {
109 109
     foreach (scandir ('extensions') as $ext)
110 110
         if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php'))
111 111
             require $ext;
112
+}
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 const ENGINE_VERSION = '3.4.1 build-2019/09/07';
37 37
 const ENGINE_DIR = __DIR__;
38 38
 
39
-chdir (ENGINE_DIR);
39
+chdir(ENGINE_DIR);
40 40
 
41 41
 $GLOBALS['error_status'] = true;
42 42
 
43 43
 $GLOBALS['__debug'] = [
44
-    'start_time' => microtime (true)
44
+    'start_time' => microtime(true)
45 45
 ];
46 46
 
47
-$GLOBALS['__ub_write_handler'] = function (...$args)
47
+$GLOBALS['__ub_write_handler'] = function(...$args)
48 48
 {
49
-    pre (...$args);
49
+    pre(...$args);
50 50
 };
51 51
 
52 52
 require 'common/EngineInterfaces.php';
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 require 'common/Others.php';
56 56
 require 'common/Events.php';
57 57
 
58
-define ('VoidEngine\CORE_VERSION', $APPLICATION->productVersion);
58
+define('VoidEngine\CORE_VERSION', $APPLICATION->productVersion);
59 59
 
60 60
 require 'components/Component.php';
61 61
 require 'components/Control.php';
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 require 'components/FastColoredTextBox.php';
105 105
 require 'components/Scintilla.php';
106 106
 
107
-if (is_dir ('extensions'))
108
-    foreach (scandir ('extensions') as $ext)
109
-        if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php'))
107
+if (is_dir('extensions'))
108
+    foreach (scandir('extensions') as $ext)
109
+        if (is_dir('extensions/'.$ext) && file_exists($ext = 'extensions/'.$ext.'/main.php'))
110 110
             require $ext;
Please login to merge, or discard this patch.
engine/common/EngineInterfaces.php 3 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
     }
109 109
 
110 110
     /**
111
-    * * Создание экземпляра типа объекта
112
-    * 
113
-    * @param mixed $objectName - полное название объекта
114
-    * [@param mixed $objectGroup = null] - полное пространство имён объекта
115
-    * 
116
-    * @return mixed - возвращает указатель на объект типа объекта или false в случае ошибки
117
-    * 
118
-    */
111
+     * * Создание экземпляра типа объекта
112
+     * 
113
+     * @param mixed $objectName - полное название объекта
114
+     * [@param mixed $objectGroup = null] - полное пространство имён объекта
115
+     * 
116
+     * @return mixed - возвращает указатель на объект типа объекта или false в случае ошибки
117
+     * 
118
+     */
119 119
 
120 120
     public static function objectType ($objectName, $objectGroup = null)
121 121
     {
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     }
551 551
     
552 552
     public function __get ($name)
553
-	{
553
+    {
554 554
         if (method_exists ($this, $method = "get_$name"))
555 555
             $value = $this->$method ();
556 556
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
                 $size = $this->count;
580 580
                 $list = [];
581 581
                 
582
-				for ($i = 0; $i < $size; ++$i)
582
+                for ($i = 0; $i < $size; ++$i)
583 583
                     $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
584 584
                 
585 585
                 return $list;
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
         }
610 610
 
611 611
         return EngineAdditions::coupleSelector ($value, $this->selector);
612
-	}
612
+    }
613 613
 	
614
-	public function __set ($name, $value)
615
-	{
614
+    public function __set ($name, $value)
615
+    {
616 616
         if (method_exists ($this, $method = "set_$name"))
617 617
             try
618 618
             {
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
         else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
635 635
     }
636 636
 	
637
-	public function __call ($method, $args)
638
-	{
637
+    public function __call ($method, $args)
638
+    {
639 639
         $args = array_map (function ($arg)
640 640
         {
641 641
             return EngineAdditions::uncoupleSelector ($arg);
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
     }
652 652
     
653 653
     public function offsetSet ($index, $value)
654
-	{
654
+    {
655 655
         try
656 656
         {
657 657
             return $index === null ?
@@ -667,14 +667,14 @@  discard block
 block discarded – undo
667 667
         }
668 668
     }
669 669
 	
670
-	public function offsetGet ($index)
671
-	{
672
-		return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector);
670
+    public function offsetGet ($index)
671
+    {
672
+        return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector);
673 673
     }
674 674
 	
675
-	public function offsetUnset ($index): void
676
-	{
677
-		$this->callMethod ('RemoveAt', $index);
675
+    public function offsetUnset ($index): void
676
+    {
677
+        $this->callMethod ('RemoveAt', $index);
678 678
     }
679 679
     
680 680
     public function offsetExists ($index): bool
@@ -692,19 +692,19 @@  discard block
 block discarded – undo
692 692
         return true;
693 693
     }
694 694
 	
695
-	public function indexOf ($value): int
696
-	{
697
-		return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
695
+    public function indexOf ($value): int
696
+    {
697
+        return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
698 698
     }
699 699
     
700 700
     public function lastIndexOf ($value): int
701
-	{
702
-		return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
703
-	}
701
+    {
702
+        return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
703
+    }
704 704
 	
705
-	public function contains ($value): bool
706
-	{
707
-		return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
705
+    public function contains ($value): bool
706
+    {
707
+        return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
708 708
     }
709 709
 
710 710
     public function foreach (callable $callback, string $type = null): void
@@ -758,45 +758,45 @@  discard block
 block discarded – undo
758 758
         return VoidEngine::callMethod ($this->selector, $method, ...$args);
759 759
     }
760 760
 	
761
-	protected function getArrayProperty ($name, string $type = null)
762
-	{
761
+    protected function getArrayProperty ($name, string $type = null)
762
+    {
763 763
         $array  = $this->getProperty ($name);
764 764
         $size   = VoidEngine::getProperty ($array, 'Length');
765 765
         $return = [];
766 766
 
767
-		for ($i = 0; $i < $size; ++$i)
767
+        for ($i = 0; $i < $size; ++$i)
768 768
             $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
769 769
         
770 770
         VoidEngine::removeObjects ($array);
771 771
         
772
-		return $return;
772
+        return $return;
773 773
     }
774 774
 
775 775
     public function get_name ()
776
-	{
777
-		try
778
-		{
779
-			return $this->getProperty ('Name');
776
+    {
777
+        try
778
+        {
779
+            return $this->getProperty ('Name');
780 780
         }
781 781
         
782
-		catch (\Throwable $e)
783
-		{
784
-			return $this->name;
785
-		}
786
-	}
782
+        catch (\Throwable $e)
783
+        {
784
+            return $this->name;
785
+        }
786
+    }
787 787
 	
788
-	public function set_name (string $name)
789
-	{
790
-		try
791
-		{
792
-			$this->setProperty ('Name', $name);
788
+    public function set_name (string $name)
789
+    {
790
+        try
791
+        {
792
+            $this->setProperty ('Name', $name);
793 793
         }
794 794
         
795
-		catch (\Throwable $e)
796
-		{
797
-			$this->name = $name;
798
-		}
799
-	}
795
+        catch (\Throwable $e)
796
+        {
797
+            $this->name = $name;
798
+        }
799
+    }
800 800
 
801 801
     public function __toString (): string
802 802
     {
Please login to merge, or discard this patch.
Spacing   +140 added lines, -142 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
      * 
18 18
      */
19 19
 
20
-    public static function createObject ($objectName, $objectGroup = null, ...$args): int
20
+    public static function createObject($objectName, $objectGroup = null, ...$args): int
21 21
     {
22
-        return \VoidCore::createObject ($objectName, $objectGroup, ...$args);
22
+        return \VoidCore::createObject($objectName, $objectGroup, ...$args);
23 23
     }
24 24
 
25 25
     /**
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
      * 
35 35
      */
36 36
 
37
-    public static function removeObjects (int ...$selectors): void
37
+    public static function removeObjects(int ...$selectors): void
38 38
     {
39
-        \VoidCore::removeObjects (...$selectors);
39
+        \VoidCore::removeObjects(...$selectors);
40 40
     }
41 41
 
42 42
     /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
      * 
52 52
      */
53 53
 
54
-    public static function destructObject (int $selector): bool
54
+    public static function destructObject(int $selector): bool
55 55
     {
56
-        return \VoidCore::destructObject ($selector);
56
+        return \VoidCore::destructObject($selector);
57 57
     }
58 58
 
59 59
     /**
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
      * 
69 69
      */
70 70
 
71
-    public static function createClass ($className, $classGroup = null): int
71
+    public static function createClass($className, $classGroup = null): int
72 72
     {
73
-        return \VoidCore::getClass ($className, $classGroup);
73
+        return \VoidCore::getClass($className, $classGroup);
74 74
     }
75 75
 
76 76
     /**
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
      * 
84 84
      */
85 85
 
86
-    public static function createDelegate (string $type, string $code): int
86
+    public static function createDelegate(string $type, string $code): int
87 87
     {
88
-        return \VoidCore::createDelegate ($type, $code);
88
+        return \VoidCore::createDelegate($type, $code);
89 89
     }
90 90
 
91 91
     /**
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
      * 
103 103
      */
104 104
 
105
-    public static function objectExists (int $selector): bool
105
+    public static function objectExists(int $selector): bool
106 106
     {
107
-        return \VoidCore::objectExists ($selector);
107
+        return \VoidCore::objectExists($selector);
108 108
     }
109 109
 
110 110
     /**
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     * 
118 118
     */
119 119
 
120
-    public static function objectType ($objectName, $objectGroup = null)
120
+    public static function objectType($objectName, $objectGroup = null)
121 121
     {
122
-        return \VoidCore::typeof ($objectName, $objectGroup);
122
+        return \VoidCore::typeof($objectName, $objectGroup);
123 123
     }
124 124
 
125 125
     /**
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
      * 
141 141
      */
142 142
 
143
-    public static function getProperty (int $selector, $propertyName)
143
+    public static function getProperty(int $selector, $propertyName)
144 144
     {
145
-        return \VoidCore::getProp ($selector, $propertyName);
145
+        return \VoidCore::getProp($selector, $propertyName);
146 146
     }
147 147
 
148 148
     /**
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
      * 
163 163
      */
164 164
 
165
-    public static function setProperty (int $selector, string $propertyName, $value): void
165
+    public static function setProperty(int $selector, string $propertyName, $value): void
166 166
     {
167
-        \VoidCore::setProp ($selector, $propertyName, $value);
167
+        \VoidCore::setProp($selector, $propertyName, $value);
168 168
     }
169 169
 
170 170
     /**
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
      * 
185 185
      */
186 186
 
187
-    public static function getField (int $selector, $fieldName)
187
+    public static function getField(int $selector, $fieldName)
188 188
     {
189
-        return \VoidCore::getField ($selector, $fieldName);
189
+        return \VoidCore::getField($selector, $fieldName);
190 190
     }
191 191
 
192 192
     /**
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
      * 
202 202
      */
203 203
 
204
-    public static function setField (int $selector, string $fieldName, $value): void
204
+    public static function setField(int $selector, string $fieldName, $value): void
205 205
     {
206
-        \VoidCore::setField ($selector, $fieldName, $value);
206
+        \VoidCore::setField($selector, $fieldName, $value);
207 207
     }
208 208
 
209 209
     /**
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
      * 
228 228
      */
229 229
 
230
-    public static function callMethod (int $selector, $methodName, ...$args)
230
+    public static function callMethod(int $selector, $methodName, ...$args)
231 231
     {
232
-        return \VoidCore::callMethod ($selector, $methodName, ...$args);
232
+        return \VoidCore::callMethod($selector, $methodName, ...$args);
233 233
     }
234 234
 
235 235
     /**
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
      * 
246 246
      */
247 247
 
248
-    public static function getArrayValue (int $selector, $index)
248
+    public static function getArrayValue(int $selector, $index)
249 249
     {
250
-        return \VoidCore::getArrayValue ($selector, $index);
250
+        return \VoidCore::getArrayValue($selector, $index);
251 251
     }
252 252
 
253 253
     /**
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
      * 
266 266
      */
267 267
 
268
-    public static function setArrayValue (int $selector, $index, $value): void
268
+    public static function setArrayValue(int $selector, $index, $value): void
269 269
     {
270
-        \VoidCore::setArrayValue ($selector, $index, $value);
270
+        \VoidCore::setArrayValue($selector, $index, $value);
271 271
     }
272 272
 
273 273
     /**
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
      * 
283 283
      */
284 284
 
285
-    public static function setObjectEvent (int $selector, string $eventName, callable $event): void
285
+    public static function setObjectEvent(int $selector, string $eventName, callable $event): void
286 286
     {
287 287
         /*if (self::eventExists ($selector, $eventName))
288 288
             self::removeObjectEvent ($selector, $eventName);*/
289 289
 
290
-        \VoidCore::setEvent ($selector, $eventName, $event);
290
+        \VoidCore::setEvent($selector, $eventName, $event);
291 291
     }
292 292
 
293 293
     /**
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
      * 
306 306
      */
307 307
 
308
-    public static function eventExists (int $selector, string $eventName): bool
308
+    public static function eventExists(int $selector, string $eventName): bool
309 309
     {
310
-        return \VoidCore::eventExists ($selector, $eventName);
310
+        return \VoidCore::eventExists($selector, $eventName);
311 311
     }
312 312
 
313 313
     /**
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
      * 
325 325
      */
326 326
 
327
-    public static function removeObjectEvent (int $selector, string $eventName): void
327
+    public static function removeObjectEvent(int $selector, string $eventName): void
328 328
     {
329
-        \VoidCore::removeEvent ($selector, $eventName);
329
+        \VoidCore::removeEvent($selector, $eventName);
330 330
     }
331 331
 
332 332
     /**
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
      * 
339 339
      */
340 340
 
341
-    public static function importObject (string $data): int
341
+    public static function importObject(string $data): int
342 342
     {
343
-        return \VoidCore::importObject ($data);
343
+        return \VoidCore::importObject($data);
344 344
     }
345 345
 
346 346
     /**
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
      * 
353 353
      */
354 354
 
355
-    public static function exportObject (int $selector): string
355
+    public static function exportObject(int $selector): string
356 356
     {
357
-        return \VoidCore::exportObject ($selector);
357
+        return \VoidCore::exportObject($selector);
358 358
     }
359 359
 
360 360
     /**
@@ -378,20 +378,20 @@  discard block
 block discarded – undo
378 378
      * 
379 379
      */
380 380
 
381
-    public static function compile (string $savePath, string $iconPath, string $phpCode, string $productDescription = null, string $productName = null, string $productVersion = null, string $companyName = null, string $copyright = null, string $callSharpCode = '', string $declareSharpCode = '', WFObject $dictionary = null, WFObject $assemblies = null): array
381
+    public static function compile(string $savePath, string $iconPath, string $phpCode, string $productDescription = null, string $productName = null, string $productVersion = null, string $companyName = null, string $copyright = null, string $callSharpCode = '', string $declareSharpCode = '', WFObject $dictionary = null, WFObject $assemblies = null): array
382 382
     {
383 383
         if ($dictionary === null)
384
-            $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
384
+            $dictionary = new WFObject('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
385 385
 
386 386
         if ($assemblies === null)
387
-            $assemblies = getNetArray ('System.String', [
387
+            $assemblies = getNetArray('System.String', [
388 388
                 // CORE_DIR .'/CefSharp.dll',
389
-                CORE_DIR .'/FastColoredTextBox.dll',
390
-                CORE_DIR .'/ScintillaNET.dll'
389
+                CORE_DIR.'/FastColoredTextBox.dll',
390
+                CORE_DIR.'/ScintillaNET.dll'
391 391
             ]);
392 392
 
393 393
         if ($productName === null)
394
-            $productName = basenameNoExt ($savePath);
394
+            $productName = basenameNoExt($savePath);
395 395
 
396 396
         if ($productDescription === null)
397 397
             $productDescription = $productName;
@@ -403,19 +403,19 @@  discard block
 block discarded – undo
403 403
             $companyName = 'Company N';
404 404
 
405 405
         if ($copyright === null)
406
-            $copyright = $companyName .' copyright (c) '. date ('Y');
406
+            $copyright = $companyName.' copyright (c) '.date('Y');
407 407
 
408
-        return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
408
+        return (new WFClass('WinForms_PHP.WFCompiler', null))->compile($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
409 409
     }
410 410
 }
411 411
 
412 412
 class EngineAdditions
413 413
 {
414
-    public static function loadModule (string $path): bool
414
+    public static function loadModule(string $path): bool
415 415
     {
416 416
         try
417 417
         {
418
-            (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
418
+            (new WFClass('System.Reflection.Assembly', 'mscorlib'))->loadFrom($path);
419 419
         }
420 420
 
421 421
         catch (\Throwable $e)
@@ -426,16 +426,16 @@  discard block
 block discarded – undo
426 426
         return true;
427 427
     }
428 428
 
429
-    public static function getProperty (int $selector, string $name): array
429
+    public static function getProperty(int $selector, string $name): array
430 430
     {
431
-        $property = VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'GetProperty', $name);
431
+        $property = VoidEngine::callMethod(VoidEngine::callMethod($selector, 'GetType'), 'GetProperty', $name);
432 432
 
433
-        if (!is_int ($property))
433
+        if (!is_int($property))
434 434
             return false;
435 435
 
436 436
         try
437 437
         {
438
-            $propertyType = VoidEngine::getProperty ($property, ['PropertyType', 'string']);
438
+            $propertyType = VoidEngine::getProperty($property, ['PropertyType', 'string']);
439 439
 
440 440
             switch ($propertyType)
441 441
             {
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
                 default:
472 472
                     try
473 473
                     {
474
-                        VoidEngine::getProperty ($selector, [$name, 'int']);
474
+                        VoidEngine::getProperty($selector, [$name, 'int']);
475 475
 
476 476
                         $property = 'int';
477 477
                     }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                     {
481 481
                         return [
482 482
                             'type'  => 'vrsf',
483
-                            'value' => VoidEngine::exportObject (VoidEngine::getProperty ($selector, [$name, 'object']))
483
+                            'value' => VoidEngine::exportObject(VoidEngine::getProperty($selector, [$name, 'object']))
484 484
                         ];
485 485
                     }
486 486
                 break;
@@ -494,19 +494,19 @@  discard block
 block discarded – undo
494 494
 
495 495
         return [
496 496
             'type'  => $property,
497
-            'value' => VoidEngine::getProperty ($selector, [$name, $property])
497
+            'value' => VoidEngine::getProperty($selector, [$name, $property])
498 498
         ];
499 499
     }
500 500
 
501
-    public static function getObjectEvents (int $object): array
501
+    public static function getObjectEvents(int $object): array
502 502
     {
503 503
         $events = [];
504 504
 
505
-        $props = VoidEngine::callMethod (VoidEngine::callMethod ($object, 'GetType'), 'GetEvents');
506
-        $len   = VoidEngine::getProperty ($props, 'Length');
505
+        $props = VoidEngine::callMethod(VoidEngine::callMethod($object, 'GetType'), 'GetEvents');
506
+        $len   = VoidEngine::getProperty($props, 'Length');
507 507
 
508 508
         for ($i = 0; $i < $len; ++$i)
509
-            $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
509
+            $events[] = VoidEngine::getProperty(VoidEngine::getArrayValue($props, $i), 'Name');
510 510
 
511 511
         return $events;
512 512
     }
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
      * Тогда получается бесконечный цикл вида object->selector->selector->selector->...
517 517
      * Чтобы этого избежать нужно добавить исключение - переменную $selfSelector
518 518
      */
519
-    public static function coupleSelector ($value, int $selfSelector = null)
519
+    public static function coupleSelector($value, int $selfSelector = null)
520 520
     {
521
-        return is_int ($value) && VoidEngine::objectExists ($value) && $value != $selfSelector ?
522
-            new WFObject ($value) : $value;
521
+        return is_int($value) && VoidEngine::objectExists($value) && $value != $selfSelector ?
522
+            new WFObject($value) : $value;
523 523
     }
524 524
 
525
-    public static function uncoupleSelector ($value)
525
+    public static function uncoupleSelector($value)
526 526
     {
527 527
         return $value instanceof WFObject ?
528 528
             $value->selector : $value;
@@ -534,44 +534,44 @@  discard block
 block discarded – undo
534 534
     protected $selector;
535 535
     protected $name;
536 536
 
537
-    public function __construct ($object, ?string $classGroup = 'auto', ...$args)
537
+    public function __construct($object, ?string $classGroup = 'auto', ...$args)
538 538
     {
539 539
         foreach ($args as $id => $arg)
540
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
540
+            $args[$id] = EngineAdditions::uncoupleSelector($arg);
541 541
 
542
-        if (is_string ($object))
543
-            $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ?
544
-                substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args);
542
+        if (is_string($object))
543
+            $this->selector = VoidEngine::createObject($object, $classGroup == 'auto' ?
544
+                substr ($object, 0, strrpos($object, '.')) : $classGroup, ...$args);
545 545
 
546
-        elseif (is_int ($object) && VoidEngine::objectExists ($object))
546
+        elseif (is_int($object) && VoidEngine::objectExists($object))
547 547
             $this->selector = $object;
548 548
 
549
-        else throw new \Exception ('$object parameter must be string or object selector');
549
+        else throw new \Exception('$object parameter must be string or object selector');
550 550
     }
551 551
     
552
-    public function __get ($name)
552
+    public function __get($name)
553 553
 	{
554
-        if (method_exists ($this, $method = "get_$name"))
555
-            $value = $this->$method ();
554
+        if (method_exists($this, $method = "get_$name"))
555
+            $value = $this->$method();
556 556
 
557
-        elseif (substr ($name, -5) == 'Event')
558
-            $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
557
+        elseif (substr($name, -5) == 'Event')
558
+            $value = Events::getObjectEvent($this->selector, substr($name, 0, -5));
559 559
 
560
-        elseif (property_exists ($this, $name))
560
+        elseif (property_exists($this, $name))
561 561
             $value = $this->$name;
562 562
 
563
-        else switch (strtolower ($name))
563
+        else switch (strtolower($name))
564 564
         {
565 565
             case 'count':
566 566
             case 'length':
567 567
                 try
568 568
                 {
569
-                    return $this->getProperty ('Count');
569
+                    return $this->getProperty('Count');
570 570
                 }
571 571
 
572 572
                 catch (\Throwable $e)
573 573
                 {
574
-                    return $this->getProperty ('Length');
574
+                    return $this->getProperty('Length');
575 575
                 }
576 576
             break;
577 577
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
                 $list = [];
581 581
                 
582 582
 				for ($i = 0; $i < $size; ++$i)
583
-                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
583
+                    $list[] = EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $i));
584 584
                 
585 585
                 return $list;
586 586
             break;
@@ -592,31 +592,31 @@  discard block
 block discarded – undo
592 592
                 for ($i = 0; $i < $size; ++$i)
593 593
                     try
594 594
                     {
595
-                        $names[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($this->selector, [$i, 'object']), 'Text');
595
+                        $names[] = VoidEngine::getProperty(VoidEngine::getArrayValue($this->selector, [$i, 'object']), 'Text');
596 596
                     }
597 597
 
598 598
                     catch (\Throwable $e)
599 599
                     {
600
-                        $names[] = VoidEngine::getArrayValue ($this->selector, [$i, 'string']);
600
+                        $names[] = VoidEngine::getArrayValue($this->selector, [$i, 'string']);
601 601
                     }
602 602
                 
603 603
                 return $names;
604 604
             break;
605 605
 
606 606
             default:
607
-                $value = $this->getProperty ($name);
607
+                $value = $this->getProperty($name);
608 608
             break;
609 609
         }
610 610
 
611
-        return EngineAdditions::coupleSelector ($value, $this->selector);
611
+        return EngineAdditions::coupleSelector($value, $this->selector);
612 612
 	}
613 613
 	
614
-	public function __set ($name, $value)
614
+	public function __set($name, $value)
615 615
 	{
616
-        if (method_exists ($this, $method = "set_$name"))
616
+        if (method_exists($this, $method = "set_$name"))
617 617
             try
618 618
             {
619
-                return $this->$method ($value);
619
+                return $this->$method($value);
620 620
             }
621 621
 
622 622
             # Метод "set_$name" может принимать в качестве параметра объект WFObject
@@ -625,63 +625,61 @@  discard block
 block discarded – undo
625 625
             catch (\Throwable $e)
626 626
             {
627 627
                 return $value instanceof WFObject ?
628
-                    $this->$method ($value->selector) : null;
628
+                    $this->$method($value->selector) : null;
629 629
             }
630 630
 
631
-        elseif (substr ($name, -5) == 'Event')
632
-            Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
631
+        elseif (substr($name, -5) == 'Event')
632
+            Events::setObjectEvent($this->selector, substr($name, 0, -5), $value);
633 633
         
634
-        else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
634
+        else $this->setProperty($name, EngineAdditions::uncoupleSelector($value));
635 635
     }
636 636
 	
637
-	public function __call ($method, $args)
637
+	public function __call($method, $args)
638 638
 	{
639
-        $args = array_map (function ($arg)
639
+        $args = array_map(function($arg)
640 640
         {
641
-            return EngineAdditions::uncoupleSelector ($arg);
641
+            return EngineAdditions::uncoupleSelector($arg);
642 642
         }, $args);
643 643
 
644
-        return EngineAdditions::coupleSelector ($this->callMethod ($method, ...$args), $this->selector);
644
+        return EngineAdditions::coupleSelector($this->callMethod($method, ...$args), $this->selector);
645 645
     }
646 646
 
647
-    public function addRange (array $values, $assoc = false): void
647
+    public function addRange(array $values, $assoc = false): void
648 648
     {
649 649
         foreach ($values as $id => $value)
650
-            $this->offsetSet ($assoc ? $id : null, $value);
650
+            $this->offsetSet($assoc ? $id : null, $value);
651 651
     }
652 652
     
653
-    public function offsetSet ($index, $value)
653
+    public function offsetSet($index, $value)
654 654
 	{
655 655
         try
656 656
         {
657 657
             return $index === null ?
658
-                $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
659
-                $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
658
+                $this->callMethod('Add', EngineAdditions::uncoupleSelector($value)) : $this->callMethod('Insert', $index, EngineAdditions::uncoupleSelector($value));
660 659
         }
661 660
 
662 661
         catch (\Throwable $e)
663 662
         {
664 663
             return $index === null ?
665
-                VoidEngine::setArrayValue ($this->selector, $this->count, $value) :
666
-                VoidEngine::setArrayValue ($this->selector, $index, $value);
664
+                VoidEngine::setArrayValue($this->selector, $this->count, $value) : VoidEngine::setArrayValue($this->selector, $index, $value);
667 665
         }
668 666
     }
669 667
 	
670
-	public function offsetGet ($index)
668
+	public function offsetGet($index)
671 669
 	{
672
-		return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector);
670
+		return EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $index), $this->selector);
673 671
     }
674 672
 	
675
-	public function offsetUnset ($index): void
673
+	public function offsetUnset($index): void
676 674
 	{
677
-		$this->callMethod ('RemoveAt', $index);
675
+		$this->callMethod('RemoveAt', $index);
678 676
     }
679 677
     
680
-    public function offsetExists ($index): bool
678
+    public function offsetExists($index): bool
681 679
     {
682 680
         try
683 681
         {
684
-            $this->offsetGet ($index);
682
+            $this->offsetGet($index);
685 683
         }
686 684
 
687 685
         catch (\Exception $e)
@@ -692,19 +690,19 @@  discard block
 block discarded – undo
692 690
         return true;
693 691
     }
694 692
 	
695
-	public function indexOf ($value): int
693
+	public function indexOf($value): int
696 694
 	{
697
-		return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
695
+		return $this->callMethod('IndexOf', EngineAdditions::uncoupleSelector($value));
698 696
     }
699 697
     
700
-    public function lastIndexOf ($value): int
698
+    public function lastIndexOf($value): int
701 699
 	{
702
-		return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
700
+		return $this->callMethod('LastIndexOf', EngineAdditions::uncoupleSelector($value));
703 701
 	}
704 702
 	
705
-	public function contains ($value): bool
703
+	public function contains($value): bool
706 704
 	{
707
-		return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
705
+		return $this->callMethod('Contains', EngineAdditions::uncoupleSelector($value));
708 706
     }
709 707
 
710 708
     public function foreach (callable $callback, string $type = null): void
@@ -712,71 +710,71 @@  discard block
 block discarded – undo
712 710
         $size = $this->count;
713 711
 
714 712
         for ($i = 0; $i < $size; ++$i)
715
-            $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
713
+            $callback(EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
716 714
     }
717 715
 
718
-    public function where (callable $comparator, string $type = null): array
716
+    public function where(callable $comparator, string $type = null): array
719 717
     {
720 718
         $size   = $this->count;
721 719
         $return = [];
722 720
 
723 721
         for ($i = 0; $i < $size; ++$i)
724
-            if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
722
+            if ($comparator($value = EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
725 723
                 $return[] = $value;
726 724
 
727 725
         return $return;
728 726
     }
729 727
 	
730
-    protected function getProperty ($name)
728
+    protected function getProperty($name)
731 729
     {
732 730
         try
733 731
         {
734
-            return VoidEngine::getProperty ($this->selector, $name);
732
+            return VoidEngine::getProperty($this->selector, $name);
735 733
         }
736 734
 
737 735
         catch (\Throwable $e)
738 736
         {
739
-            return VoidEngine::getField ($this->selector, $name);
737
+            return VoidEngine::getField($this->selector, $name);
740 738
         }
741 739
     }
742 740
 
743
-    protected function setProperty ($name, $value)
741
+    protected function setProperty($name, $value)
744 742
     {
745 743
         try
746 744
         {
747
-            VoidEngine::setProperty ($this->selector, $name, $value);
745
+            VoidEngine::setProperty($this->selector, $name, $value);
748 746
         }
749 747
 
750 748
         catch (\Throwable $e)
751 749
         {
752
-            VoidEngine::setField ($this->selector, $name, $value);
750
+            VoidEngine::setField($this->selector, $name, $value);
753 751
         }
754 752
     }
755 753
 	
756
-    protected function callMethod ($method, ...$args)
754
+    protected function callMethod($method, ...$args)
757 755
     {
758
-        return VoidEngine::callMethod ($this->selector, $method, ...$args);
756
+        return VoidEngine::callMethod($this->selector, $method, ...$args);
759 757
     }
760 758
 	
761
-	protected function getArrayProperty ($name, string $type = null)
759
+	protected function getArrayProperty($name, string $type = null)
762 760
 	{
763
-        $array  = $this->getProperty ($name);
764
-        $size   = VoidEngine::getProperty ($array, 'Length');
761
+        $array  = $this->getProperty($name);
762
+        $size   = VoidEngine::getProperty($array, 'Length');
765 763
         $return = [];
766 764
 
767 765
 		for ($i = 0; $i < $size; ++$i)
768
-            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
766
+            $return[] = VoidEngine::getArrayValue($array, $type === null ? $i : [$i, $type]);
769 767
         
770
-        VoidEngine::removeObjects ($array);
768
+        VoidEngine::removeObjects($array);
771 769
         
772 770
 		return $return;
773 771
     }
774 772
 
775
-    public function get_name ()
773
+    public function get_name()
776 774
 	{
777 775
 		try
778 776
 		{
779
-			return $this->getProperty ('Name');
777
+			return $this->getProperty('Name');
780 778
         }
781 779
         
782 780
 		catch (\Throwable $e)
@@ -785,11 +783,11 @@  discard block
 block discarded – undo
785 783
 		}
786 784
 	}
787 785
 	
788
-	public function set_name (string $name)
786
+	public function set_name(string $name)
789 787
 	{
790 788
 		try
791 789
 		{
792
-			$this->setProperty ('Name', $name);
790
+			$this->setProperty('Name', $name);
793 791
         }
794 792
         
795 793
 		catch (\Throwable $e)
@@ -798,9 +796,9 @@  discard block
 block discarded – undo
798 796
 		}
799 797
 	}
800 798
 
801
-    public function __toString (): string
799
+    public function __toString(): string
802 800
     {
803
-        return $this->callMethod ('ToString');
801
+        return $this->callMethod('ToString');
804 802
     }
805 803
 }
806 804
 
@@ -808,16 +806,16 @@  discard block
 block discarded – undo
808 806
 {
809 807
     protected $selector;
810 808
 
811
-    public function __construct ($class, ?string $classGroup = 'auto')
809
+    public function __construct($class, ?string $classGroup = 'auto')
812 810
     {
813
-        if (is_string ($class))
814
-            $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ?
815
-                substr ($class, 0, strrpos ($class, '.')) : $classGroup
811
+        if (is_string($class))
812
+            $this->selector = VoidEngine::createClass($class, $classGroup == 'auto' ?
813
+                substr ($class, 0, strrpos($class, '.')) : $classGroup
816 814
             );
817 815
 
818
-        elseif (is_int ($class) && VoidEngine::objectExists ($class))
816
+        elseif (is_int($class) && VoidEngine::objectExists($class))
819 817
             $this->selector = $class;
820 818
 
821
-        else throw new \Exception ('$class parameter must be string or class selector');
819
+        else throw new \Exception('$class parameter must be string or class selector');
822 820
     }
823 821
 }
Please login to merge, or discard this patch.
Braces   +90 added lines, -97 removed lines patch added patch discarded remove patch
@@ -380,30 +380,37 @@  discard block
 block discarded – undo
380 380
 
381 381
     public static function compile (string $savePath, string $iconPath, string $phpCode, string $productDescription = null, string $productName = null, string $productVersion = null, string $companyName = null, string $copyright = null, string $callSharpCode = '', string $declareSharpCode = '', WFObject $dictionary = null, WFObject $assemblies = null): array
382 382
     {
383
-        if ($dictionary === null)
384
-            $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
383
+        if ($dictionary === null) {
384
+                    $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
385
+        }
385 386
 
386
-        if ($assemblies === null)
387
-            $assemblies = getNetArray ('System.String', [
387
+        if ($assemblies === null) {
388
+                    $assemblies = getNetArray ('System.String', [
388 389
                 // CORE_DIR .'/CefSharp.dll',
389 390
                 CORE_DIR .'/FastColoredTextBox.dll',
390 391
                 CORE_DIR .'/ScintillaNET.dll'
391 392
             ]);
393
+        }
392 394
 
393
-        if ($productName === null)
394
-            $productName = basenameNoExt ($savePath);
395
+        if ($productName === null) {
396
+                    $productName = basenameNoExt ($savePath);
397
+        }
395 398
 
396
-        if ($productDescription === null)
397
-            $productDescription = $productName;
399
+        if ($productDescription === null) {
400
+                    $productDescription = $productName;
401
+        }
398 402
 
399
-        if ($productVersion === null)
400
-            $productVersion = '1.0';
403
+        if ($productVersion === null) {
404
+                    $productVersion = '1.0';
405
+        }
401 406
 
402
-        if ($companyName === null)
403
-            $companyName = 'Company N';
407
+        if ($companyName === null) {
408
+                    $companyName = 'Company N';
409
+        }
404 410
 
405
-        if ($copyright === null)
406
-            $copyright = $companyName .' copyright (c) '. date ('Y');
411
+        if ($copyright === null) {
412
+                    $copyright = $companyName .' copyright (c) '. date ('Y');
413
+        }
407 414
 
408 415
         return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
409 416
     }
@@ -416,9 +423,7 @@  discard block
 block discarded – undo
416 423
         try
417 424
         {
418 425
             (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
419
-        }
420
-
421
-        catch (\Throwable $e)
426
+        } catch (\Throwable $e)
422 427
         {
423 428
             return false;
424 429
         }
@@ -430,8 +435,9 @@  discard block
 block discarded – undo
430 435
     {
431 436
         $property = VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'GetProperty', $name);
432 437
 
433
-        if (!is_int ($property))
434
-            return false;
438
+        if (!is_int ($property)) {
439
+                    return false;
440
+        }
435 441
 
436 442
         try
437 443
         {
@@ -474,9 +480,7 @@  discard block
 block discarded – undo
474 480
                         VoidEngine::getProperty ($selector, [$name, 'int']);
475 481
 
476 482
                         $property = 'int';
477
-                    }
478
-
479
-                    catch (\Throwable $e)
483
+                    } catch (\Throwable $e)
480 484
                     {
481 485
                         return [
482 486
                             'type'  => 'vrsf',
@@ -485,9 +489,7 @@  discard block
 block discarded – undo
485 489
                     }
486 490
                 break;
487 491
             }
488
-        }
489
-
490
-        catch (\Throwable $e)
492
+        } catch (\Throwable $e)
491 493
         {
492 494
             $property = 'object';
493 495
         }
@@ -505,8 +507,9 @@  discard block
 block discarded – undo
505 507
         $props = VoidEngine::callMethod (VoidEngine::callMethod ($object, 'GetType'), 'GetEvents');
506 508
         $len   = VoidEngine::getProperty ($props, 'Length');
507 509
 
508
-        for ($i = 0; $i < $len; ++$i)
509
-            $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
510
+        for ($i = 0; $i < $len; ++$i) {
511
+                    $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
512
+        }
510 513
 
511 514
         return $events;
512 515
     }
@@ -536,40 +539,38 @@  discard block
 block discarded – undo
536 539
 
537 540
     public function __construct ($object, ?string $classGroup = 'auto', ...$args)
538 541
     {
539
-        foreach ($args as $id => $arg)
540
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
542
+        foreach ($args as $id => $arg) {
543
+                    $args[$id] = EngineAdditions::uncoupleSelector ($arg);
544
+        }
541 545
 
542
-        if (is_string ($object))
543
-            $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ?
546
+        if (is_string ($object)) {
547
+                    $this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ?
544 548
                 substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args);
545
-
546
-        elseif (is_int ($object) && VoidEngine::objectExists ($object))
547
-            $this->selector = $object;
548
-
549
-        else throw new \Exception ('$object parameter must be string or object selector');
549
+        } elseif (is_int ($object) && VoidEngine::objectExists ($object)) {
550
+                    $this->selector = $object;
551
+        } else {
552
+            throw new \Exception ('$object parameter must be string or object selector');
553
+        }
550 554
     }
551 555
     
552 556
     public function __get ($name)
553 557
 	{
554
-        if (method_exists ($this, $method = "get_$name"))
555
-            $value = $this->$method ();
556
-
557
-        elseif (substr ($name, -5) == 'Event')
558
-            $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
559
-
560
-        elseif (property_exists ($this, $name))
561
-            $value = $this->$name;
562
-
563
-        else switch (strtolower ($name))
558
+        if (method_exists ($this, $method = "get_$name")) {
559
+                    $value = $this->$method ();
560
+        } elseif (substr ($name, -5) == 'Event') {
561
+                    $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
562
+        } elseif (property_exists ($this, $name)) {
563
+                    $value = $this->$name;
564
+        } else {
565
+            switch (strtolower ($name))
564 566
         {
565 567
             case 'count':
566 568
             case 'length':
567 569
                 try
568 570
                 {
569 571
                     return $this->getProperty ('Count');
570
-                }
571
-
572
-                catch (\Throwable $e)
572
+        }
573
+                } catch (\Throwable $e)
573 574
                 {
574 575
                     return $this->getProperty ('Length');
575 576
                 }
@@ -579,8 +580,9 @@  discard block
 block discarded – undo
579 580
                 $size = $this->count;
580 581
                 $list = [];
581 582
                 
582
-				for ($i = 0; $i < $size; ++$i)
583
-                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
583
+				for ($i = 0; $i < $size; ++$i) {
584
+				                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
585
+				}
584 586
                 
585 587
                 return $list;
586 588
             break;
@@ -589,13 +591,12 @@  discard block
 block discarded – undo
589 591
                 $size = $this->count;
590 592
                 $names = [];
591 593
                 
592
-                for ($i = 0; $i < $size; ++$i)
593
-                    try
594
+                for ($i = 0; $i < $size; ++$i) {
595
+                                    try
594 596
                     {
595 597
                         $names[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($this->selector, [$i, 'object']), 'Text');
596
-                    }
597
-
598
-                    catch (\Throwable $e)
598
+                }
599
+                    } catch (\Throwable $e)
599 600
                     {
600 601
                         $names[] = VoidEngine::getArrayValue ($this->selector, [$i, 'string']);
601 602
                     }
@@ -613,10 +614,11 @@  discard block
 block discarded – undo
613 614
 	
614 615
 	public function __set ($name, $value)
615 616
 	{
616
-        if (method_exists ($this, $method = "set_$name"))
617
-            try
617
+        if (method_exists ($this, $method = "set_$name")) {
618
+                    try
618 619
             {
619 620
                 return $this->$method ($value);
621
+        }
620 622
             }
621 623
 
622 624
             # Метод "set_$name" может принимать в качестве параметра объект WFObject
@@ -626,12 +628,11 @@  discard block
 block discarded – undo
626 628
             {
627 629
                 return $value instanceof WFObject ?
628 630
                     $this->$method ($value->selector) : null;
629
-            }
630
-
631
-        elseif (substr ($name, -5) == 'Event')
632
-            Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
633
-        
634
-        else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
631
+            } elseif (substr ($name, -5) == 'Event') {
632
+                    Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
633
+        } else {
634
+            $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
635
+        }
635 636
     }
636 637
 	
637 638
 	public function __call ($method, $args)
@@ -646,8 +647,9 @@  discard block
 block discarded – undo
646 647
 
647 648
     public function addRange (array $values, $assoc = false): void
648 649
     {
649
-        foreach ($values as $id => $value)
650
-            $this->offsetSet ($assoc ? $id : null, $value);
650
+        foreach ($values as $id => $value) {
651
+                    $this->offsetSet ($assoc ? $id : null, $value);
652
+        }
651 653
     }
652 654
     
653 655
     public function offsetSet ($index, $value)
@@ -657,9 +659,7 @@  discard block
 block discarded – undo
657 659
             return $index === null ?
658 660
                 $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
659 661
                 $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
660
-        }
661
-
662
-        catch (\Throwable $e)
662
+        } catch (\Throwable $e)
663 663
         {
664 664
             return $index === null ?
665 665
                 VoidEngine::setArrayValue ($this->selector, $this->count, $value) :
@@ -682,9 +682,7 @@  discard block
 block discarded – undo
682 682
         try
683 683
         {
684 684
             $this->offsetGet ($index);
685
-        }
686
-
687
-        catch (\Exception $e)
685
+        } catch (\Exception $e)
688 686
         {
689 687
             return false;
690 688
         }
@@ -711,8 +709,9 @@  discard block
 block discarded – undo
711 709
     {
712 710
         $size = $this->count;
713 711
 
714
-        for ($i = 0; $i < $size; ++$i)
715
-            $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
712
+        for ($i = 0; $i < $size; ++$i) {
713
+                    $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
714
+        }
716 715
     }
717 716
 
718 717
     public function where (callable $comparator, string $type = null): array
@@ -720,9 +719,10 @@  discard block
 block discarded – undo
720 719
         $size   = $this->count;
721 720
         $return = [];
722 721
 
723
-        for ($i = 0; $i < $size; ++$i)
724
-            if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
722
+        for ($i = 0; $i < $size; ++$i) {
723
+                    if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
725 724
                 $return[] = $value;
725
+        }
726 726
 
727 727
         return $return;
728 728
     }
@@ -732,9 +732,7 @@  discard block
 block discarded – undo
732 732
         try
733 733
         {
734 734
             return VoidEngine::getProperty ($this->selector, $name);
735
-        }
736
-
737
-        catch (\Throwable $e)
735
+        } catch (\Throwable $e)
738 736
         {
739 737
             return VoidEngine::getField ($this->selector, $name);
740 738
         }
@@ -745,9 +743,7 @@  discard block
 block discarded – undo
745 743
         try
746 744
         {
747 745
             VoidEngine::setProperty ($this->selector, $name, $value);
748
-        }
749
-
750
-        catch (\Throwable $e)
746
+        } catch (\Throwable $e)
751 747
         {
752 748
             VoidEngine::setField ($this->selector, $name, $value);
753 749
         }
@@ -764,8 +760,9 @@  discard block
 block discarded – undo
764 760
         $size   = VoidEngine::getProperty ($array, 'Length');
765 761
         $return = [];
766 762
 
767
-		for ($i = 0; $i < $size; ++$i)
768
-            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
763
+		for ($i = 0; $i < $size; ++$i) {
764
+		            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
765
+		}
769 766
         
770 767
         VoidEngine::removeObjects ($array);
771 768
         
@@ -777,9 +774,7 @@  discard block
 block discarded – undo
777 774
 		try
778 775
 		{
779 776
 			return $this->getProperty ('Name');
780
-        }
781
-        
782
-		catch (\Throwable $e)
777
+        } catch (\Throwable $e)
783 778
 		{
784 779
 			return $this->name;
785 780
 		}
@@ -790,9 +785,7 @@  discard block
 block discarded – undo
790 785
 		try
791 786
 		{
792 787
 			$this->setProperty ('Name', $name);
793
-        }
794
-        
795
-		catch (\Throwable $e)
788
+        } catch (\Throwable $e)
796 789
 		{
797 790
 			$this->name = $name;
798 791
 		}
@@ -810,14 +803,14 @@  discard block
 block discarded – undo
810 803
 
811 804
     public function __construct ($class, ?string $classGroup = 'auto')
812 805
     {
813
-        if (is_string ($class))
814
-            $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ?
806
+        if (is_string ($class)) {
807
+                    $this->selector = VoidEngine::createClass ($class, $classGroup == 'auto' ?
815 808
                 substr ($class, 0, strrpos ($class, '.')) : $classGroup
816 809
             );
817
-
818
-        elseif (is_int ($class) && VoidEngine::objectExists ($class))
819
-            $this->selector = $class;
820
-
821
-        else throw new \Exception ('$class parameter must be string or class selector');
810
+        } elseif (is_int ($class) && VoidEngine::objectExists ($class)) {
811
+                    $this->selector = $class;
812
+        } else {
813
+            throw new \Exception ('$class parameter must be string or class selector');
814
+        }
822 815
     }
823 816
 }
Please login to merge, or discard this patch.
engine/common/Events.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
     public static function setObjectEvent (int $object, string $eventName, callable $function)
8 8
     {
9 9
         VoidEngine::setObjectEvent ($object, $eventName, function ($sender, ...$args) use ($function)
10
-		{
10
+        {
11 11
             try
12
-			{
12
+            {
13 13
                 foreach ($args as $id => $arg)
14 14
                     $args[$id] = EngineAdditions::coupleSelector ($arg);
15 15
                 
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
                     $e : new WFObject ($sender), ...$args);
18 18
             }
19 19
             
20
-			catch (\Throwable $e)
21
-			{
20
+            catch (\Throwable $e)
21
+            {
22 22
                 message ([
23 23
                     'type'  => get_class ($e),
24 24
                     'text'  => $e->getMessage (),
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,35 +4,35 @@
 block discarded – undo
4 4
 
5 5
 class Events
6 6
 {
7
-    public static function setObjectEvent (int $object, string $eventName, callable $function)
7
+    public static function setObjectEvent(int $object, string $eventName, callable $function)
8 8
     {
9
-        VoidEngine::setObjectEvent ($object, $eventName, function ($sender, ...$args) use ($function)
9
+        VoidEngine::setObjectEvent($object, $eventName, function($sender, ...$args) use ($function)
10 10
 		{
11 11
             try
12 12
 			{
13 13
                 foreach ($args as $id => $arg)
14
-                    $args[$id] = EngineAdditions::coupleSelector ($arg);
14
+                    $args[$id] = EngineAdditions::coupleSelector($arg);
15 15
                 
16
-                return $function (($e = _c($sender)) !== false ?
17
-                    $e : new WFObject ($sender), ...$args);
16
+                return $function(($e = _c($sender)) !== false ?
17
+                    $e : new WFObject($sender), ...$args);
18 18
             }
19 19
             
20 20
 			catch (\Throwable $e)
21 21
 			{
22
-                message ([
23
-                    'type'  => get_class ($e),
24
-                    'text'  => $e->getMessage (),
25
-                    'file'  => $e->getFile (),
26
-                    'line'  => $e->getLine (),
27
-                    'code'  => $e->getCode (),
28
-                    'trace' => $e->getTraceAsString ()
22
+                message([
23
+                    'type'  => get_class($e),
24
+                    'text'  => $e->getMessage(),
25
+                    'file'  => $e->getFile(),
26
+                    'line'  => $e->getLine(),
27
+                    'code'  => $e->getCode(),
28
+                    'trace' => $e->getTraceAsString()
29 29
                 ], 'PHP Critical Error');
30 30
             }
31 31
         });
32 32
     }
33 33
 
34
-    public static function removeObjectEvent (int $object, string $eventName)
34
+    public static function removeObjectEvent(int $object, string $eventName)
35 35
     {
36
-        VoidEngine::removeObjectEvent ($object, $eventName);
36
+        VoidEngine::removeObjectEvent($object, $eventName);
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,14 +10,13 @@
 block discarded – undo
10 10
 		{
11 11
             try
12 12
 			{
13
-                foreach ($args as $id => $arg)
14
-                    $args[$id] = EngineAdditions::coupleSelector ($arg);
13
+                foreach ($args as $id => $arg) {
14
+                                    $args[$id] = EngineAdditions::coupleSelector ($arg);
15
+                }
15 16
                 
16 17
                 return $function (($e = _c($sender)) !== false ?
17 18
                     $e : new WFObject ($sender), ...$args);
18
-            }
19
-            
20
-			catch (\Throwable $e)
19
+            } catch (\Throwable $e)
21 20
 			{
22 21
                 message ([
23 22
                     'type'  => get_class ($e),
Please login to merge, or discard this patch.
core/script.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
 chdir (CORE_DIR);
9 9
 
10 10
 foreach (glob ('ext/php_*.dll') as $ext)
11
-	if (!extension_loaded (substr (basename ($ext), 4, -4)))
12
-		load_extension ($ext);
11
+    if (!extension_loaded (substr (basename ($ext), 4, -4)))
12
+        load_extension ($ext);
13 13
 
14 14
 if (file_exists ('../engine/VoidEngine.php'))
15
-	require '../engine/VoidEngine.php';
15
+    require '../engine/VoidEngine.php';
16 16
 
17 17
 elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php'))
18
-	require FRAMEWORK_DIR .'/engine/VoidEngine.php';
18
+    require FRAMEWORK_DIR .'/engine/VoidEngine.php';
19 19
 
20 20
 else message ('VoidEngine not founded');
21 21
 
22 22
 $app = '../../app/start.php';
23 23
 
24 24
 if (file_exists ($app))
25
-	require $app;
25
+    require $app;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,24 +2,24 @@
 block discarded – undo
2 2
 
3 3
 namespace VoidEngine;
4 4
 
5
-define ('VoidEngine\FRAMEWORK_DIR', getenv ('AppData') .'\VoidFramework');
5
+define('VoidEngine\FRAMEWORK_DIR', getenv('AppData').'\VoidFramework');
6 6
 
7 7
 const CORE_DIR = __DIR__;
8
-chdir (CORE_DIR);
8
+chdir(CORE_DIR);
9 9
 
10
-foreach (glob ('ext/php_*.dll') as $ext)
11
-	if (!extension_loaded (substr (basename ($ext), 4, -4)))
12
-		load_extension ($ext);
10
+foreach (glob('ext/php_*.dll') as $ext)
11
+	if (!extension_loaded(substr(basename($ext), 4, -4)))
12
+		load_extension($ext);
13 13
 
14
-if (file_exists ('../engine/VoidEngine.php'))
14
+if (file_exists('../engine/VoidEngine.php'))
15 15
 	require '../engine/VoidEngine.php';
16 16
 
17
-elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php'))
18
-	require FRAMEWORK_DIR .'/engine/VoidEngine.php';
17
+elseif (file_exists(FRAMEWORK_DIR.'/engine/VoidEngine.php'))
18
+	require FRAMEWORK_DIR.'/engine/VoidEngine.php';
19 19
 
20
-else message ('VoidEngine not founded');
20
+else message('VoidEngine not founded');
21 21
 
22 22
 $app = '../../app/start.php';
23 23
 
24
-if (file_exists ($app))
24
+if (file_exists($app))
25 25
 	require $app;
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,19 +7,21 @@
 block discarded – undo
7 7
 const CORE_DIR = __DIR__;
8 8
 chdir (CORE_DIR);
9 9
 
10
-foreach (glob ('ext/php_*.dll') as $ext)
10
+foreach (glob ('ext/php_*.dll') as $ext) {
11 11
 	if (!extension_loaded (substr (basename ($ext), 4, -4)))
12 12
 		load_extension ($ext);
13
+}
13 14
 
14
-if (file_exists ('../engine/VoidEngine.php'))
15
+if (file_exists ('../engine/VoidEngine.php')) {
15 16
 	require '../engine/VoidEngine.php';
16
-
17
-elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php'))
17
+} elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) {
18 18
 	require FRAMEWORK_DIR .'/engine/VoidEngine.php';
19
-
20
-else message ('VoidEngine not founded');
19
+} else {
20
+    message ('VoidEngine not founded');
21
+}
21 22
 
22 23
 $app = '../../app/start.php';
23 24
 
24
-if (file_exists ($app))
25
+if (file_exists ($app)) {
25 26
 	require $app;
27
+}
Please login to merge, or discard this patch.
app_bundle/start.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
 $package = json_decode (@file_get_contents (dirname (__DIR__) .'/qero-packages/packages.json'), true);
9 9
 
10 10
 define ('VoidEngine\CORE_DIR', isset ($package['github:winforms-php/VoidFramework']['basefolder']) ?
11
-	dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/'. $package['github:winforms-php/VoidFramework']['basefolder'] .'/core' : __DIR__);
11
+    dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/'. $package['github:winforms-php/VoidFramework']['basefolder'] .'/core' : __DIR__);
12 12
 
13 13
 # Подгружаем PHP расширения
14 14
 foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext)
15
-	if (!extension_loaded (substr (basename ($ext), 4, -4)))
16
-		load_extension ($ext);
15
+    if (!extension_loaded (substr (basename ($ext), 4, -4)))
16
+        load_extension ($ext);
17 17
 
18 18
 # Подгружаем Qero-пакеты
19 19
 require __DIR__ .'/../qero-packages/autoload.php';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 # Объявление констант
6 6
 const APP_DIR = __DIR__;
7 7
 
8
-$package = json_decode (@file_get_contents (dirname (__DIR__) .'/qero-packages/packages.json'), true);
8
+$package = json_decode(@file_get_contents(dirname(__DIR__).'/qero-packages/packages.json'), true);
9 9
 
10
-define ('VoidEngine\CORE_DIR', isset ($package['github:winforms-php/VoidFramework']['basefolder']) ?
11
-	dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/'. $package['github:winforms-php/VoidFramework']['basefolder'] .'/core' : __DIR__);
10
+define('VoidEngine\CORE_DIR', isset ($package['github:winforms-php/VoidFramework']['basefolder']) ?
11
+	dirname (__DIR__).'/qero-packages/winforms-php/VoidFramework/'.$package['github:winforms-php/VoidFramework']['basefolder'].'/core' : __DIR__);
12 12
 
13 13
 # Подгружаем PHP расширения
14
-foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext)
15
-	if (!extension_loaded (substr (basename ($ext), 4, -4)))
16
-		load_extension ($ext);
14
+foreach (glob(CORE_DIR.'/ext/php_*.dll') as $ext)
15
+	if (!extension_loaded(substr(basename($ext), 4, -4)))
16
+		load_extension($ext);
17 17
 
18 18
 # Подгружаем Qero-пакеты
19
-require __DIR__ .'/../qero-packages/autoload.php';
19
+require __DIR__.'/../qero-packages/autoload.php';
20 20
 
21
-chdir (APP_DIR); // Меняем стандартную директорию на директорию приложения
21
+chdir(APP_DIR); // Меняем стандартную директорию на директорию приложения
22 22
 
23 23
 # Парсим app.vlf
24
-$parser = new VLFParser (__DIR__. '/app.vlf', [
24
+$parser = new VLFParser(__DIR__.'/app.vlf', [
25 25
     'strong_line_parser'            => false,
26 26
     'ignore_postobject_info'        => true,
27 27
     'ignore_unexpected_method_args' => true,
@@ -31,5 +31,5 @@  discard block
 block discarded – undo
31 31
 ]);
32 32
 
33 33
 # Запускаем приложение
34
-$objects = VLFInterpreter::run ($parser);
35
-$APPLICATION->run ($objects['MainForm']);
34
+$objects = VLFInterpreter::run($parser);
35
+$APPLICATION->run($objects['MainForm']);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,9 +11,10 @@
 block discarded – undo
11 11
 	dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/'. $package['github:winforms-php/VoidFramework']['basefolder'] .'/core' : __DIR__);
12 12
 
13 13
 # Подгружаем PHP расширения
14
-foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext)
14
+foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext) {
15 15
 	if (!extension_loaded (substr (basename ($ext), 4, -4)))
16 16
 		load_extension ($ext);
17
+}
17 18
 
18 19
 # Подгружаем Qero-пакеты
19 20
 require __DIR__ .'/../qero-packages/autoload.php';
Please login to merge, or discard this patch.