Passed
Push — master ( 0323c2...944c95 )
by Observer
01:37
created
engine/common/EngineInterfaces.php 3 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
     }
103 103
 
104 104
     /**
105
-    * * Создание экземпляра типа объекта
106
-    * 
107
-    * @param mixed $objectName - полное название объекта
108
-    * [@param mixed $objectGroup = null] - полное пространство имён объекта
109
-    * 
110
-    * @return mixed - возвращает указатель на объект типа объекта или false в случае ошибки
111
-    * 
112
-    */
105
+     * * Создание экземпляра типа объекта
106
+     * 
107
+     * @param mixed $objectName - полное название объекта
108
+     * [@param mixed $objectGroup = null] - полное пространство имён объекта
109
+     * 
110
+     * @return mixed - возвращает указатель на объект типа объекта или false в случае ошибки
111
+     * 
112
+     */
113 113
     public static function objectType ($objectName, $objectGroup = false)
114 114
     {
115 115
         return \VoidCore::typeof ($objectName, $objectGroup);
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     }
535 535
     
536 536
     public function __get ($name)
537
-	{
537
+    {
538 538
         if (method_exists ($this, $method = "get_$name"))
539 539
             $value = $this->$method ();
540 540
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                 $size = $this->count;
564 564
                 $list = [];
565 565
                 
566
-				for ($i = 0; $i < $size; ++$i)
566
+                for ($i = 0; $i < $size; ++$i)
567 567
                     $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
568 568
                 
569 569
                 return $list;
@@ -593,10 +593,10 @@  discard block
 block discarded – undo
593 593
         }
594 594
 
595 595
         return EngineAdditions::coupleSelector ($value, $this->selector);
596
-	}
596
+    }
597 597
 	
