@@ -360,30 +360,37 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -6,8 +6,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | + }); |
@@ -10,8 +10,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) |
@@ -11,9 +11,7 @@ |
||
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 | } |
@@ -31,9 +31,9 @@ discard block |
||
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 |
||
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 | } |