598
-	public function __set ($name, $value)
599
-	{
598
+    public function __set ($name, $value)
599
+    {
600 600
         if (method_exists ($this, $method = "set_$name"))
601 601
             try
602 602
             {
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
         }
625 625
     }
626 626
 	
627
-	public function __call ($method, $args)
628
-	{
627
+    public function __call ($method, $args)
628
+    {
629 629
         $args = array_map (function ($arg)
630 630
         {
631 631
             return EngineAdditions::uncoupleSelector ($arg);
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
     }
645 645
     
646 646
     public function offsetSet ($index, $value)
647
-	{
647
+    {
648 648
         try
649 649
         {
650 650
             return $index === null ?
@@ -660,14 +660,14 @@  discard block
 block discarded – undo
660 660
         }
661 661
     }
662 662
 	
663
-	public function offsetGet ($index)
664
-	{
665
-		return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector);
663
+    public function offsetGet ($index)
664
+    {
665
+        return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector);
666 666
     }
667 667
 	
668
-	public function offsetUnset ($index): void
669
-	{
670
-		$this->callMethod ('RemoveAt', $index);
668
+    public function offsetUnset ($index): void
669
+    {
670
+        $this->callMethod ('RemoveAt', $index);
671 671
     }
672 672
     
673 673
     public function offsetExists ($index): bool
@@ -685,19 +685,19 @@  discard block
 block discarded – undo
685 685
         return true;
686 686
     }
687 687
 	
688
-	public function indexOf ($value): int
689
-	{
690
-		return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
688
+    public function indexOf ($value): int
689
+    {
690
+        return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
691 691
     }
692 692
     
693 693
     public function lastIndexOf ($value): int
694
-	{
695
-		return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
696
-	}
694
+    {
695
+        return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
696
+    }
697 697
 	
698
-	public function contains ($value): bool
699
-	{
700
-		return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
698
+    public function contains ($value): bool
699
+    {
700
+        return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
701 701
     }
702 702
 
703 703
     public function foreach (callable $callback, string $type = null): void
@@ -751,45 +751,45 @@  discard block
 block discarded – undo
751 751
         return VoidEngine::callMethod ($this->selector, $method, ...$args);
752 752
     }
753 753
 	
754
-	protected function getArrayProperty ($name, string $type = null)
755
-	{
754
+    protected function getArrayProperty ($name, string $type = null)
755
+    {
756 756
         $array  = $this->getProperty ($name);
757 757
         $size   = VoidEngine::getProperty ($array, 'Length');
758 758
         $return = [];
759 759
 
760
-		for ($i = 0; $i < $size; ++$i)
760
+        for ($i = 0; $i < $size; ++$i)
761 761
             $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
762 762
         
763 763
         VoidEngine::removeObjects ($array);
764 764
         
765
-		return $return;
765
+        return $return;
766 766
     }
767 767
 
768 768
     public function get_name ()
769
-	{
770
-		try
771
-		{
772
-			return $this->getProperty ('Name');
769
+    {
770
+        try
771
+        {
772
+            return $this->getProperty ('Name');
773 773
         }
774 774
         
775
-		catch (\Throwable $e)
776
-		{
777
-			return $this->name;
778
-		}
779
-	}
775
+        catch (\Throwable $e)
776
+        {
777
+            return $this->name;
778
+        }
779
+    }
780 780
 	
781
-	public function set_name (string $name)
782
-	{
783
-		try
784
-		{
785
-			$this->setProperty ('Name', $name);
781
+    public function set_name (string $name)
782
+    {
783
+        try
784
+        {
785
+            $this->setProperty ('Name', $name);
786 786
         }
787 787
         
788
-		catch (\Throwable $e)
789
-		{
790
-			$this->name = $name;
791
-		}
792
-	}
788
+        catch (\Throwable $e)
789
+        {
790
+            $this->name = $name;
791
+        }
792
+    }
793 793
 
794 794
     public function __toString (): string
795 795
     {
Please login to merge, or discard this patch.
Spacing   +142 added lines, -144 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
      * VoidEngine::createObject ('System.Windows.Forms.Button', 'System.Windows.Forms');
17 17
      * 
18 18
      */
19
-    public static function createObject ($objectName, $objectGroup = false, ...$args): int
19
+    public static function createObject($objectName, $objectGroup = false, ...$args): int
20 20
     {
21
-        return \VoidCore::createObject ($objectName, $objectGroup, ...$args);
21
+        return \VoidCore::createObject($objectName, $objectGroup, ...$args);
22 22
     }
23 23
 
24 24
     /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
      * VoidEngine::removeObjects ($button_1, $button_2);
33 33
      * 
34 34
      */
35
-    public static function removeObjects (int ...$selectors): void
35
+    public static function removeObjects(int ...$selectors): void
36 36
     {
37
-        \VoidCore::removeObjects (...$selectors);
37
+        \VoidCore::removeObjects(...$selectors);
38 38
     }
39 39
 
40 40
     /**
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
      * VoidEngine::destructObject ($button);
49 49
      * 
50 50
      */
51
-    public static function destructObject (int $selector): bool
51
+    public static function destructObject(int $selector): bool
52 52
     {
53
-        return \VoidCore::destructObject ($selector);
53
+        return \VoidCore::destructObject($selector);
54 54
     }
55 55
 
56 56
     /**
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
      * VoidEngine::createClass ('System.Windows.Forms.MessageBox');
65 65
      * 
66 66
      */
67
-    public static function createClass ($className, $classGroup = false): int
67
+    public static function createClass($className, $classGroup = false): int
68 68
     {
69
-        return \VoidCore::getClass ($className, $classGroup);
69
+        return \VoidCore::getClass($className, $classGroup);
70 70
     }
71 71
 
72 72
     /**
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
      * @return int - возвращает указатель на созданный делегат
79 79
      * 
80 80
      */
81
-    public static function createDelegate (string $type, callable $function): int
81
+    public static function createDelegate(string $type, callable $function): int
82 82
     {
83
-        return \VoidCore::createDelegate ($type, $function);
83
+        return \VoidCore::createDelegate($type, $function);
84 84
     }
85 85
 
86 86
     /**
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
      * var_dump (VoidEngine::objectExists ($button)); // false
97 97
      * 
98 98
      */
99
-    public static function objectExists (int $selector): bool
99
+    public static function objectExists(int $selector): bool
100 100
     {
101
-        return \VoidCore::objectExists ($selector);
101
+        return \VoidCore::objectExists($selector);
102 102
     }
103 103
 
104 104
     /**
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
     * @return mixed - возвращает указатель на объект типа объекта или false в случае ошибки
111 111
     * 
112 112
     */
113
-    public static function objectType ($objectName, $objectGroup = false)
113
+    public static function objectType($objectName, $objectGroup = false)
114 114
     {
115
-        return \VoidCore::typeof ($objectName, $objectGroup);
115
+        return \VoidCore::typeof($objectName, $objectGroup);
116 116
     }
117 117
 
118 118
     /**
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
      * pre (VoidEngine::getProperty ($selector, ['Text', 'string']));
133 133
      * 
134 134
      */
135
-    public static function getProperty (int $selector, $propertyName)
135
+    public static function getProperty(int $selector, $propertyName)
136 136
     {
137
-        return \VoidCore::getProp ($selector, $propertyName);
137
+        return \VoidCore::getProp($selector, $propertyName);
138 138
     }
139 139
 
140 140
     /**
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
      * VoidEngine::setProperty ($selector, 'Text', ['Hello!', 'string']);
154 154
      * 
155 155
      */
156
-    public static function setProperty (int $selector, string $propertyName, $value): void
156
+    public static function setProperty(int $selector, string $propertyName, $value): void
157 157
     {
158
-        \VoidCore::setProp ($selector, $propertyName, $value);
158
+        \VoidCore::setProp($selector, $propertyName, $value);
159 159
     }
160 160
 
161 161
     /**
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
      * pre (VoidEngine::getField ($selector, 'Any'));
175 175
      * 
176 176
      */
177
-    public static function getField (int $selector, $fieldName)
177
+    public static function getField(int $selector, $fieldName)
178 178
     {
179
-        return \VoidCore::getField ($selector, $fieldName);
179
+        return \VoidCore::getField($selector, $fieldName);
180 180
     }
181 181
 
182 182
     /**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
      * [значение, тип]
191 191
      * 
192 192
      */
193
-    public static function setField (int $selector, string $fieldName, $value): void
193
+    public static function setField(int $selector, string $fieldName, $value): void
194 194
     {
195
-        \VoidCore::setField ($selector, $fieldName, $value);
195
+        \VoidCore::setField($selector, $fieldName, $value);
196 196
     }
197 197
 
198 198
     /**
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
      * $result = VoidEngine::callMethod ($selector, ['Show', 'int'], ['Hello, World!', 'string'], ['Test Box', 'string']);
216 216
      * 
217 217
      */
218
-    public static function callMethod (int $selector, $methodName, ...$args)
218
+    public static function callMethod(int $selector, $methodName, ...$args)
219 219
     {
220
-        return \VoidCore::callMethod ($selector, $methodName, ...$args);
220
+        return \VoidCore::callMethod($selector, $methodName, ...$args);
221 221
     }
222 222
 
223 223
     /**
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
      * @return mixed - возвращает значение массива
233 233
      * 
234 234
      */
235
-    public static function getArrayValue (int $selector, $index)
235
+    public static function getArrayValue(int $selector, $index)
236 236
     {
237
-        return \VoidCore::getArrayValue ($selector, $index);
237
+        return \VoidCore::getArrayValue($selector, $index);
238 238
     }
239 239
 
240 240
     /**
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
      * [значение, тип]
252 252
      * 
253 253
      */
254
-    public static function setArrayValue (int $selector, $index, $value): void
254
+    public static function setArrayValue(int $selector, $index, $value): void
255 255
     {
256
-        \VoidCore::setArrayValue ($selector, $index, $value);
256
+        \VoidCore::setArrayValue($selector, $index, $value);
257 257
     }
258 258
 
259 259
     /**
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
      * VoidEngine::setObjectEvent ($selector, 'Click', function () { pre (123); });
268 268
      * 
269 269
      */
270
-    public static function setObjectEvent (int $selector, string $eventName, callable $event): void
270
+    public static function setObjectEvent(int $selector, string $eventName, callable $event): void
271 271
     {
272 272
         /*if (self::eventExists ($selector, $eventName))
273 273
             self::removeObjectEvent ($selector, $eventName);*/
274 274
 
275
-        \VoidCore::setEvent ($selector, $eventName, $event);
275
+        \VoidCore::setEvent($selector, $eventName, $event);
276 276
     }
277 277
 
278 278
     /**
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
      * var_dump (VoidEngine::eventExists ($selector, 'Click')); // true
290 290
      * 
291 291
      */
292
-    public static function eventExists (int $selector, string $eventName): bool
292
+    public static function eventExists(int $selector, string $eventName): bool
293 293
     {
294
-        return \VoidCore::eventExists ($selector, $eventName);
294
+        return \VoidCore::eventExists($selector, $eventName);
295 295
     }
296 296
 
297 297
     /**
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
      * var_dump (VoidEngine::eventExists ($selector, 'Click')); // false
308 308
      * 
309 309
      */
310
-    public static function removeObjectEvent (int $selector, string $eventName): void
310
+    public static function removeObjectEvent(int $selector, string $eventName): void
311 311
     {
312
-        \VoidCore::removeEvent ($selector, $eventName);
312
+        \VoidCore::removeEvent($selector, $eventName);
313 313
     }
314 314
 
315 315
     /**
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
      * @return int - возвращает указатель на импортированный объект
321 321
      * 
322 322
      */
323
-    public static function importObject (string $data): int
323
+    public static function importObject(string $data): int
324 324
     {
325
-        return \VoidCore::importObject ($data);
325
+        return \VoidCore::importObject($data);
326 326
     }
327 327
 
328 328
     /**
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
      * @return string - возвращает сериализованные данные объекта
334 334
      * 
335 335
      */
336
-    public static function exportObject (int $selector): string
336
+    public static function exportObject(int $selector): string
337 337
     {
338
-        return \VoidCore::exportObject ($selector);
338
+        return \VoidCore::exportObject($selector);
339 339
     }
340 340
 
341 341
     /**
@@ -358,20 +358,20 @@  discard block
 block discarded – undo
358 358
      * @return array - возвращает список ошибок компиляции
359 359
      * 
360 360
      */
361
-    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
361
+    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
362 362
     {
363 363
         if ($dictionary === null)
364
-            $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
364
+            $dictionary = new WFObject('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
365 365
 
366 366
         if ($assemblies === null)
367
-            $assemblies = getNetArray ('System.String', [
367
+            $assemblies = getNetArray('System.String', [
368 368
                 // CORE_DIR .'/CefSharp.dll',
369
-                CORE_DIR .'/FastColoredTextBox.dll',
370
-                CORE_DIR .'/ScintillaNET.dll'
369
+                CORE_DIR.'/FastColoredTextBox.dll',
370
+                CORE_DIR.'/ScintillaNET.dll'
371 371
             ]);
372 372
 
373 373
         if ($productName === null)
374
-            $productName = basenameNoExt ($savePath);
374
+            $productName = basenameNoExt($savePath);
375 375
 
376 376
         if ($productDescription === null)
377 377
             $productDescription = $productName;
@@ -383,19 +383,19 @@  discard block
 block discarded – undo
383 383
             $companyName = 'Company N';
384 384
 
385 385
         if ($copyright === null)
386
-            $copyright = $companyName .' copyright (c) '. date ('Y');
386
+            $copyright = $companyName.' copyright (c) '.date('Y');
387 387
 
388
-        return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
388
+        return (new WFClass('WinForms_PHP.WFCompiler', null))->compile($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
389 389
     }
390 390
 }
391 391
 
392 392
 class EngineAdditions
393 393
 {
394
-    public static function loadModule (string $path): bool
394
+    public static function loadModule(string $path): bool
395 395
     {
396 396
         try
397 397
         {
398
-            (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
398
+            (new WFClass('System.Reflection.Assembly', 'mscorlib'))->loadFrom($path);
399 399
         }
400 400
 
401 401
         catch (\WinFormsException $e)
@@ -406,16 +406,16 @@  discard block
 block discarded – undo
406 406
         return true;
407 407
     }
408 408
 
409
-    public static function getProperty (int $selector, string $name): array
409
+    public static function getProperty(int $selector, string $name): array
410 410
     {
411
-        $property = VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'GetProperty', $name);
411
+        $property = VoidEngine::callMethod(VoidEngine::callMethod($selector, 'GetType'), 'GetProperty', $name);
412 412
 
413
-        if (!is_int ($property))
413
+        if (!is_int($property))
414 414
             return false;
415 415
 
416 416
         try
417 417
         {
418
-            $propertyType = VoidEngine::getProperty ($property, ['PropertyType', 'string']);
418
+            $propertyType = VoidEngine::getProperty($property, ['PropertyType', 'string']);
419 419
 
420 420
             switch ($propertyType)
421 421
             {
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
                 default:
452 452
                     try
453 453
                     {
454
-                        VoidEngine::getProperty ($selector, [$name, 'int']);
454
+                        VoidEngine::getProperty($selector, [$name, 'int']);
455 455
 
456 456
                         $property = 'int';
457 457
                     }
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                     {
461 461
                         return [
462 462
                             'type'  => 'vrsf',
463
-                            'value' => VoidEngine::exportObject (VoidEngine::getProperty ($selector, [$name, 'object']))
463
+                            'value' => VoidEngine::exportObject(VoidEngine::getProperty($selector, [$name, 'object']))
464 464
                         ];
465 465
                     }
466 466
                 break;
@@ -474,19 +474,19 @@  discard block
 block discarded – undo
474 474
 
475 475
         return [
476 476
             'type'  => $property,
477
-            'value' => VoidEngine::getProperty ($selector, [$name, $property])
477
+            'value' => VoidEngine::getProperty($selector, [$name, $property])
478 478
         ];
479 479
     }
480 480
 
481
-    public static function getObjectEvents (int $object): array
481
+    public static function getObjectEvents(int $object): array
482 482
     {
483 483
         $events = [];
484 484
 
485
-        $props = VoidEngine::callMethod (VoidEngine::callMethod ($object, 'GetType'), 'GetEvents');
486
-        $len   = VoidEngine::getProperty ($props, 'Length');
485
+        $props = VoidEngine::callMethod(VoidEngine::callMethod($object, 'GetType'), 'GetEvents');
486
+        $len   = VoidEngine::getProperty($props, 'Length');
487 487
 
488 488
         for ($i = 0; $i < $len; ++$i)
489
-            $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
489
+            $events[] = VoidEngine::getProperty(VoidEngine::getArrayValue($props, $i), 'Name');
490 490
 
491 491
         return $events;
492 492
     }
@@ -496,13 +496,13 @@  discard block
 block discarded – undo
496 496
      * Тогда получается бесконечный цикл вида object->selector->selector->selector->...
497 497
      * Чтобы этого избежать нужно добавить исключение - переменную $selfSelector
498 498
      */
499
-    public static function coupleSelector ($value, int $selfSelector = null)
499
+    public static function coupleSelector($value, int $selfSelector = null)
500 500
     {
501
-        return is_int ($value) && VoidEngine::objectExists ($value) && $value != $selfSelector ?
502
-            new WFObject ($value) : $value;
501
+        return is_int($value) && VoidEngine::objectExists($value) && $value != $selfSelector ?
502
+            new WFObject($value) : $value;
503 503
     }
504 504
 
505
-    public static function uncoupleSelector ($value)
505
+    public static function uncoupleSelector($value)
506 506
     {
507 507
         return $value instanceof WFObject ?
508 508
             $value->selector : $value;
@@ -514,48 +514,48 @@  discard block
 block discarded – undo
514 514
     protected int $selector = 0;
515 515
     protected $name;
516 516
 
517
-    public function __construct ($object, $classGroup = false, ...$args)
517
+    public function __construct($object, $classGroup = false, ...$args)
518 518
     {
519 519
         foreach ($args as $id => $arg)
520
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
520
+            $args[$id] = EngineAdditions::uncoupleSelector($arg);
521 521
 
522
-        if (is_string ($object))
522
+        if (is_string($object))
523 523
         {
524
-            $this->selector = VoidEngine::createObject ($object, $classGroup, ...$args);
524
+            $this->selector = VoidEngine::createObject($object, $classGroup, ...$args);
525 525
             
526 526
             /*$this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ?
527 527
                 substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args);*/
528 528
         }
529 529
 
530
-        elseif (is_int ($object) && VoidEngine::objectExists ($object))
530
+        elseif (is_int($object) && VoidEngine::objectExists($object))
531 531
             $this->selector = $object;
532 532
 
533
-        else throw new \Exception ('$object parameter must be string or object selector');
533
+        else throw new \Exception('$object parameter must be string or object selector');
534 534
     }
535 535
     
536
-    public function __get ($name)
536
+    public function __get($name)
537 537
 	{
538
-        if (method_exists ($this, $method = "get_$name"))
539
-            $value = $this->$method ();
538
+        if (method_exists($this, $method = "get_$name"))
539
+            $value = $this->$method();
540 540
 
541
-        elseif (substr ($name, -5) == 'Event')
542
-            $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
541
+        elseif (substr($name, -5) == 'Event')
542
+            $value = Events::getObjectEvent($this->selector, substr($name, 0, -5));
543 543
 
544
-        elseif (property_exists ($this, $name))
544
+        elseif (property_exists($this, $name))
545 545
             $value = $this->$name;
546 546
 
547
-        else switch (strtolower ($name))
547
+        else switch (strtolower($name))
548 548
         {
549 549
             case 'count':
550 550
             case 'length':
551 551
                 try
552 552
                 {
553
-                    return $this->getProperty ('Count');
553
+                    return $this->getProperty('Count');
554 554
                 }
555 555
 
556 556
                 catch (\WinFormsException $e)
557 557
                 {
558
-                    return $this->getProperty ('Length');
558
+                    return $this->getProperty('Length');
559 559
                 }
560 560
             break;
561 561
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                 $list = [];
565 565
                 
566 566
 				for ($i = 0; $i < $size; ++$i)
567
-                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
567
+                    $list[] = EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $i));
568 568
                 
569 569
                 return $list;
570 570
             break;
@@ -576,31 +576,31 @@  discard block
 block discarded – undo
576 576
                 for ($i = 0; $i < $size; ++$i)
577 577
                     try
578 578
                     {
579
-                        $names[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($this->selector, [$i, 'object']), 'Text');
579
+                        $names[] = VoidEngine::getProperty(VoidEngine::getArrayValue($this->selector, [$i, 'object']), 'Text');
580 580
                     }
581 581
 
582 582
                     catch (\WinFormsException $e)
583 583
                     {
584
-                        $names[] = VoidEngine::getArrayValue ($this->selector, [$i, 'string']);
584
+                        $names[] = VoidEngine::getArrayValue($this->selector, [$i, 'string']);
585 585
                     }
586 586
                 
587 587
                 return $names;
588 588
             break;
589 589
 
590 590
             default:
591
-                $value = $this->getProperty ($name);
591
+                $value = $this->getProperty($name);
592 592
             break;
593 593
         }
594 594
 
595
-        return EngineAdditions::coupleSelector ($value, $this->selector);
595
+        return EngineAdditions::coupleSelector($value, $this->selector);
596 596
 	}
597 597
 	
598
-	public function __set ($name, $value)
598
+	public function __set($name, $value)
599 599
 	{
600
-        if (method_exists ($this, $method = "set_$name"))
600
+        if (method_exists($this, $method = "set_$name"))
601 601
             try
602 602
             {
603
-                return $this->$method ($value);
603
+                return $this->$method($value);
604 604
             }
605 605
 
606 606
             # Метод "set_$name" может принимать в качестве параметра объект WFObject
@@ -609,72 +609,70 @@  discard block
 block discarded – undo
609 609
             catch (\Throwable $e)
610 610
             {
611 611
                 return $value instanceof WFObject ?
612
-                    $this->$method ($value->selector) : null;
612
+                    $this->$method($value->selector) : null;
613 613
             }
614 614
 
615
-        elseif (substr ($name, -5) == 'Event')
616
-            Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
615
+        elseif (substr($name, -5) == 'Event')
616
+            Events::setObjectEvent($this->selector, substr($name, 0, -5), $value);
617 617
         
618 618
         else
619 619
         {
620
-            if (is_array ($value) && is_string (current ($value)))
621
-                $value = getNetArray ('System.String', $value);
620
+            if (is_array($value) && is_string(current($value)))
621
+                $value = getNetArray('System.String', $value);
622 622
 
623
-            $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
623
+            $this->setProperty($name, EngineAdditions::uncoupleSelector($value));
624 624
         }
625 625
     }
626 626
 	
627
-	public function __call ($method, $args)
627
+	public function __call($method, $args)
628 628
 	{
629
-        $args = array_map (function ($arg)
629
+        $args = array_map(function($arg)
630 630
         {
631
-            return EngineAdditions::uncoupleSelector ($arg);
631
+            return EngineAdditions::uncoupleSelector($arg);
632 632
         }, $args);
633 633
 
634
-        return EngineAdditions::coupleSelector ($this->callMethod ($method, ...$args), $this->selector);
634
+        return EngineAdditions::coupleSelector($this->callMethod($method, ...$args), $this->selector);
635 635
     }
636 636
 
637
-    public function addRange ($values, $assoc = false): void
637
+    public function addRange($values, $assoc = false): void
638 638
     {
639
-        if (is_array ($values))
639
+        if (is_array($values))
640 640
             foreach ($values as $id => $value)
641
-                $this->offsetSet ($assoc ? $id : null, $value);
641
+                $this->offsetSet($assoc ? $id : null, $value);
642 642
 
643
-        else $this->callMethod ('AddRange', EngineAdditions::uncoupleSelector ($values));
643
+        else $this->callMethod('AddRange', EngineAdditions::uncoupleSelector($values));
644 644
     }
645 645
     
646
-    public function offsetSet ($index, $value)
646
+    public function offsetSet($index, $value)
647 647
 	{
648 648
         try
649 649
         {
650 650
             return $index === null ?
651
-                $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
652
-                $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
651
+                $this->callMethod('Add', EngineAdditions::uncoupleSelector($value)) : $this->callMethod('Insert', $index, EngineAdditions::uncoupleSelector($value));
653 652
         }
654 653
 
655 654
         catch (\Throwable $e)
656 655
         {
657 656
             return $index === null ?
658
-                VoidEngine::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) :
659
-                VoidEngine::setArrayValue ($this->selector, $index, EngineAdditions::uncoupleSelector ($value));
657
+                VoidEngine::setArrayValue($this->selector, $this->count, EngineAdditions::uncoupleSelector($value)) : VoidEngine::setArrayValue($this->selector, $index, EngineAdditions::uncoupleSelector($value));
660 658
         }
661 659
     }
662 660
 	
663
-	public function offsetGet ($index)
661
+	public function offsetGet($index)
664 662
 	{
665
-		return EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $index), $this->selector);
663
+		return EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $index), $this->selector);
666 664
     }
667 665
 	
668
-	public function offsetUnset ($index): void
666
+	public function offsetUnset($index): void
669 667
 	{
670
-		$this->callMethod ('RemoveAt', $index);
668
+		$this->callMethod('RemoveAt', $index);
671 669
     }
672 670
     
673
-    public function offsetExists ($index): bool
671
+    public function offsetExists($index): bool
674 672
     {
675 673
         try
676 674
         {
677
-            $this->offsetGet ($index);
675
+            $this->offsetGet($index);
678 676
         }
679 677
 
680 678
         catch (\Exception $e)
@@ -685,19 +683,19 @@  discard block
 block discarded – undo
685 683
         return true;
686 684
     }
687 685
 	
688
-	public function indexOf ($value): int
686
+	public function indexOf($value): int
689 687
 	{
690
-		return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
688
+		return $this->callMethod('IndexOf', EngineAdditions::uncoupleSelector($value));
691 689
     }
692 690
     
693
-    public function lastIndexOf ($value): int
691
+    public function lastIndexOf($value): int
694 692
 	{
695
-		return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
693
+		return $this->callMethod('LastIndexOf', EngineAdditions::uncoupleSelector($value));
696 694
 	}
697 695
 	
698
-	public function contains ($value): bool
696
+	public function contains($value): bool
699 697
 	{
700
-		return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
698
+		return $this->callMethod('Contains', EngineAdditions::uncoupleSelector($value));
701 699
     }
702 700
 
703 701
     public function foreach (callable $callback, string $type = null): void
@@ -705,71 +703,71 @@  discard block
 block discarded – undo
705 703
         $size = $this->count;
706 704
 
707 705
         for ($i = 0; $i < $size; ++$i)
708
-            $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
706
+            $callback(EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
709 707
     }
710 708
 
711
-    public function where (callable $comparator, string $type = null): array
709
+    public function where(callable $comparator, string $type = null): array
712 710
     {
713 711
         $size   = $this->count;
714 712
         $return = [];
715 713
 
716 714
         for ($i = 0; $i < $size; ++$i)
717
-            if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
715
+            if ($comparator($value = EngineAdditions::coupleSelector(VoidEngine::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
718 716
                 $return[] = $value;
719 717
 
720 718
         return $return;
721 719
     }
722 720
 	
723
-    protected function getProperty ($name)
721
+    protected function getProperty($name)
724 722
     {
725 723
         try
726 724
         {
727
-            return VoidEngine::getProperty ($this->selector, $name);
725
+            return VoidEngine::getProperty($this->selector, $name);
728 726
         }
729 727
 
730 728
         catch (\WinFormsException $e)
731 729
         {
732
-            return VoidEngine::getField ($this->selector, $name);
730
+            return VoidEngine::getField($this->selector, $name);
733 731
         }
734 732
     }
735 733
 
736
-    protected function setProperty ($name, $value)
734
+    protected function setProperty($name, $value)
737 735
     {
738 736
         try
739 737
         {
740
-            VoidEngine::setProperty ($this->selector, $name, $value);
738
+            VoidEngine::setProperty($this->selector, $name, $value);
741 739
         }
742 740
 
743 741
         catch (\WinFormsException $e)
744 742
         {
745
-            VoidEngine::setField ($this->selector, $name, $value);
743
+            VoidEngine::setField($this->selector, $name, $value);
746 744
         }
747 745
     }
748 746
 	
749
-    protected function callMethod ($method, ...$args)
747
+    protected function callMethod($method, ...$args)
750 748
     {
751
-        return VoidEngine::callMethod ($this->selector, $method, ...$args);
749
+        return VoidEngine::callMethod($this->selector, $method, ...$args);
752 750
     }
753 751
 	
754
-	protected function getArrayProperty ($name, string $type = null)
752
+	protected function getArrayProperty($name, string $type = null)
755 753
 	{
756
-        $array  = $this->getProperty ($name);
757
-        $size   = VoidEngine::getProperty ($array, 'Length');
754
+        $array  = $this->getProperty($name);
755
+        $size   = VoidEngine::getProperty($array, 'Length');
758 756
         $return = [];
759 757
 
760 758
 		for ($i = 0; $i < $size; ++$i)
761
-            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
759
+            $return[] = VoidEngine::getArrayValue($array, $type === null ? $i : [$i, $type]);
762 760
         
763
-        VoidEngine::removeObjects ($array);
761
+        VoidEngine::removeObjects($array);
764 762
         
765 763
 		return $return;
766 764
     }
767 765
 
768
-    public function get_name ()
766
+    public function get_name()
769 767
 	{
770 768
 		try
771 769
 		{
772
-			return $this->getProperty ('Name');
770
+			return $this->getProperty('Name');
773 771
         }
774 772
         
775 773
 		catch (\Throwable $e)
@@ -778,11 +776,11 @@  discard block
 block discarded – undo
778 776
 		}
779 777
 	}
780 778
 	
781
-	public function set_name (string $name)
779
+	public function set_name(string $name)
782 780
 	{
783 781
 		try
784 782
 		{
785
-			$this->setProperty ('Name', $name);
783
+			$this->setProperty('Name', $name);
786 784
         }
787 785
         
788 786
 		catch (\Throwable $e)
@@ -791,22 +789,22 @@  discard block
 block discarded – undo
791 789
 		}
792 790
 	}
793 791
 
794
-    public function __toString (): string
792
+    public function __toString(): string
795 793
     {
796
-        return $this->callMethod ('ToString');
794
+        return $this->callMethod('ToString');
797 795
     }
798 796
 }
799 797
 
800 798
 class WFClass extends WFObject
801 799
 {
802
-    public function __construct ($class, $classGroup = false)
800
+    public function __construct($class, $classGroup = false)
803 801
     {
804
-        if (is_string ($class))
805
-            $this->selector = VoidEngine::createClass ($class, $classGroup);
802
+        if (is_string($class))
803
+            $this->selector = VoidEngine::createClass($class, $classGroup);
806 804
 
807
-        elseif (is_int ($class) && VoidEngine::objectExists ($class))
805
+        elseif (is_int($class) && VoidEngine::objectExists($class))
808 806
             $this->selector = $class;
809 807
 
810
-        else throw new \Exception ('$class parameter must be string or class selector');
808
+        else throw new \Exception('$class parameter must be string or class selector');
811 809
     }
812 810
 }
Please login to merge, or discard this patch.
Braces   +90 added lines, -99 removed lines patch added patch discarded remove patch
@@ -360,30 +360,37 @@  discard block
 block discarded – undo
360 360
      */
361 361
     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
362 362
     {
363
-        if ($dictionary === null)
364
-            $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
363
+        if ($dictionary === null) {
364
+                    $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
365
+        }
365 366
 
366
-        if ($assemblies === null)
367
-            $assemblies = getNetArray ('System.String', [
367
+        if ($assemblies === null) {
368
+                    $assemblies = getNetArray ('System.String', [
368 369
                 // CORE_DIR .'/CefSharp.dll',
369 370
                 CORE_DIR .'/FastColoredTextBox.dll',
370 371
                 CORE_DIR .'/ScintillaNET.dll'
371 372
             ]);
373
+        }
372 374
 
373
-        if ($productName === null)
374
-            $productName = basenameNoExt ($savePath);
375
+        if ($productName === null) {
376
+                    $productName = basenameNoExt ($savePath);
377
+        }
375 378
 
376
-        if ($productDescription === null)
377
-            $productDescription = $productName;
379
+        if ($productDescription === null) {
380
+                    $productDescription = $productName;
381
+        }
378 382
 
379
-        if ($productVersion === null)
380
-            $productVersion = '1.0';
383
+        if ($productVersion === null) {
384
+                    $productVersion = '1.0';
385
+        }
381 386
 
382
-        if ($companyName === null)
383
-            $companyName = 'Company N';
387
+        if ($companyName === null) {
388
+                    $companyName = 'Company N';
389
+        }
384 390
 
385
-        if ($copyright === null)
386
-            $copyright = $companyName .' copyright (c) '. date ('Y');
391
+        if ($copyright === null) {
392
+                    $copyright = $companyName .' copyright (c) '. date ('Y');
393
+        }
387 394
 
388 395
         return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
389 396
     }
@@ -396,9 +403,7 @@  discard block
 block discarded – undo
396 403
         try
397 404
         {
398 405
             (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
399
-        }
400
-
401
-        catch (\WinFormsException $e)
406
+        } catch (\WinFormsException $e)
402 407
         {
403 408
             return false;
404 409
         }
@@ -410,8 +415,9 @@  discard block
 block discarded – undo
410 415
     {
411 416
         $property = VoidEngine::callMethod (VoidEngine::callMethod ($selector, 'GetType'), 'GetProperty', $name);
412 417
 
413
-        if (!is_int ($property))
414
-            return false;
418
+        if (!is_int ($property)) {
419
+                    return false;
420
+        }
415 421
 
416 422
         try
417 423
         {
@@ -454,9 +460,7 @@  discard block
 block discarded – undo
454 460
                         VoidEngine::getProperty ($selector, [$name, 'int']);
455 461
 
456 462
                         $property = 'int';
457
-                    }
458
-
459
-                    catch (\WinFormsException $e)
463
+                    } catch (\WinFormsException $e)
460 464
                     {
461 465
                         return [
462 466
                             'type'  => 'vrsf',
@@ -465,9 +469,7 @@  discard block
 block discarded – undo
465 469
                     }
466 470
                 break;
467 471
             }
468
-        }
469
-
470
-        catch (\Throwable $e)
472
+        } catch (\Throwable $e)
471 473
         {
472 474
             $property = 'object';
473 475
         }
@@ -485,8 +487,9 @@  discard block
 block discarded – undo
485 487
         $props = VoidEngine::callMethod (VoidEngine::callMethod ($object, 'GetType'), 'GetEvents');
486 488
         $len   = VoidEngine::getProperty ($props, 'Length');
487 489
 
488
-        for ($i = 0; $i < $len; ++$i)
489
-            $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
490
+        for ($i = 0; $i < $len; ++$i) {
491
+                    $events[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($props, $i), 'Name');
492
+        }
490 493
 
491 494
         return $events;
492 495
     }
@@ -516,8 +519,9 @@  discard block
 block discarded – undo
516 519
 
517 520
     public function __construct ($object, $classGroup = false, ...$args)
518 521
     {
519
-        foreach ($args as $id => $arg)
520
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
522
+        foreach ($args as $id => $arg) {
523
+                    $args[$id] = EngineAdditions::uncoupleSelector ($arg);
524
+        }
521 525
 
522 526
         if (is_string ($object))
523 527
         {
@@ -525,35 +529,31 @@  discard block
 block discarded – undo
525 529
             
526 530
             /*$this->selector = VoidEngine::createObject ($object, $classGroup == 'auto' ?
527 531
                 substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args);*/
532
+        } elseif (is_int ($object) && VoidEngine::objectExists ($object)) {
533
+                    $this->selector = $object;
534
+        } else {
535
+            throw new \Exception ('$object parameter must be string or object selector');
528 536
         }
529
-
530
-        elseif (is_int ($object) && VoidEngine::objectExists ($object))
531
-            $this->selector = $object;
532
-
533
-        else throw new \Exception ('$object parameter must be string or object selector');
534 537
     }
535 538
     
536 539
     public function __get ($name)
537 540
 	{
538
-        if (method_exists ($this, $method = "get_$name"))
539
-            $value = $this->$method ();
540
-
541
-        elseif (substr ($name, -5) == 'Event')
542
-            $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
543
-
544
-        elseif (property_exists ($this, $name))
545
-            $value = $this->$name;
546
-
547
-        else switch (strtolower ($name))
541
+        if (method_exists ($this, $method = "get_$name")) {
542
+                    $value = $this->$method ();
543
+        } elseif (substr ($name, -5) == 'Event') {
544
+                    $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
545
+        } elseif (property_exists ($this, $name)) {
546
+                    $value = $this->$name;
547
+        } else {
548
+            switch (strtolower ($name))
548 549
         {
549 550
             case 'count':
550 551
             case 'length':
551 552
                 try
552 553
                 {
553 554
                     return $this->getProperty ('Count');
554
-                }
555
-
556
-                catch (\WinFormsException $e)
555
+        }
556
+                } catch (\WinFormsException $e)
557 557
                 {
558 558
                     return $this->getProperty ('Length');
559 559
                 }
@@ -563,8 +563,9 @@  discard block
 block discarded – undo
563 563
                 $size = $this->count;
564 564
                 $list = [];
565 565
                 
566
-				for ($i = 0; $i < $size; ++$i)
567
-                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
566
+				for ($i = 0; $i < $size; ++$i) {
567
+				                    $list[] = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $i));
568
+				}
568 569
                 
569 570
                 return $list;
570 571
             break;
@@ -573,13 +574,12 @@  discard block
 block discarded – undo
573 574
                 $size = $this->count;
574 575
                 $names = [];
575 576
                 
576
-                for ($i = 0; $i < $size; ++$i)
577
-                    try
577
+                for ($i = 0; $i < $size; ++$i) {
578
+                                    try
578 579
                     {
579 580
                         $names[] = VoidEngine::getProperty (VoidEngine::getArrayValue ($this->selector, [$i, 'object']), 'Text');
580
-                    }
581
-
582
-                    catch (\WinFormsException $e)
581
+                }
582
+                    } catch (\WinFormsException $e)
583 583
                     {
584 584
                         $names[] = VoidEngine::getArrayValue ($this->selector, [$i, 'string']);
585 585
                     }
@@ -597,10 +597,11 @@  discard block
 block discarded – undo
597 597
 	
598 598
 	public function __set ($name, $value)
599 599
 	{
600
-        if (method_exists ($this, $method = "set_$name"))
601
-            try
600
+        if (method_exists ($this, $method = "set_$name")) {
601
+                    try
602 602
             {
603 603
                 return $this->$method ($value);
604
+        }
604 605
             }
605 606
 
606 607
             # Метод "set_$name" может принимать в качестве параметра объект WFObject
@@ -610,15 +611,13 @@  discard block
 block discarded – undo
610 611
             {
611 612
                 return $value instanceof WFObject ?
612 613
                     $this->$method ($value->selector) : null;
613
-            }
614
-
615
-        elseif (substr ($name, -5) == 'Event')
616
-            Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
617
-        
618
-        else
614
+            } elseif (substr ($name, -5) == 'Event') {
615
+                    Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
616
+        } else
619 617
         {
620
-            if (is_array ($value) && is_string (current ($value)))
621
-                $value = getNetArray ('System.String', $value);
618
+            if (is_array ($value) && is_string (current ($value))) {
619
+                            $value = getNetArray ('System.String', $value);
620
+            }
622 621
 
623 622
             $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
624 623
         }
@@ -636,11 +635,12 @@  discard block
 block discarded – undo
636 635
 
637 636
     public function addRange ($values, $assoc = false): void
638 637
     {
639
-        if (is_array ($values))
640
-            foreach ($values as $id => $value)
638
+        if (is_array ($values)) {
639
+                    foreach ($values as $id => $value)
641 640
                 $this->offsetSet ($assoc ? $id : null, $value);
642
-
643
-        else $this->callMethod ('AddRange', EngineAdditions::uncoupleSelector ($values));
641
+        } else {
642
+            $this->callMethod ('AddRange', EngineAdditions::uncoupleSelector ($values));
643
+        }
644 644
     }
645 645
     
646 646
     public function offsetSet ($index, $value)
@@ -650,9 +650,7 @@  discard block
 block discarded – undo
650 650
             return $index === null ?
651 651
                 $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
652 652
                 $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
653
-        }
654
-
655
-        catch (\Throwable $e)
653
+        } catch (\Throwable $e)
656 654
         {
657 655
             return $index === null ?
658 656
                 VoidEngine::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) :
@@ -675,9 +673,7 @@  discard block
 block discarded – undo
675 673
         try
676 674
         {
677 675
             $this->offsetGet ($index);
678
-        }
679
-
680
-        catch (\Exception $e)
676
+        } catch (\Exception $e)
681 677
         {
682 678
             return false;
683 679
         }
@@ -704,8 +700,9 @@  discard block
 block discarded – undo
704 700
     {
705 701
         $size = $this->count;
706 702
 
707
-        for ($i = 0; $i < $size; ++$i)
708
-            $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
703
+        for ($i = 0; $i < $size; ++$i) {
704
+                    $callback (EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
705
+        }
709 706
     }
710 707
 
711 708
     public function where (callable $comparator, string $type = null): array
@@ -713,9 +710,10 @@  discard block
 block discarded – undo
713 710
         $size   = $this->count;
714 711
         $return = [];
715 712
 
716
-        for ($i = 0; $i < $size; ++$i)
717
-            if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
713
+        for ($i = 0; $i < $size; ++$i) {
714
+                    if ($comparator ($value = EngineAdditions::coupleSelector (VoidEngine::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
718 715
                 $return[] = $value;
716
+        }
719 717
 
720 718
         return $return;
721 719
     }
@@ -725,9 +723,7 @@  discard block
 block discarded – undo
725 723
         try
726 724
         {
727 725
             return VoidEngine::getProperty ($this->selector, $name);
728
-        }
729
-
730
-        catch (\WinFormsException $e)
726
+        } catch (\WinFormsException $e)
731 727
         {
732 728
             return VoidEngine::getField ($this->selector, $name);
733 729
         }
@@ -738,9 +734,7 @@  discard block
 block discarded – undo
738 734
         try
739 735
         {
740 736
             VoidEngine::setProperty ($this->selector, $name, $value);
741
-        }
742
-
743
-        catch (\WinFormsException $e)
737
+        } catch (\WinFormsException $e)
744 738
         {
745 739
             VoidEngine::setField ($this->selector, $name, $value);
746 740
         }
@@ -757,8 +751,9 @@  discard block
 block discarded – undo
757 751
         $size   = VoidEngine::getProperty ($array, 'Length');
758 752
         $return = [];
759 753
 
760
-		for ($i = 0; $i < $size; ++$i)
761
-            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
754
+		for ($i = 0; $i < $size; ++$i) {
755
+		            $return[] = VoidEngine::getArrayValue ($array, $type === null ? $i : [$i, $type]);
756
+		}
762 757
         
763 758
         VoidEngine::removeObjects ($array);
764 759
         
@@ -770,9 +765,7 @@  discard block
 block discarded – undo
770 765
 		try
771 766
 		{
772 767
 			return $this->getProperty ('Name');
773
-        }
774
-        
775
-		catch (\Throwable $e)
768
+        } catch (\Throwable $e)
776 769
 		{
777 770
 			return $this->name;
778 771
 		}
@@ -783,9 +776,7 @@  discard block
 block discarded – undo
783 776
 		try
784 777
 		{
785 778
 			$this->setProperty ('Name', $name);
786
-        }
787
-        
788
-		catch (\Throwable $e)
779
+        } catch (\Throwable $e)
789 780
 		{
790 781
 			$this->name = $name;
791 782
 		}
@@ -801,12 +792,12 @@  discard block
 block discarded – undo
801 792
 {
802 793
     public function __construct ($class, $classGroup = false)
803 794
     {
804
-        if (is_string ($class))
805
-            $this->selector = VoidEngine::createClass ($class, $classGroup);
806
-
807
-        elseif (is_int ($class) && VoidEngine::objectExists ($class))
808
-            $this->selector = $class;
809
-
810
-        else throw new \Exception ('$class parameter must be string or class selector');
795
+        if (is_string ($class)) {
796
+                    $this->selector = VoidEngine::createClass ($class, $classGroup);
797
+        } elseif (is_int ($class) && VoidEngine::objectExists ($class)) {
798
+                    $this->selector = $class;
799
+        } else {
800
+            throw new \Exception ('$class parameter must be string or class selector');
801
+        }
811 802
     }
812 803
 }
Please login to merge, or discard this patch.
engine/common/Others.php 2 patches
Spacing   +125 added lines, -126 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,216 +12,216 @@  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 enum_parse (string $baseType, string $value)
65
+function enum_parse(string $baseType, string $value)
66 66
 {
67 67
     try
68 68
     {
69
-        return VoidEngine::callMethod (VoidEngine::createClass ('System.Enum',''), ['parse', 'object'], VoidEngine::objectType ($baseType), $value, true);
69
+        return VoidEngine::callMethod(VoidEngine::createClass('System.Enum', ''), ['parse', 'object'], VoidEngine::objectType($baseType), $value, true);
70 70
     }
71 71
 
72 72
     catch (\WinFormsException $e)
73 73
     {
74
-        return (new WFClass ($baseType))->$value;
74
+        return (new WFClass($baseType))->$value;
75 75
     }
76 76
 }
77 77
 
78
-function getNetArray (string $type, array $items = []): WFObject
78
+function getNetArray(string $type, array $items = []): WFObject
79 79
 {
80
-    $array = (new WFClass ('System.Array', null))
81
-        ->createInstance (VoidEngine::objectType ($type), $size = sizeof ($items));
80
+    $array = (new WFClass('System.Array', null))
81
+        ->createInstance(VoidEngine::objectType($type), $size = sizeof($items));
82 82
 
83 83
     for ($i = 0; $i < $size; ++$i)
84
-        $array[$i] = array_shift ($items);
84
+        $array[$i] = array_shift($items);
85 85
     
86 86
     return $array;
87 87
 }
88 88
 
89
-function dir_create (string $path, int $mode = 0777): void
89
+function dir_create(string $path, int $mode = 0777): void
90 90
 {
91
-    if (!is_dir ($path))
92
-        mkdir ($path, $mode, true);
91
+    if (!is_dir($path))
92
+        mkdir($path, $mode, true);
93 93
 }
94 94
 
95
-function dir_delete (string $path): bool
95
+function dir_delete(string $path): bool
96 96
 {
97
-    if (!is_dir ($path))
97
+    if (!is_dir($path))
98 98
         return false;
99 99
 
100
-    foreach (array_slice (scandir ($path), 2) as $file)
101
-        if (is_dir ($file = $path .'/'. $file))
100
+    foreach (array_slice(scandir($path), 2) as $file)
101
+        if (is_dir($file = $path.'/'.$file))
102 102
         {
103
-            dir_delete ($file);
103
+            dir_delete($file);
104 104
 
105
-            if (is_dir ($file))
106
-                rmdir ($file);
105
+            if (is_dir($file))
106
+                rmdir($file);
107 107
         }
108 108
 
109
-        else unlink ($file);
109
+        else unlink($file);
110 110
 
111
-    rmdir ($path);
111
+    rmdir($path);
112 112
 
113 113
     return true;
114 114
 }
115 115
 
116
-function dir_clean (string $path): void
116
+function dir_clean(string $path): void
117 117
 {
118
-    dir_delete ($path);
119
-    dir_create ($path);
118
+    dir_delete($path);
119
+    dir_create($path);
120 120
 }
121 121
 
122
-function dir_copy (string $from, string $to): bool
122
+function dir_copy(string $from, string $to): bool
123 123
 {
124
-    if (!is_dir ($from))
124
+    if (!is_dir($from))
125 125
         return false;
126 126
 
127
-    if (!is_dir ($to))
128
-        dir_create ($to);
127
+    if (!is_dir($to))
128
+        dir_create($to);
129 129
 
130
-    foreach (array_slice (scandir ($from), 2) as $file)
131
-        if (is_dir ($f = $from .'/'. $file))
132
-            dir_copy ($f, $to .'/'. $file);
130
+    foreach (array_slice(scandir($from), 2) as $file)
131
+        if (is_dir($f = $from.'/'.$file))
132
+            dir_copy($f, $to.'/'.$file);
133 133
 
134
-        else copy ($f, $to .'/'. $file);
134
+        else copy($f, $to.'/'.$file);
135 135
 
136 136
     return true;
137 137
 }
138 138
 
139
-function getARGBColor (string $color)
139
+function getARGBColor(string $color)
140 140
 {
141
-    return (new WFClass ('System.Drawing.ColorTranslator'))->fromHtml ($color);
141
+    return (new WFClass('System.Drawing.ColorTranslator'))->fromHtml($color);
142 142
 }
143 143
 
144
-function replaceSl (string $string): string
144
+function replaceSl(string $string): string
145 145
 {
146
-    return str_replace ('\\', '/', $string);
146
+    return str_replace('\\', '/', $string);
147 147
 }
148 148
 
149
-function replaceSr (string $string): string
149
+function replaceSr(string $string): string
150 150
 {
151
-    return str_replace ('/', '\\', $string);
151
+    return str_replace('/', '\\', $string);
152 152
 }
153 153
 
154
-function basenameNoExt (string $path): string
154
+function basenameNoExt(string $path): string
155 155
 {
156
-    return pathinfo ($path, PATHINFO_FILENAME);
156
+    return pathinfo($path, PATHINFO_FILENAME);
157 157
 }
158 158
 
159
-function file_ext (string $path): string
159
+function file_ext(string $path): string
160 160
 {
161
-    return strtolower (pathinfo ($path, PATHINFO_EXTENSION));
161
+    return strtolower(pathinfo($path, PATHINFO_EXTENSION));
162 162
 }
163 163
 
164
-function filepathNoExt (string $path): string
164
+function filepathNoExt(string $path): string
165 165
 {
166
-    return dirname ($path) .'/'. basenameNoExt ($path);
166
+    return dirname($path).'/'.basenameNoExt($path);
167 167
 }
168 168
 
169
-function array_first (array $array)
169
+function array_first(array $array)
170 170
 {
171
-    return array_shift ($array);
171
+    return array_shift($array);
172 172
 }
173 173
 
174
-function array_end (array $array)
174
+function array_end(array $array)
175 175
 {
176
-    return array_pop ($array);
176
+    return array_pop($array);
177 177
 }
178 178
 
179
-function substr_icount (string $haystack, string $needle, ...$params): int
179
+function substr_icount(string $haystack, string $needle, ...$params): int
180 180
 {
181
-	return substr_count (strtolower ($haystack), strtolower ($needle), ...$params);
181
+	return substr_count(strtolower($haystack), strtolower($needle), ...$params);
182 182
 }
183 183
 
184
-function str_replace_assoc (string $subject, array $replacements): string
184
+function str_replace_assoc(string $subject, array $replacements): string
185 185
 {
186
-	return str_replace (array_keys ($replacements), array_values ($replacements), $subject);
186
+	return str_replace(array_keys($replacements), array_values($replacements), $subject);
187 187
 }
188 188
 
189
-function pre (...$args): void
189
+function pre(...$args): void
190 190
 {
191
-	message (sizeof ($args) < 2 ? current ($args) : $args);
191
+	message(sizeof($args) < 2 ? current ($args) : $args);
192 192
 }
193 193
 
194
-function messageBox (string $message, string $caption = '', ...$args)
194
+function messageBox(string $message, string $caption = '', ...$args)
195 195
 {
196
-    return (new MessageBox)->show ($message, $caption, ...$args);
196
+    return (new MessageBox)->show($message, $caption, ...$args);
197 197
 }
198 198
 
199 199
 class Components
200 200
 {
201 201
     static array $components = [];
202 202
 
203
-    public static function addComponent (int $selector, object $object): void
203
+    public static function addComponent(int $selector, object $object): void
204 204
     {
205 205
         self::$components[$selector] = $object;
206 206
     }
207 207
 
208
-    public static function getComponent (int $selector)
208
+    public static function getComponent(int $selector)
209 209
     {
210 210
         return isset (self::$components[$selector]) ?
211 211
             self::$components[$selector] : false;
212 212
     }
213 213
 
214
-    public static function componentExists (int $selector): bool
214
+    public static function componentExists(int $selector): bool
215 215
     {
216 216
         return isset (self::$components[$selector]);
217 217
     }
218 218
 
219
-    public static function removeComponent (int $selector): void
219
+    public static function removeComponent(int $selector): void
220 220
     {
221 221
         unset (self::$components[$selector]);
222 222
     }
223 223
 
224
-    public static function cleanJunk (): void
224
+    public static function cleanJunk(): void
225 225
     {
226 226
         // TODO: более строгие правила очистки мусорных объектов
227 227
         
@@ -229,46 +229,46 @@  discard block
 block discarded – undo
229 229
         {
230 230
             try
231 231
             {
232
-                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))
232
+                if ($object->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')))
233 233
                     continue;
234 234
             }
235 235
 
236 236
             catch (\Exception $e) {}
237 237
             
238
-            VoidEngine::destructObject ($selector);
238
+            VoidEngine::destructObject($selector);
239 239
 
240
-            if (!VoidEngine::objectExists ($selector))
240
+            if (!VoidEngine::objectExists($selector))
241 241
                 unset (self::$components[$selector]);
242 242
         }
243 243
     }
244 244
 }
245 245
 
246
-function _c (int $selector)
246
+function _c(int $selector)
247 247
 {
248
-    return Components::getComponent ($selector);
248
+    return Components::getComponent($selector);
249 249
 }
250 250
 
251
-function c ($name, bool $returnAllSimilarObjects = false)
251
+function c($name, bool $returnAllSimilarObjects = false)
252 252
 {
253
-    if (is_int ($name) && is_object ($object = _c ($name)))
253
+    if (is_int($name) && is_object($object = _c($name)))
254 254
         return $object;
255 255
 
256 256
     else
257 257
     {
258
-        $path    = explode ('->', $name);
258
+        $path    = explode('->', $name);
259 259
         $similar = [];
260 260
 
261 261
         foreach (Components::$components as $object)
262 262
             try
263 263
             {
264
-                if ($object->name == end ($path))
264
+                if ($object->name == end($path))
265 265
                 {
266
-                    if (sizeof ($path) > 1)
266
+                    if (sizeof($path) > 1)
267 267
                         try
268 268
                         {
269
-                            if (is_object ($parent = _c($object->parent->selector)))
269
+                            if (is_object($parent = _c($object->parent->selector)))
270 270
                             {
271
-                                if (c(join ('->', array_slice ($path, 0, -1))) == $parent)
271
+                                if (c(join('->', array_slice($path, 0, -1))) == $parent)
272 272
                                 {
273 273
                                     if ($returnAllSimilarObjects)
274 274
                                         $similar[] = $object;
@@ -302,18 +302,18 @@  discard block
 block discarded – undo
302 302
                 continue;
303 303
             }
304 304
 
305
-        if (sizeof ($path) == 2)
305
+        if (sizeof($path) == 2)
306 306
         {
307 307
             $objects = c($path[1], true);
308 308
 
309
-            if (is_array ($objects))
309
+            if (is_array($objects))
310 310
             {
311 311
                 foreach ($objects as $id => $object)
312 312
                     try
313 313
                     {
314
-                        while (is_object ($parent = _c($object->parent->selector)))
314
+                        while (is_object($parent = _c($object->parent->selector)))
315 315
                         {
316
-                            if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
316
+                            if ($parent->getType()->isSubclassOf(VoidEngine::objectType('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
317 317
                                 return $objects[$id];
318 318
 
319 319
                             else $object = $parent;
@@ -331,70 +331,70 @@  discard block
 block discarded – undo
331 331
             else return false;
332 332
         }
333 333
 
334
-        else return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
334
+        else return $returnAllSimilarObjects && sizeof($similar) > 0 ?
335 335
             $similar : false;
336 336
     }
337 337
 }
338 338
 
339
-function setTimer (int $interval, callable $function): Timer
339
+function setTimer(int $interval, callable $function): Timer
340 340
 {
341 341
     $timer = new Timer;
342 342
     $timer->interval = $interval;
343 343
     
344
-    $timer->tickEvent = function ($self) use ($function)
344
+    $timer->tickEvent = function($self) use ($function)
345 345
     {
346
-        call_user_func ($function, $self);
346
+        call_user_func($function, $self);
347 347
     };
348 348
     
349
-	$timer->start ();
349
+	$timer->start();
350 350
     
351 351
     return $timer;
352 352
 }
353 353
 
354 354
 // FIXME: выполняется несколько раз, а не единожды
355
-function setTimeout (int $timeout, callable $function): Timer
355
+function setTimeout(int $timeout, callable $function): Timer
356 356
 {
357 357
     $timer = new Timer;
358 358
     $timer->interval = $timeout;
359 359
     
360
-    $timer->tickEvent = function ($self) use ($function)
360
+    $timer->tickEvent = function($self) use ($function)
361 361
     {
362
-        call_user_func ($function, $self);
362
+        call_user_func($function, $self);
363 363
 
364
-        $self->stop ();
364
+        $self->stop();
365 365
     };
366 366
     
367
-    $timer->start ();
367
+    $timer->start();
368 368
     
369 369
 	return $timer;
370 370
 }
371 371
 
372 372
 class Clipboard
373 373
 {
374
-    public static function getText ()
374
+    public static function getText()
375 375
     {
376
-        return (new WFClass ('System.Windows.Forms.Clipboard'))->getText ();
376
+        return (new WFClass('System.Windows.Forms.Clipboard'))->getText();
377 377
     }
378 378
     
379
-    public static function setText (string $text): void
379
+    public static function setText(string $text): void
380 380
     {
381
-        (new WFClass ('System.Windows.Forms.Clipboard'))->setText ($text);
381
+        (new WFClass('System.Windows.Forms.Clipboard'))->setText($text);
382 382
     }
383 383
     
384
-    public static function getFiles (): array
384
+    public static function getFiles(): array
385 385
     {
386
-        return (new WFClass ('System.Windows.Forms.Clipboard'))->getFileDropList ()->list;
386
+        return (new WFClass('System.Windows.Forms.Clipboard'))->getFileDropList()->list;
387 387
     }
388 388
     
389
-    public static function setFiles (array $files): void
389
+    public static function setFiles(array $files): void
390 390
     {
391
-        $collection = new WFObject ('System.Collections.Specialized.StringCollection');
391
+        $collection = new WFObject('System.Collections.Specialized.StringCollection');
392 392
 
393 393
         foreach ($files as $file)
394
-            $collection->add ((string) $file);
394
+            $collection->add((string) $file);
395 395
 
396
-        (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection);
397
-        VoidEngine::removeObjects ($collection->selector);
396
+        (new WFClass('System.Windows.Forms.Clipboard'))->setFileDropList($collection);
397
+        VoidEngine::removeObjects($collection->selector);
398 398
     }
399 399
 }
400 400
 
@@ -402,14 +402,13 @@  discard block
 block discarded – undo
402 402
 {
403 403
     protected $cursor;
404 404
 
405
-    public function __construct (int $handle = null)
405
+    public function __construct(int $handle = null)
406 406
     {
407 407
         $handle !== null ?
408
-            $this->cursor = new WFObject ('System.Windows.Forms.Cursor', false, $handle) :
409
-            $this->cursor = new WFClass ('System.Windows.Forms.Cursor');
408
+            $this->cursor = new WFObject('System.Windows.Forms.Cursor', false, $handle) : $this->cursor = new WFClass('System.Windows.Forms.Cursor');
410 409
     }
411 410
 
412
-    public function getPosition (): array
411
+    public function getPosition(): array
413 412
     {
414 413
         $pos = $this->cursor->position;
415 414
 
@@ -420,22 +419,22 @@  discard block
 block discarded – undo
420 419
     }
421 420
 }
422 421
 
423
-function get_cursor_x (int $handle = null): int
422
+function get_cursor_x(int $handle = null): int
424 423
 {
425
-    return (new Cursor ($handle))->getPosition ()[0];
424
+    return (new Cursor($handle))->getPosition()[0];
426 425
 }
427 426
 
428
-function get_cursor_y (int $handle = null): int
427
+function get_cursor_y(int $handle = null): int
429 428
 {
430
-    return (new Cursor ($handle))->getPosition ()[1];
429
+    return (new Cursor($handle))->getPosition()[1];
431 430
 }
432 431
 
433
-function get_cursor_pos (int $handle = null): array
432
+function get_cursor_pos(int $handle = null): array
434 433
 {
435
-    return (new Cursor ($handle))->getPosition ();
434
+    return (new Cursor($handle))->getPosition();
436 435
 }
437 436
 
438
-set_error_handler (function ($no, $str, $file, $line)
437
+set_error_handler(function($no, $str, $file, $line)
439 438
 {
440 439
     // Мог ли я здесь сделать более адекватный код с использованием pow/sqrt? Да, мог
441 440
     // Почему не сделал? Скорость важнее
@@ -458,7 +457,7 @@  discard block
 block discarded – undo
458 457
     ];
459 458
 
460 459
     if ($GLOBALS['__debug']['error_status'])
461
-        message ([
460
+        message([
462 461
             'type'      => $errarr[$no],
463 462
             'text'      => $str,
464 463
             'file'      => $file,
Please login to merge, or discard this patch.
Braces   +82 added lines, -75 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
 {
7 7
     $oldStatus = $GLOBALS['__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,9 +66,7 @@  discard block
 block discarded – undo
67 66
     try
68 67
     {
69 68
         return VoidEngine::callMethod (VoidEngine::createClass ('System.Enum',''), ['parse', 'object'], VoidEngine::objectType ($baseType), $value, true);
70
-    }
71
-
72
-    catch (\WinFormsException $e)
69
+    } catch (\WinFormsException $e)
73 70
     {
74 71
         return (new WFClass ($baseType))->$value;
75 72
     }
@@ -80,34 +77,39 @@  discard block
 block discarded – undo
80 77
     $array = (new WFClass ('System.Array', null))
81 78
         ->createInstance (VoidEngine::objectType ($type), $size = sizeof ($items));
82 79
 
83
-    for ($i = 0; $i < $size; ++$i)
84
-        $array[$i] = array_shift ($items);
80
+    for ($i = 0; $i < $size; ++$i) {
81
+            $array[$i] = array_shift ($items);
82
+    }
85 83
     
86 84
     return $array;
87 85
 }
88 86
 
89 87
 function dir_create (string $path, int $mode = 0777): void
90 88
 {
91
-    if (!is_dir ($path))
92
-        mkdir ($path, $mode, true);
93
-}
89
+    if (!is_dir ($path)) {
90
+            mkdir ($path, $mode, true);
91
+    }
92
+    }
94 93
 
95 94
 function dir_delete (string $path): bool
96 95
 {
97
-    if (!is_dir ($path))
98
-        return false;
96
+    if (!is_dir ($path)) {
97
+            return false;
98
+    }
99 99
 
100
-    foreach (array_slice (scandir ($path), 2) as $file)
101
-        if (is_dir ($file = $path .'/'. $file))
100
+    foreach (array_slice (scandir ($path), 2) as $file) {
101
+            if (is_dir ($file = $path .'/'. $file))
102 102
         {
103 103
             dir_delete ($file);
104
+    }
104 105
 
105
-            if (is_dir ($file))
106
-                rmdir ($file);
106
+            if (is_dir ($file)) {
107
+                            rmdir ($file);
108
+            }
109
+        } else {
110
+            unlink ($file);
107 111
         }
108 112
 
109
-        else unlink ($file);
110
-
111 113
     rmdir ($path);
112 114
 
113 115
     return true;
@@ -121,17 +123,22 @@  discard block
 block discarded – undo
121 123
 
122 124
 function dir_copy (string $from, string $to): bool
123 125
 {
124
-    if (!is_dir ($from))
125
-        return false;
126
+    if (!is_dir ($from)) {
127
+            return false;
128
+    }
126 129
 
127
-    if (!is_dir ($to))
128
-        dir_create ($to);
130
+    if (!is_dir ($to)) {
131
+            dir_create ($to);
132
+    }
129 133
 
130
-    foreach (array_slice (scandir ($from), 2) as $file)
131
-        if (is_dir ($f = $from .'/'. $file))
134
+    foreach (array_slice (scandir ($from), 2) as $file) {
135
+            if (is_dir ($f = $from .'/'. $file))
132 136
             dir_copy ($f, $to .'/'. $file);
137
+    }
133 138
 
134
-        else copy ($f, $to .'/'. $file);
139
+        else {
140
+            copy ($f, $to .'/'. $file);
141
+        }
135 142
 
136 143
     return true;
137 144
 }
@@ -229,16 +236,16 @@  discard block
 block discarded – undo
229 236
         {
230 237
             try
231 238
             {
232
-                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')))
233
-                    continue;
234
-            }
235
-
236
-            catch (\Exception $e) {}
239
+                if ($object->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms'))) {
240
+                                    continue;
241
+                }
242
+            } catch (\Exception $e) {}
237 243
             
238 244
             VoidEngine::destructObject ($selector);
239 245
 
240
-            if (!VoidEngine::objectExists ($selector))
241
-                unset (self::$components[$selector]);
246
+            if (!VoidEngine::objectExists ($selector)) {
247
+                            unset (self::$components[$selector]);
248
+            }
242 249
         }
243 250
     }
244 251
 }
@@ -250,16 +257,15 @@  discard block
 block discarded – undo
250 257
 
251 258
 function c ($name, bool $returnAllSimilarObjects = false)
252 259
 {
253
-    if (is_int ($name) && is_object ($object = _c ($name)))
254
-        return $object;
255
-
256
-    else
260
+    if (is_int ($name) && is_object ($object = _c ($name))) {
261
+            return $object;
262
+    } else
257 263
     {
258 264
         $path    = explode ('->', $name);
259 265
         $similar = [];
260 266
 
261
-        foreach (Components::$components as $object)
262
-            try
267
+        foreach (Components::$components as $object) {
268
+                    try
263 269
             {
264 270
                 if ($object->name == end ($path))
265 271
                 {
@@ -272,32 +278,30 @@  discard block
 block discarded – undo
272 278
                                 {
273 279
                                     if ($returnAllSimilarObjects)
274 280
                                         $similar[] = $object;
281
+        }
275 282
 
276
-                                    else return $object;
283
+                                    else {
284
+                                        return $object;
285
+                                    }
286
+                                } else {
287
+                                    continue;
277 288
                                 }
278
-
279
-                                else continue;
289
+                            } else {
290
+                                continue;
280 291
                             }
281
-
282
-                            else continue;
283
-                        }
284
-
285
-                        catch (\Throwable $e)
292
+                        } catch (\Throwable $e)
286 293
                         {
287 294
                             continue;
288
-                        }
289
-
290
-                    else
295
+                        } else
291 296
                     {
292
-                        if ($returnAllSimilarObjects)
293
-                            $similar[] = $object;
294
-
295
-                        else return $object;
297
+                        if ($returnAllSimilarObjects) {
298
+                                                    $similar[] = $object;
299
+                        } else {
300
+                            return $object;
301
+                        }
296 302
                     }
297 303
                 }
298
-            }
299
-
300
-            catch (\Exception $e)
304
+            } catch (\Exception $e)
301 305
             {
302 306
                 continue;
303 307
             }
@@ -308,31 +312,32 @@  discard block
 block discarded – undo
308 312
 
309 313
             if (is_array ($objects))
310 314
             {
311
-                foreach ($objects as $id => $object)
312
-                    try
315
+                foreach ($objects as $id => $object) {
316
+                                    try
313 317
                     {
314 318
                         while (is_object ($parent = _c($object->parent->selector)))
315 319
                         {
316 320
                             if ($parent->getType ()->isSubclassOf (VoidEngine::objectType ('System.Windows.Forms.Form', 'System.Windows.Forms')) && $parent->name == $path[0])
317 321
                                 return $objects[$id];
322
+                }
318 323
 
319
-                            else $object = $parent;
324
+                            else {
325
+                                $object = $parent;
326
+                            }
320 327
                         }
321
-                    }
322
-
323
-                    catch (\Throwable $e)
328
+                    } catch (\Throwable $e)
324 329
 					{
325 330
 						continue;
326 331
 					}
327 332
 
328 333
                 return false;
334
+            } else {
335
+                return false;
329 336
             }
330
-
331
-            else return false;
332
-        }
333
-
334
-        else return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
337
+        } else {
338
+            return $returnAllSimilarObjects && sizeof ($similar) > 0 ?
335 339
             $similar : false;
340
+        }
336 341
     }
337 342
 }
338 343
 
@@ -390,8 +395,9 @@  discard block
 block discarded – undo
390 395
     {
391 396
         $collection = new WFObject ('System.Collections.Specialized.StringCollection');
392 397
 
393
-        foreach ($files as $file)
394
-            $collection->add ((string) $file);
398
+        foreach ($files as $file) {
399
+                    $collection->add ((string) $file);
400
+        }
395 401
 
396 402
         (new WFClass ('System.Windows.Forms.Clipboard'))->setFileDropList ($collection);
397 403
         VoidEngine::removeObjects ($collection->selector);
@@ -457,11 +463,12 @@  discard block
 block discarded – undo
457 463
         16384 => 'E_USER_DEPRECATED'
458 464
     ];
459 465
 
460
-    if ($GLOBALS['__debug']['error_status'])
461
-        message ([
466
+    if ($GLOBALS['__debug']['error_status']) {
467
+            message ([
462 468
             'type'      => $errarr[$no],
463 469
             'text'      => $str,
464 470
             'file'      => $file,
465 471
             'line'      => $line
466 472
         ], 'PHP Script Error');
467
-});
473
+    }
474
+    });
Please login to merge, or discard this patch.
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.5 build-2019/09/21';
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';
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 require 'components/FastColoredTextBox.php';
97 97
 require 'components/Scintilla.php';
98 98
 
99
-if (is_dir ('extensions'))
100
-    foreach (scandir ('extensions') as $ext)
101
-        if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php'))
99
+if (is_dir('extensions'))
100
+    foreach (scandir('extensions') as $ext)
101
+        if (is_dir('extensions/'.$ext) && file_exists($ext = 'extensions/'.$ext.'/main.php'))
102 102
             require $ext;
Please login to merge, or discard this patch.
engine/components/Component.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -9,81 +9,81 @@
 block discarded – undo
9 9
     public $class     = 'System.Windows.Forms.Component';
10 10
     public $namespace = 'System.Windows.Forms';
11 11
 
12
-    public function __construct ($className = null, ...$args)
12
+    public function __construct($className = null, ...$args)
13 13
     {
14
-        parent::__construct (
14
+        parent::__construct(
15 15
             $className === null ? $this->class : $className,
16 16
             $this->namespace ?? false,
17 17
             ...$args
18 18
         );
19 19
         
20
-        Components::addComponent ($this->selector, $this);
20
+        Components::addComponent($this->selector, $this);
21 21
     }
22 22
 	
23
-    public function __debugInfo (): array
23
+    public function __debugInfo(): array
24 24
     {
25 25
         return [
26
-            'description' => @$this->__toString (),
26
+            'description' => @$this->__toString(),
27 27
             'selector'    => @$this->selector,
28 28
             'name'        => @$this->name,
29
-            'objectInfo'  => @json_encode ($this, JSON_PRETTY_PRINT)
29
+            'objectInfo'  => @json_encode($this, JSON_PRETTY_PRINT)
30 30
         ];
31 31
     }
32 32
 
33
-    public function __unset ($name)
33
+    public function __unset($name)
34 34
     {
35 35
         if (isset ($this->$name))
36 36
         {
37
-            if (is_int ($this->$name))
37
+            if (is_int($this->$name))
38 38
             {
39
-                Components::removeComponent ($this->$name);
39
+                Components::removeComponent($this->$name);
40 40
 
41
-                if (VoidEngine::objectExists ($this->$name))
42
-                    VoidEngine::removeObjects ($this->$name);
41
+                if (VoidEngine::objectExists($this->$name))
42
+                    VoidEngine::removeObjects($this->$name);
43 43
             }
44 44
 
45 45
             elseif ($this->$name instanceof Component)
46
-                $this->$name->dispose ();
46
+                $this->$name->dispose();
47 47
         }
48 48
 
49 49
         unset ($this->$name);
50 50
     }
51 51
 
52
-    public function dispose (): void
52
+    public function dispose(): void
53 53
 	{
54
-        foreach (array_diff (get_object_vars ($this), ['selector']) as $param => $value)
54
+        foreach (array_diff(get_object_vars($this), ['selector']) as $param => $value)
55 55
         {
56
-            if (is_int ($value))
56
+            if (is_int($value))
57 57
             {
58
-                Components::removeComponent ($value);
58
+                Components::removeComponent($value);
59 59
 
60
-                if (VoidEngine::objectExists ($value))
61
-                    VoidEngine::removeObjects ($value);
60
+                if (VoidEngine::objectExists($value))
61
+                    VoidEngine::removeObjects($value);
62 62
             }
63 63
 
64 64
             elseif ($value instanceof Component)
65
-                $value->dispose ();
65
+                $value->dispose();
66 66
 
67 67
             unset ($this->$param);
68 68
         }
69 69
 
70 70
         if (isset ($this->selector))
71 71
         {
72
-            if (VoidEngine::objectExists ($this->selector))
73
-                VoidEngine::removeObjects ($this->selector);
72
+            if (VoidEngine::objectExists($this->selector))
73
+                VoidEngine::removeObjects($this->selector);
74 74
             
75
-            Components::removeComponent ($this->selector);
75
+            Components::removeComponent($this->selector);
76 76
         }
77 77
 
78
-        Components::cleanJunk ();
78
+        Components::cleanJunk();
79 79
     }
80 80
 
81
-    public function __destruct ()
81
+    public function __destruct()
82 82
     {
83
-        if (isset ($this->selector) && VoidEngine::destructObject ($this->selector))
83
+        if (isset ($this->selector) && VoidEngine::destructObject($this->selector))
84 84
         {
85
-            VoidEngine::removeObjects ($this->selector);
86
-            Components::removeComponent ($this->selector);
85
+            VoidEngine::removeObjects($this->selector);
86
+            Components::removeComponent($this->selector);
87 87
         }
88 88
     }
89 89
 }
Please login to merge, or discard this patch.
engine/components/Control.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
         $this->text = $caption;
25 25
     }
26 26
 	
27
-	public function set_font ($font): void
28
-	{
27
+    public function set_font ($font): void
28
+    {
29 29
         if (is_array ($font))
30 30
         {
31 31
             $font = array_values ($font);
Please login to merge, or discard this patch.
Spacing   +51 added lines, -52 removed lines patch added patch discarded remove patch
@@ -6,101 +6,100 @@  discard block
 block discarded – undo
6 6
 {
7 7
     public $class = 'System.Windows.Forms.Control';
8 8
 
9
-    public function __construct (Component $parent = null, $className = null, ...$args)
9
+    public function __construct(Component $parent = null, $className = null, ...$args)
10 10
     {
11
-        parent::__construct ($className, ...$args);
11
+        parent::__construct($className, ...$args);
12 12
 
13 13
         if ($parent)
14 14
             $this->parent = $parent;
15 15
     }
16 16
 	
17
-    public function get_caption (): string
17
+    public function get_caption(): string
18 18
     {
19 19
         return $this->text;
20 20
     }
21 21
 	
22
-    public function set_caption (string $caption)
22
+    public function set_caption(string $caption)
23 23
     {
24 24
         $this->text = $caption;
25 25
     }
26 26
 	
27
-	public function set_font ($font): void
27
+	public function set_font($font): void
28 28
 	{
29
-        if (is_array ($font))
29
+        if (is_array($font))
30 30
         {
31
-            $font = array_values ($font);
31
+            $font = array_values($font);
32 32
 
33 33
             $obj = isset ($font[2]) ?
34
-                VoidEngine::createObject ('System.Drawing.Font', 'System.Drawing', $font[0], $font[1], [$font[2], 'System.Drawing.FontStyle, System.Drawing']) :
35
-                VoidEngine::createObject ('System.Drawing.Font', 'System.Drawing', $font[0], $font[1]);
34
+                VoidEngine::createObject('System.Drawing.Font', 'System.Drawing', $font[0], $font[1], [$font[2], 'System.Drawing.FontStyle, System.Drawing']) : VoidEngine::createObject('System.Drawing.Font', 'System.Drawing', $font[0], $font[1]);
36 35
             
37
-            $this->setProperty ('Font', $obj);
36
+            $this->setProperty('Font', $obj);
38 37
         }
39 38
 
40
-        else $this->setProperty ('Font', EngineAdditions::uncoupleSelector ($font));
39
+        else $this->setProperty('Font', EngineAdditions::uncoupleSelector($font));
41 40
     }
42 41
 	
43
-    public function get_backgroundColor ()
42
+    public function get_backgroundColor()
44 43
     {
45
-        return $this->getProperty (['BackColor', 'color']);
44
+        return $this->getProperty(['BackColor', 'color']);
46 45
     }
47 46
 	
48
-    public function set_backgroundColor ($color)
47
+    public function set_backgroundColor($color)
49 48
     {
50
-        $this->setProperty ('BackColor', $color);
49
+        $this->setProperty('BackColor', $color);
51 50
     }
52 51
 	
53
-    public function get_foregroundColor ()
52
+    public function get_foregroundColor()
54 53
     {
55
-        return $this->getProperty (['ForeColor', 'color']);
54
+        return $this->getProperty(['ForeColor', 'color']);
56 55
     }
57 56
 	
58
-    public function set_foregroundColor ($color)
57
+    public function set_foregroundColor($color)
59 58
     {
60
-        $this->setProperty ('ForeColor', $color);
59
+        $this->setProperty('ForeColor', $color);
61 60
     }
62 61
 	
63
-    public function get_w (): int
62
+    public function get_w(): int
64 63
     {
65 64
         return $this->width;
66 65
     }
67 66
 	
68
-    public function set_w (int $w)
67
+    public function set_w(int $w)
69 68
     {
70 69
         $this->width = $w;
71 70
     }
72 71
 	
73
-    public function get_h (): int
72
+    public function get_h(): int
74 73
     {
75 74
         return $this->height;
76 75
     }
77 76
 	
78
-    public function set_h (int $h)
77
+    public function set_h(int $h)
79 78
     {
80 79
         $this->height = $h;
81 80
     }
82 81
 	
83
-    public function get_x (): int
82
+    public function get_x(): int
84 83
     {
85 84
         return $this->left;
86 85
     }
87 86
 	
88
-    public function set_x (int $x)
87
+    public function set_x(int $x)
89 88
     {
90 89
         $this->left = $x;
91 90
     }
92 91
 	
93
-    public function get_y (): int
92
+    public function get_y(): int
94 93
     {
95 94
         return $this->top;
96 95
     }
97 96
 	
98
-    public function set_y (int $y)
97
+    public function set_y(int $y)
99 98
     {
100 99
         $this->top = $y;
101 100
     }
102 101
 
103
-    public function get_bounds (): array
102
+    public function get_bounds(): array
104 103
     {
105 104
         return [
106 105
             $this->left,
@@ -110,11 +109,11 @@  discard block
 block discarded – undo
110 109
         ];
111 110
     }
112 111
 	
113
-    public function set_bounds ($bounds)
112
+    public function set_bounds($bounds)
114 113
     {
115
-        if (is_array ($bounds))
114
+        if (is_array($bounds))
116 115
         {
117
-            $bounds = array_values ($bounds);
116
+            $bounds = array_values($bounds);
118 117
             
119 118
             $this->left   = (int) $bounds[0];
120 119
             $this->top    = (int) $bounds[1];
@@ -122,10 +121,10 @@  discard block
 block discarded – undo
122 121
             $this->height = (int) $bounds[3];
123 122
         }
124 123
 
125
-        else $this->setProperty ('Bounds', EngineAdditions::uncoupleSelector ($bounds));
124
+        else $this->setProperty('Bounds', EngineAdditions::uncoupleSelector($bounds));
126 125
     }
127 126
 	
128
-    public function get_location (): array
127
+    public function get_location(): array
129 128
     {
130 129
         return [
131 130
             $this->left,
@@ -133,20 +132,20 @@  discard block
 block discarded – undo
133 132
         ];
134 133
     }
135 134
 	
136
-    public function set_location ($location)
135
+    public function set_location($location)
137 136
     {
138
-        if (is_array ($location))
137
+        if (is_array($location))
139 138
         {
140
-            $location = array_values ($location);
139
+            $location = array_values($location);
141 140
             
142 141
             $this->left = $location[0];
143 142
             $this->top  = $location[1];
144 143
         }
145 144
 
146
-        else $this->setProperty ('Location', EngineAdditions::uncoupleSelector ($location));
145
+        else $this->setProperty('Location', EngineAdditions::uncoupleSelector($location));
147 146
     }
148 147
 	
149
-    public function get_size (): array
148
+    public function get_size(): array
150 149
     {
151 150
         return [
152 151
             $this->width,
@@ -154,42 +153,42 @@  discard block
 block discarded – undo
154 153
         ];
155 154
     }
156 155
 	
157
-    public function set_size ($size)
156
+    public function set_size($size)
158 157
     {
159
-        if (is_array ($size))
158
+        if (is_array($size))
160 159
         {
161
-            $size = array_values ($size);
160
+            $size = array_values($size);
162 161
             
163 162
             $this->width  = (int) $size[0];
164 163
             $this->height = (int) $size[1];
165 164
         }
166 165
 
167
-        else $this->setProperty ('Size', EngineAdditions::uncoupleSelector ($size));
166
+        else $this->setProperty('Size', EngineAdditions::uncoupleSelector($size));
168 167
     }
169 168
 	
170
-    public function setBounds (int $x, int $y, int $w, int $h)
169
+    public function setBounds(int $x, int $y, int $w, int $h)
171 170
     {
172
-        $this->set_bounds ([$x, $y, $w, $h]);
171
+        $this->set_bounds([$x, $y, $w, $h]);
173 172
     }
174 173
 	
175
-    public function setLocation (int $x, int $y)
174
+    public function setLocation(int $x, int $y)
176 175
     {
177
-        $this->set_location ([$x, $y]);
176
+        $this->set_location([$x, $y]);
178 177
     }
179 178
 	
180
-    public function setSize (int $w, int $h)
179
+    public function setSize(int $w, int $h)
181 180
     {
182
-        $this->set_size ([$w, $h]);
181
+        $this->set_size([$w, $h]);
183 182
     }
184 183
 	
185
-    public function toBack ()
184
+    public function toBack()
186 185
     {
187
-        $this->callMethod ('SendToBack');
186
+        $this->callMethod('SendToBack');
188 187
     }
189 188
 	
190
-    public function toFront ()
189
+    public function toFront()
191 190
     {
192
-        $this->callMethod ('BringToFront');
191
+        $this->callMethod('BringToFront');
193 192
     }
194 193
 }
195 194
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
     {
11 11
         parent::__construct ($className, ...$args);
12 12
 
13
-        if ($parent)
14
-            $this->parent = $parent;
13
+        if ($parent) {
14
+                    $this->parent = $parent;
15
+        }
15 16
     }
16 17
 	
17 18
     public function get_caption (): string
@@ -35,9 +36,9 @@  discard block
 block discarded – undo
35 36
                 VoidEngine::createObject ('System.Drawing.Font', 'System.Drawing', $font[0], $font[1]);
36 37
             
37 38
             $this->setProperty ('Font', $obj);
39
+        } else {
40
+            $this->setProperty ('Font', EngineAdditions::uncoupleSelector ($font));
38 41
         }
39
-
40
-        else $this->setProperty ('Font', EngineAdditions::uncoupleSelector ($font));
41 42
     }
42 43
 	
43 44
     public function get_backgroundColor ()
@@ -120,9 +121,9 @@  discard block
 block discarded – undo
120 121
             $this->top    = (int) $bounds[1];
121 122
             $this->width  = (int) $bounds[2];
122 123
             $this->height = (int) $bounds[3];
124
+        } else {
125
+            $this->setProperty ('Bounds', EngineAdditions::uncoupleSelector ($bounds));
123 126
         }
124
-
125
-        else $this->setProperty ('Bounds', EngineAdditions::uncoupleSelector ($bounds));
126 127
     }
127 128
 	
128 129
     public function get_location (): array
@@ -141,9 +142,9 @@  discard block
 block discarded – undo
141 142
             
142 143
             $this->left = $location[0];
143 144
             $this->top  = $location[1];
145
+        } else {
146
+            $this->setProperty ('Location', EngineAdditions::uncoupleSelector ($location));
144 147
         }
145
-
146
-        else $this->setProperty ('Location', EngineAdditions::uncoupleSelector ($location));
147 148
     }
148 149
 	
149 150
     public function get_size (): array
@@ -162,9 +163,9 @@  discard block
 block discarded – undo
162 163
             
163 164
             $this->width  = (int) $size[0];
164 165
             $this->height = (int) $size[1];
166
+        } else {
167
+            $this->setProperty ('Size', EngineAdditions::uncoupleSelector ($size));
165 168
         }
166
-
167
-        else $this->setProperty ('Size', EngineAdditions::uncoupleSelector ($size));
168 169
     }
169 170
 	
170 171
     public function setBounds (int $x, int $y, int $w, int $h)
Please login to merge, or discard this patch.
engine/components/TreeView.php 1 patch
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,9 +11,7 @@
 block discarded – undo
11 11
         try
12 12
         {
13 13
             $node = $this->selectedNode;
14
-        }
15
-
16
-        catch (\WinFormsException $e)
14
+        } catch (\WinFormsException $e)
17 15
         {
18 16
             return false;
19 17
         }
Please login to merge, or discard this patch.
engine/components/ColorDialog.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 {
7 7
     public $class = 'System.Windows.Forms.ColorDialog';
8 8
 
9
-    public function __construct ()
9
+    public function __construct()
10 10
     {
11
-        parent::__construct ($this->class);
11
+        parent::__construct($this->class);
12 12
     }
13 13
 	
14
-    public function get_color ()
14
+    public function get_color()
15 15
     {
16
-        return $this->getProperty (['Color', 'color']);
16
+        return $this->getProperty(['Color', 'color']);
17 17
     }
18 18
 	
19
-    public function set_color (int $color)
19
+    public function set_color(int $color)
20 20
     {
21
-        $this->setProperty ('Color', $color);
21
+        $this->setProperty('Color', $color);
22 22
     }
23 23
 }
Please login to merge, or discard this patch.
engine/components/Form.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,37 +4,37 @@  discard block
 block discarded – undo
4 4
 
5 5
 class Form extends Control
6 6
 {
7
-	public $class = 'System.Windows.Forms.Form';
7
+    public $class = 'System.Windows.Forms.Form';
8 8
 
9
-	public function get_icon ()
10
-	{
11
-		return new FormIcon ($this->selector);
12
-	}
9
+    public function get_icon ()
10
+    {
11
+        return new FormIcon ($this->selector);
12
+    }
13 13
 	
14
-	public function get_clientSize ()
15
-	{
16
-		$size = $this->getProperty ('ClientSize');
14
+    public function get_clientSize ()
15
+    {
16
+        $size = $this->getProperty ('ClientSize');
17 17
 		
18
-		return [
19
-			VoidEngine::getProperty ($size, 'Width'),
20
-			VoidEngine::getProperty ($size, 'Height')
21
-		];
22
-	}
18
+        return [
19
+            VoidEngine::getProperty ($size, 'Width'),
20
+            VoidEngine::getProperty ($size, 'Height')
21
+        ];
22
+    }
23 23
 	
24
-	public function set_clientSize ($size)
25
-	{
26
-		if (is_array ($size))
27
-		{
28
-			$clientSize = $this->getProperty ('ClientSize');
24
+    public function set_clientSize ($size)
25
+    {
26
+        if (is_array ($size))
27
+        {
28
+            $clientSize = $this->getProperty ('ClientSize');
29 29
 
30
-			VoidEngine::setProperty ($clientSize, 'Width', array_shift ($size));
31
-			VoidEngine::setProperty ($clientSize, 'Height', array_shift ($size));
30
+            VoidEngine::setProperty ($clientSize, 'Width', array_shift ($size));
31
+            VoidEngine::setProperty ($clientSize, 'Height', array_shift ($size));
32 32
 
33
-			$this->setProperty ('ClientSize', $clientSize);
34
-		}
33
+            $this->setProperty ('ClientSize', $clientSize);
34
+        }
35 35
 
36
-		else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
37
-	}
36
+        else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
37
+    }
38 38
 }
39 39
 
40 40
 class FormIcon extends Icon
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
     public function loadFromFile (string $file)
50
-	{
50
+    {
51 51
         $icon = VoidEngine::createObject ('System.Drawing.Icon', 'System.Drawing', $file);
52 52
         
53 53
         VoidEngine::setProperty ($this->formSelector, 'Icon', $icon);
54 54
 
55
-		if (!isset ($this->selector))
56
-		    $this->selector = $icon;
57
-	}
55
+        if (!isset ($this->selector))
56
+            $this->selector = $icon;
57
+    }
58 58
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,34 +6,34 @@  discard block
 block discarded – undo
6 6
 {
7 7
 	public $class = 'System.Windows.Forms.Form';
8 8
 
9
-	public function get_icon ()
9
+	public function get_icon()
10 10
 	{
11
-		return new FormIcon ($this->selector);
11
+		return new FormIcon($this->selector);
12 12
 	}
13 13
 	
14
-	public function get_clientSize ()
14
+	public function get_clientSize()
15 15
 	{
16
-		$size = $this->getProperty ('ClientSize');
16
+		$size = $this->getProperty('ClientSize');
17 17
 		
18 18
 		return [
19
-			VoidEngine::getProperty ($size, 'Width'),
20
-			VoidEngine::getProperty ($size, 'Height')
19
+			VoidEngine::getProperty($size, 'Width'),
20
+			VoidEngine::getProperty($size, 'Height')
21 21
 		];
22 22
 	}
23 23
 	
24
-	public function set_clientSize ($size)
24
+	public function set_clientSize($size)
25 25
 	{
26
-		if (is_array ($size))
26
+		if (is_array($size))
27 27
 		{
28
-			$clientSize = $this->getProperty ('ClientSize');
28
+			$clientSize = $this->getProperty('ClientSize');
29 29
 
30
-			VoidEngine::setProperty ($clientSize, 'Width', array_shift ($size));
31
-			VoidEngine::setProperty ($clientSize, 'Height', array_shift ($size));
30
+			VoidEngine::setProperty($clientSize, 'Width', array_shift($size));
31
+			VoidEngine::setProperty($clientSize, 'Height', array_shift($size));
32 32
 
33
-			$this->setProperty ('ClientSize', $clientSize);
33
+			$this->setProperty('ClientSize', $clientSize);
34 34
 		}
35 35
 
36
-		else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
36
+		else $this->setProperty('ClientSize', EngineAdditions::uncoupleSelector($size));
37 37
 	}
38 38
 }
39 39
 
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 {
42 42
     protected $formSelector;
43 43
 
44
-    public function __construct (int $formSelector)
44
+    public function __construct(int $formSelector)
45 45
     {
46 46
         $this->formSelector = $formSelector;
47 47
     }
48 48
 
49
-    public function loadFromFile (string $file)
49
+    public function loadFromFile(string $file)
50 50
 	{
51
-        $icon = VoidEngine::createObject ('System.Drawing.Icon', 'System.Drawing', $file);
51
+        $icon = VoidEngine::createObject('System.Drawing.Icon', 'System.Drawing', $file);
52 52
         
53
-        VoidEngine::setProperty ($this->formSelector, 'Icon', $icon);
53
+        VoidEngine::setProperty($this->formSelector, 'Icon', $icon);
54 54
 
55 55
 		if (!isset ($this->selector))
56 56
 		    $this->selector = $icon;
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 			VoidEngine::setProperty ($clientSize, 'Height', array_shift ($size));
32 32
 
33 33
 			$this->setProperty ('ClientSize', $clientSize);
34
+		} else {
35
+		    $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
34 36
 		}
35
-
36
-		else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
37 37
 	}
38 38
 }
39 39
 
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
52 52
         
53 53
         VoidEngine::setProperty ($this->formSelector, 'Icon', $icon);
54 54
 
55
-		if (!isset ($this->selector))
56
-		    $this->selector = $icon;
55
+		if (!isset ($this->selector)) {
56
+				    $this->selector = $icon;
57
+		}
57 58
 	}
58 59
 }
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/parser.php 1 patch
Spacing   +81 added lines, -83 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
      * @param string $content - VLF разметка или путь до файла разметки
24 24
      * [@param array $settings = []] - список настроек и их значений (настройка => значение)
25 25
      */
26
-    public function __construct (string $content, array $settings = [])
26
+    public function __construct(string $content, array $settings = [])
27 27
     {
28
-        if (file_exists ($content))
29
-            $content = file_get_contents ($content);
28
+        if (file_exists($content))
29
+            $content = file_get_contents($content);
30 30
 
31 31
         // Зачем? Так надо!
32 32
         $content = "# VLF begin\n\n$content\n\n# VLF end";
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
             if (isset ($this->$name))
37 37
                 $this->$name = $setting;
38 38
 
39
-            else throw new \Exception ('Trying to setting up undefined property "'. $name .'"');
39
+            else throw new \Exception('Trying to setting up undefined property "'.$name.'"');
40 40
         }
41 41
 
42
-        if ($this->use_caching && file_exists ($file = VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache'))
42
+        if ($this->use_caching && file_exists($file = VLF_EXT_DIR.'/cache/'.sha1($content).'.cache'))
43 43
         {
44
-            $info = unserialize (gzinflate (file_get_contents ($file)));
44
+            $info = unserialize(gzinflate(file_get_contents($file)));
45 45
 
46
-            if ($info[0] == sha1 (file_get_contents (__FILE__)))
46
+            if ($info[0] == sha1(file_get_contents(__FILE__)))
47 47
             {
48 48
                 $this->tree  = $info[1][0];
49 49
                 $this->links = $info[1][1];
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
                 return;
52 52
             }
53 53
 
54
-            else unlink ($file);
54
+            else unlink($file);
55 55
         }
56 56
 
57
-        $info = $this->generateSyntaxTree ($content);
57
+        $info = $this->generateSyntaxTree($content);
58 58
 
59 59
         $this->tree  = $info[0];
60 60
         $this->links = $info[1];
61 61
 
62 62
         if ($this->use_caching)
63 63
         {
64
-            if (!is_dir (dirname (__DIR__) .'/cache'))
65
-                mkdir (dirname (__DIR__) .'/cache');
64
+            if (!is_dir(dirname(__DIR__).'/cache'))
65
+                mkdir(dirname(__DIR__).'/cache');
66 66
 
67
-            file_put_contents (VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache', gzdeflate (serialize ([sha1 (file_get_contents (__FILE__)), $info])));
67
+            file_put_contents(VLF_EXT_DIR.'/cache/'.sha1($content).'.cache', gzdeflate(serialize([sha1(file_get_contents(__FILE__)), $info])));
68 68
         }
69 69
     }
70 70
 
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
      * 
77 77
      * @return array - возвращает АСД
78 78
      */
79
-    protected function generateSyntaxTree (string $content): array
79
+    protected function generateSyntaxTree(string $content): array
80 80
     {
81
-        $lines          = $this->linesFilter ($untouched_lines = explode ($this->divider, $content));
81
+        $lines          = $this->linesFilter($untouched_lines = explode($this->divider, $content));
82 82
         $current_object = null;
83 83
         $parent_objects = [];
84 84
         $skip_at        = -1;
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
         $links          = [];
87 87
 
88 88
         if ($this->debug_mode)
89
-            pre ($lines);
89
+            pre($lines);
90 90
 
91 91
         foreach ($lines as $id => $line)
92 92
         {
93 93
             if ($skip_at > $id)
94 94
                 continue;
95 95
 
96
-            $height = $this->getLineHeight ($line);
97
-            $words  = $this->linesFilter (explode (' ', $line));
96
+            $height = $this->getLineHeight($line);
97
+            $words  = $this->linesFilter(explode(' ', $line));
98 98
 
99 99
             if ($this->debug_mode)
100
-                pre ($words);
100
+                pre($words);
101 101
 
102 102
             /**
103 103
              * Высокоинтеллектуальный фикс
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 $updated = false;
120 120
 
121 121
                 if ($this->debug_mode)
122
-                    pre ($current_object);
122
+                    pre($current_object);
123 123
 
124 124
                 while (isset ($tree[$current_object]['info']['subparent_link']) && $tree[$link = $tree[$current_object]['info']['subparent_link']->link]['hard'] < $tree[$current_object]['hard'])
125 125
                 {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                     $updated        = true;
128 128
 
129 129
                     if ($this->debug_mode)
130
-                        pre ($current_object);
130
+                        pre($current_object);
131 131
                 }
132 132
 
133 133
                 if (
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
                     break;
143 143
 
144 144
                 if ($this->debug_mode)
145
-                    pre ($current_object);
145
+                    pre($current_object);
146 146
             }
147 147
 
148 148
             /**
149 149
              * Button ...
150 150
              */
151
-            if (class_exists ($words[0]) || class_exists ('\VoidEngine\\'. $words[0]))
151
+            if (class_exists($words[0]) || class_exists('\VoidEngine\\'.$words[0]))
152 152
             {
153 153
                 if (!isset ($words[1]))
154
-                    throw new \Exception ('Object name mustn\'t be empty at line "'. $line .'"');
154
+                    throw new \Exception('Object name mustn\'t be empty at line "'.$line.'"');
155 155
 
156 156
                 /**
157 157
                  * Button NewButton
@@ -197,40 +197,39 @@  discard block
 block discarded – undo
197 197
                         'syntax_nodes' => []
198 198
                     ];
199 199
 
200
-                    if (($begin = strpos ($line, '(')) !== false)
200
+                    if (($begin = strpos($line, '(')) !== false)
201 201
                     {
202 202
                         ++$begin;
203 203
                         
204
-                        $end = strrpos ($line, ')');
204
+                        $end = strrpos($line, ')');
205 205
 
206 206
                         if ($end === false)
207
-                            throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
207
+                            throw new \Exception('Line "'.$line.'" have arguments list initialization, but not have list ending');
208 208
 
209 209
                         elseif ($begin < $end)
210 210
                         {
211 211
                             $arguments = [];
212 212
                             // $parsed    = explode (',', substr ($line, $begin, $end - $begin));
213
-                            $parsed    = $this->parseArguments (substr ($line, $begin, $end - $begin));
213
+                            $parsed    = $this->parseArguments(substr($line, $begin, $end - $begin));
214 214
 
215 215
                             foreach ($parsed as $argument_id => $argument)
216 216
                             {
217
-                                $argument = trim ($argument);
217
+                                $argument = trim($argument);
218 218
 
219
-                                if (strlen ($argument) > 0)
219
+                                if (strlen($argument) > 0)
220 220
                                     $arguments[] = isset ($links[$argument]) ?
221
-                                        new VLFLink ($argument, $links[$argument]) :
222
-                                        $argument;
221
+                                        new VLFLink($argument, $links[$argument]) : $argument;
223 222
 
224
-                                else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
223
+                                else throw new \Exception('Argument '.($argument_id + 1).' mustn\'t have zero length at line "'.$line.'"');
225 224
                             }
226 225
 
227 226
                             $tree[$id]['info']['arguments'] = $arguments;
228 227
 
229
-                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0)
230
-                                throw new \Exception ('You mustn\'t write any chars after arguments definition');
228
+                            if (!$this->ignore_postobject_info && trim(substr($line, $end)) > 0)
229
+                                throw new \Exception('You mustn\'t write any chars after arguments definition');
231 230
                         }
232 231
 
233
-                        $tree[$id]['info']['subparent_link'] = new VLFLink ($tree[$current_object]['info']['object_name'], $current_object);
232
+                        $tree[$id]['info']['subparent_link'] = new VLFLink($tree[$current_object]['info']['object_name'], $current_object);
234 233
                     }
235 234
 
236 235
                     /**
@@ -240,7 +239,7 @@  discard block
 block discarded – undo
240 239
                     elseif ($current_object !== null && $tree[$current_object]['hard'] < $height)
241 240
                     {
242 241
                         $tree[$id]['info']['arguments'] = [
243
-                            new VLFLink ($tree[$current_object]['info']['object_name'], $current_object)
242
+                            new VLFLink($tree[$current_object]['info']['object_name'], $current_object)
244 243
                         ];
245 244
 
246 245
                         $parent_objects[$id] = $current_object;
@@ -287,17 +286,17 @@  discard block
 block discarded – undo
287 286
                 {
288 287
                     if ($words[0][1] == '^')
289 288
                     {
290
-                        $parsed = $this->parseSubText ($untouched_lines, $id, $height);
289
+                        $parsed = $this->parseSubText($untouched_lines, $id, $height);
291 290
 
292 291
                         $comment .= $parsed[0];
293 292
                         $skip_at  = $parsed[1];
294 293
                     }
295 294
 
296
-                    else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
295
+                    else throw new \Exception('Unknown char founded after syntax-control symbol at line "'.$line.'"');
297 296
                 }
298 297
                 
299 298
                 if ($this->debug_mode)
300
-                    pre ("Comment:\n\n$comment");
299
+                    pre("Comment:\n\n$comment");
301 300
             }
302 301
 
303 302
             /**
@@ -309,19 +308,19 @@  discard block
 block discarded – undo
309 308
              */
310 309
             elseif ($words[0][0] == '%')
311 310
             {
312
-                $code = substr ($line, strlen ($words[0]));
311
+                $code = substr($line, strlen($words[0]));
313 312
 
314 313
                 if (isset ($words[0][1]))
315 314
                 {
316 315
                     if ($words[0][1] == '^')
317 316
                     {
318
-                        $parsed = $this->parseSubText ($untouched_lines, $id, $height);
317
+                        $parsed = $this->parseSubText($untouched_lines, $id, $height);
319 318
 
320 319
                         $code   .= $parsed[0];
321 320
                         $skip_at = $parsed[1];
322 321
                     }
323 322
 
324
-                    else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"');
323
+                    else throw new \Exception('Unknown char founded after syntax-control symbol at line "'.$line.'"');
325 324
                 }
326 325
                 
327 326
                 $tree[$id] = [
@@ -346,7 +345,7 @@  discard block
 block discarded – undo
346 345
              * Form MyForm
347 346
              *     Button MyButton
348 347
              */
349
-            elseif (is_int ($current_object) && isset ($tree[$current_object]['hard']))
348
+            elseif (is_int($current_object) && isset ($tree[$current_object]['hard']))
350 349
             {
351 350
                 if ($height <= $tree[$current_object]['hard'] && isset ($parent_objects[$current_object]))
352 351
                 {
@@ -372,16 +371,16 @@  discard block
 block discarded – undo
372 371
                 /**
373 372
                  * property_name: property_value
374 373
                  */
375
-                $postChar = substr ($words[0], strlen ($words[0]) - 1);
374
+                $postChar = substr($words[0], strlen($words[0]) - 1);
376 375
 
377 376
                 if ($postChar == ':' || $postChar == '^')
378 377
                 {
379 378
                     if (!isset ($words[1]))
380
-                        throw new \Exception ('Property value mustn\'t be empty at line "'. $line .'"');
379
+                        throw new \Exception('Property value mustn\'t be empty at line "'.$line.'"');
381 380
 
382
-                    $propertyName     = substr ($words[0], 0, -1);
383
-                    $propertyValue    = implode (' ', array_slice ($words, 1));
384
-                    $propertyRawValue = ltrim (substr ($line, strlen ($words[0])));
381
+                    $propertyName     = substr($words[0], 0, -1);
382
+                    $propertyValue    = implode(' ', array_slice($words, 1));
383
+                    $propertyRawValue = ltrim(substr($line, strlen($words[0])));
385 384
 
386 385
                     /**
387 386
                      * property_name:^ property_value_1
@@ -389,10 +388,10 @@  discard block
 block discarded – undo
389 388
                      */
390 389
                     if ($postChar == '^')
391 390
                     {
392
-                        $parsed = $this->parseSubText ($untouched_lines, $id, $height);
391
+                        $parsed = $this->parseSubText($untouched_lines, $id, $height);
393 392
 
394 393
                         $skip_at           = $parsed[1];
395
-                        $propertyName      = substr ($propertyName, 0, -1);
394
+                        $propertyName      = substr($propertyName, 0, -1);
396 395
                         $propertyRawValue .= $parsed[0];
397 396
                         $propertyValue     = $propertyRawValue;
398 397
                     }
@@ -413,7 +412,7 @@  discard block
 block discarded – undo
413 412
                     ];
414 413
 
415 414
                     if (isset ($links[$info['info']['property_value']]))
416
-                        $info['info']['property_value'] = new VLFLink ($info['info']['property_value'], $links[$info['info']['property_value']]);
415
+                        $info['info']['property_value'] = new VLFLink($info['info']['property_value'], $links[$info['info']['property_value']]);
417 416
 
418 417
                     $tree[$current_object]['syntax_nodes'][] = $info;
419 418
                 }
@@ -421,38 +420,37 @@  discard block
 block discarded – undo
421 420
                 /**
422 421
                  * ->method_name ([method_arguments])
423 422
                  */
424
-                elseif (substr ($words[0], 0, 2) == '->')
423
+                elseif (substr($words[0], 0, 2) == '->')
425 424
                 {
426 425
                     $arguments = [];
427 426
                     
428
-                    if (($begin = strpos ($line, '(')) !== false)
427
+                    if (($begin = strpos($line, '(')) !== false)
429 428
                     {
430 429
                         ++$begin;
431 430
                         
432
-                        $end = strrpos ($line, ')');
431
+                        $end = strrpos($line, ')');
433 432
 
434 433
                         if ($end === false)
435
-                            throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending');
434
+                            throw new \Exception('Line "'.$line.'" have arguments list initialization, but not have list ending');
436 435
 
437 436
                         elseif ($begin < $end)
438 437
                         {
439 438
                             // $parsed = explode (',', substr ($line, $begin, $end - $begin));
440
-                            $parsed = $this->parseArguments (substr ($line, $begin, $end - $begin));
439
+                            $parsed = $this->parseArguments(substr($line, $begin, $end - $begin));
441 440
 
442 441
                             foreach ($parsed as $argument_id => $argument)
443 442
                             {
444
-                                $argument = trim ($argument);
443
+                                $argument = trim($argument);
445 444
 
446
-                                if (strlen ($argument) > 0)
445
+                                if (strlen($argument) > 0)
447 446
                                     $arguments[] = isset ($links[$argument]) ?
448
-                                        new VLFLink ($argument, $links[$argument]) :
449
-                                        $argument;
447
+                                        new VLFLink($argument, $links[$argument]) : $argument;
450 448
 
451
-                                else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"');
449
+                                else throw new \Exception('Argument '.($argument_id + 1).' mustn\'t have zero length at line "'.$line.'"');
452 450
                             }
453 451
 
454
-                            if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0)
455
-                                throw new \Exception ('You mustn\'t write any chars after arguments definition');
452
+                            if (!$this->ignore_postobject_info && trim(substr($line, $end)) > 0)
453
+                                throw new \Exception('You mustn\'t write any chars after arguments definition');
456 454
                         }
457 455
                     }
458 456
 
@@ -460,7 +458,7 @@  discard block
 block discarded – undo
460 458
                      * ->show
461 459
                      */
462 460
                     elseif (!$this->ignore_unexpected_method_args)
463
-                        throw new \Exception ('Unexpected method arguments list at line "'. $line .'"');
461
+                        throw new \Exception('Unexpected method arguments list at line "'.$line.'"');
464 462
 
465 463
                     $tree[$current_object]['syntax_nodes'][] = [
466 464
                         'type'  => VLF_METHOD_CALL,
@@ -469,7 +467,7 @@  discard block
 block discarded – undo
469 467
                         'words' => $words,
470 468
 
471 469
                         'info' => [
472
-                            'method_name'      => substr ($words[0], 2),
470
+                            'method_name'      => substr($words[0], 2),
473 471
                             'method_arguments' => $arguments
474 472
                         ],
475 473
 
@@ -492,7 +490,7 @@  discard block
 block discarded – undo
492 490
                  */
493 491
                 else
494 492
                 {
495
-                    $parsed  = $this->parseSubText ($untouched_lines, $id, $height);
493
+                    $parsed  = $this->parseSubText($untouched_lines, $id, $height);
496 494
                     $skip_at = $parsed[1];
497 495
                     
498 496
                     $tree[$id] = [
@@ -502,7 +500,7 @@  discard block
 block discarded – undo
502 500
                         'words' => $words,
503 501
 
504 502
                         'info' => [
505
-                            'object_vlf_info' => $line ."\n". $parsed[0]
503
+                            'object_vlf_info' => $line."\n".$parsed[0]
506 504
                         ],
507 505
 
508 506
                         'syntax_nodes' => []
@@ -513,7 +511,7 @@  discard block
 block discarded – undo
513 511
             /**
514 512
              * Что-то загадочное, таинственное, неизвестное человечеству
515 513
              */
516
-            else throw new \Exception ('Unknown structures founded at line "'. $line .'"');
514
+            else throw new \Exception('Unknown structures founded at line "'.$line.'"');
517 515
         }
518 516
 
519 517
         return [$tree, $links];
@@ -529,7 +527,7 @@  discard block
 block discarded – undo
529 527
      * 
530 528
      * @return array - возвращает спарсенные подстроки
531 529
      */
532
-    protected function parseSubText (array $lines, $begin_id, int $down_height): array
530
+    protected function parseSubText(array $lines, $begin_id, int $down_height): array
533 531
     {
534 532
         $parsed = "\n";
535 533
 
@@ -538,17 +536,17 @@  discard block
 block discarded – undo
538 536
             if ($line_id <= $begin_id)
539 537
                 continue;
540 538
 
541
-            if (!(bool)(trim ($line)))
539
+            if (!(bool) (trim($line)))
542 540
             {
543 541
                 $parsed .= "\n";
544 542
             
545 543
                 continue;
546 544
             }
547 545
 
548
-            $height = $this->getLineHeight ($line);
546
+            $height = $this->getLineHeight($line);
549 547
 
550 548
             if ($this->debug_mode)
551
-                pre ("$height, $down_height, $line");
549
+                pre("$height, $down_height, $line");
552 550
 
553 551
             if ($height > $down_height)
554 552
                 $parsed .= "$line\n";
@@ -559,7 +557,7 @@  discard block
 block discarded – undo
559 557
         return [$parsed, $line_id];
560 558
     }
561 559
 
562
-    public function __get ($name) // Возвращалка переменных парсера
560
+    public function __get($name) // Возвращалка переменных парсера
563 561
     {
564 562
         return isset ($this->$name) ?
565 563
             $this->$name : false;
@@ -573,14 +571,14 @@  discard block
 block discarded – undo
573 571
      * 
574 572
      * @return int - высота строки
575 573
      */
576
-    protected function getLineHeight (string &$line): int
574
+    protected function getLineHeight(string &$line): int
577 575
     {
578 576
         $i = 0;
579 577
 
580 578
         while (isset ($line[$i]) && $line[$i] == "\t")
581 579
             ++$i;
582 580
         
583
-        return strlen ($line = str_repeat ('    ', $i) . substr ($line, $i)) - strlen ($line = trim ($line));
581
+        return strlen($line = str_repeat('    ', $i).substr($line, $i)) - strlen($line = trim($line));
584 582
     }
585 583
 
586 584
     /**
@@ -591,18 +589,18 @@  discard block
 block discarded – undo
591 589
      * 
592 590
      * @return array - возвращает очищенный массив
593 591
      */
594
-    protected function linesFilter (array $segments): array
592
+    protected function linesFilter(array $segments): array
595 593
     {
596
-        return array_filter ($segments, function ($text)
594
+        return array_filter($segments, function($text)
597 595
         {
598
-            if ($this->strong_line_parser && preg_match ('/[^a-z0-9]/i', $text))
599
-                throw new \Exception  ('Line "'. $text .'" mustn\'t have any not-alphabet or not-numeric characters');
596
+            if ($this->strong_line_parser && preg_match('/[^a-z0-9]/i', $text))
597
+                throw new \Exception('Line "'.$text.'" mustn\'t have any not-alphabet or not-numeric characters');
600 598
             
601
-            return strlen (trim ($text)) > 0;
599
+            return strlen(trim($text)) > 0;
602 600
         });
603 601
     }
604 602
 
605
-    protected function parseArguments (string $arguments): array
603
+    protected function parseArguments(string $arguments): array
606 604
     {
607 605
         $args = [];
608 606
 
@@ -611,7 +609,7 @@  discard block
 block discarded – undo
611 609
 
612 610
         $t = '';
613 611
 
614
-        for ($i = 0, $len = strlen ($arguments); $i < $len; ++$i)
612
+        for ($i = 0, $len = strlen($arguments); $i < $len; ++$i)
615 613
         {
616 614
             $t .= $arguments[$i];
617 615
             
@@ -628,7 +626,7 @@  discard block
 block discarded – undo
628 626
 
629 627
                 elseif (!$split1 && !$split2 && $arguments[$i] == ',')
630 628
                 {
631
-                    $args[] = substr ($t, 0, -1);
629
+                    $args[] = substr($t, 0, -1);
632 630
                     $t = '';
633 631
                 }
634 632
             }
Please login to merge, or discard this patch.