Passed
Push — master ( 895563...af6f8b )
by Observer
01:38
created
engine/VoidEngine.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 const ENGINE_VERSION = '4.0.0rc3';
35 35
 const ENGINE_DIR = __DIR__;
36 36
 
37
-chdir (ENGINE_DIR);
37
+chdir(ENGINE_DIR);
38 38
 
39 39
 require 'common/Events.php';
40 40
 require 'common/EngineInterfaces.php';
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 require 'common/Components.php';
44 44
 require 'common/Others.php';
45 45
 
46
-define ('VoidEngine\CORE_VERSION', $APPLICATION->productVersion);
46
+define('VoidEngine\CORE_VERSION', $APPLICATION->productVersion);
47 47
 
48 48
 require 'components/Component.php';
49 49
 require 'components/Control.php';
50 50
 
51
-foreach (glob ('components/*/*.php') as $name)
51
+foreach (glob('components/*/*.php') as $name)
52 52
     require $name;
53 53
 
54
-if (file_exists ('extensions'))
55
-    foreach (scandir ('extensions') as $ext)
56
-        if (file_exists ($ext = 'extensions/'. $ext .'/main.php'))
54
+if (file_exists('extensions'))
55
+    foreach (scandir('extensions') as $ext)
56
+        if (file_exists($ext = 'extensions/'.$ext.'/main.php'))
57 57
             require $ext;
Please login to merge, or discard this patch.
engine/common/Others.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -4,176 +4,176 @@  discard block
 block discarded – undo
4 4
 
5 5
 use VoidCore;
6 6
 
7
-function dn (...$args): NetObject
7
+function dn(...$args): NetObject
8 8
 {
9 9
     try
10 10
     {
11
-        $object = new NetObject (...$args);
11
+        $object = new NetObject(...$args);
12 12
     }
13 13
 
14 14
     catch (\WinformsException $e)
15 15
     {
16
-        if (VoidCore::callMethod ($e->getNetException (), 'ToString') == 'System.MemberAccessException')
16
+        if (VoidCore::callMethod($e->getNetException(), 'ToString') == 'System.MemberAccessException')
17 17
             throw $e;
18 18
         
19
-        $object = new NetClass (...$args);
19
+        $object = new NetClass(...$args);
20 20
     }
21 21
 
22 22
     return $object;
23 23
 }
24 24
 
25
-function thread (callable $callable): NetObject
25
+function thread(callable $callable): NetObject
26 26
 {
27
-    return new NetObject (VoidCore::createThread ($callable));
27
+    return new NetObject(VoidCore::createThread($callable));
28 28
 }
29 29
 
30
-function enum (string $baseType, string $value)
30
+function enum(string $baseType, string $value)
31 31
 {
32 32
     try
33 33
     {
34
-        return VoidCore::callMethod (VoidCore::getClass ('System.Enum'), ['parse', VC_OBJECT], VoidCore::typeof ($baseType), $value, true);
34
+        return VoidCore::callMethod(VoidCore::getClass('System.Enum'), ['parse', VC_OBJECT], VoidCore::typeof($baseType), $value, true);
35 35
     }
36 36
 
37 37
     catch (\WinformsException $e)
38 38
     {
39
-        return (new NetClass ($baseType))->$value;
39
+        return (new NetClass($baseType))->$value;
40 40
     }
41 41
 }
42 42
 
43
-function dnArray (string $type, array $items = []): NetObject
43
+function dnArray(string $type, array $items = []): NetObject
44 44
 {
45
-    $array = (new NetClass ('System.Array'))
46
-        ->createInstance (VoidCore::typeof ($type), $size = sizeof ($items));
45
+    $array = (new NetClass('System.Array'))
46
+        ->createInstance(VoidCore::typeof($type), $size = sizeof($items));
47 47
 
48 48
     for ($i = 0; $i < $size; ++$i)
49
-        $array[$i] = array_shift ($items);
49
+        $array[$i] = array_shift($items);
50 50
     
51 51
     return $array;
52 52
 }
53 53
 
54
-function dir_create (string $path, int $mode = 0777): void
54
+function dir_create(string $path, int $mode = 0777): void
55 55
 {
56
-    if (!is_dir ($path))
57
-        mkdir ($path, $mode, true);
56
+    if (!is_dir($path))
57
+        mkdir($path, $mode, true);
58 58
 }
59 59
 
60
-function dir_delete (string $path): bool
60
+function dir_delete(string $path): bool
61 61
 {
62
-    if (!is_dir ($path))
62
+    if (!is_dir($path))
63 63
         return false;
64 64
 
65
-    foreach (array_slice (scandir ($path), 2) as $file)
66
-        if (is_dir ($file = $path .'/'. $file))
65
+    foreach (array_slice(scandir($path), 2) as $file)
66
+        if (is_dir($file = $path.'/'.$file))
67 67
         {
68
-            dir_delete ($file);
68
+            dir_delete($file);
69 69
 
70
-            if (is_dir ($file))
71
-                rmdir ($file);
70
+            if (is_dir($file))
71
+                rmdir($file);
72 72
         }
73 73
 
74
-        else unlink ($file);
74
+        else unlink($file);
75 75
 
76
-    rmdir ($path);
76
+    rmdir($path);
77 77
 
78 78
     return true;
79 79
 }
80 80
 
81
-function dir_clean (string $path): void
81
+function dir_clean(string $path): void
82 82
 {
83
-    dir_delete ($path);
84
-    dir_create ($path);
83
+    dir_delete($path);
84
+    dir_create($path);
85 85
 }
86 86
 
87
-function dir_copy (string $from, string $to): bool
87
+function dir_copy(string $from, string $to): bool
88 88
 {
89
-    if (!is_dir ($from))
89
+    if (!is_dir($from))
90 90
         return false;
91 91
 
92
-    if (!is_dir ($to))
93
-        dir_create ($to);
92
+    if (!is_dir($to))
93
+        dir_create($to);
94 94
 
95
-    foreach (array_slice (scandir ($from), 2) as $file)
96
-        if (is_dir ($f = $from .'/'. $file))
97
-            dir_copy ($f, $to .'/'. $file);
95
+    foreach (array_slice(scandir($from), 2) as $file)
96
+        if (is_dir($f = $from.'/'.$file))
97
+            dir_copy($f, $to.'/'.$file);
98 98
 
99
-        else copy ($f, $to .'/'. $file);
99
+        else copy($f, $to.'/'.$file);
100 100
 
101 101
     return true;
102 102
 }
103 103
 
104
-function argb (string $color)
104
+function argb(string $color)
105 105
 {
106
-    return (new NetClass ('System.Drawing.ColorTranslator'))->fromHtml ($color);
106
+    return (new NetClass('System.Drawing.ColorTranslator'))->fromHtml($color);
107 107
 }
108 108
 
109
-function replaceSl (string $string): string
109
+function replaceSl(string $string): string
110 110
 {
111
-    return str_replace ('\\', '/', $string);
111
+    return str_replace('\\', '/', $string);
112 112
 }
113 113
 
114
-function replaceSr (string $string): string
114
+function replaceSr(string $string): string
115 115
 {
116
-    return str_replace ('/', '\\', $string);
116
+    return str_replace('/', '\\', $string);
117 117
 }
118 118
 
119
-function basenameNoExt (string $path): string
119
+function basenameNoExt(string $path): string
120 120
 {
121
-    return pathinfo ($path, PATHINFO_FILENAME);
121
+    return pathinfo($path, PATHINFO_FILENAME);
122 122
 }
123 123
 
124
-function file_ext (string $path): string
124
+function file_ext(string $path): string
125 125
 {
126
-    return strtolower (pathinfo ($path, PATHINFO_EXTENSION));
126
+    return strtolower(pathinfo($path, PATHINFO_EXTENSION));
127 127
 }
128 128
 
129
-function filepathNoExt (string $path): string
129
+function filepathNoExt(string $path): string
130 130
 {
131
-    return dirname ($path) .'/'. basenameNoExt ($path);
131
+    return dirname($path).'/'.basenameNoExt($path);
132 132
 }
133 133
 
134
-function pre (...$args): void
134
+function pre(...$args): void
135 135
 {
136
-	message (sizeof ($args) < 2 ? current ($args) : $args);
136
+	message(sizeof($args) < 2 ? current ($args) : $args);
137 137
 }
138 138
 
139
-function messageBox (string $message, string $caption = '', ...$args): int
139
+function messageBox(string $message, string $caption = '', ...$args): int
140 140
 {
141
-    return (new MessageBox)->show ($message, $caption, ...$args);
141
+    return (new MessageBox)->show($message, $caption, ...$args);
142 142
 }
143 143
 
144
-function run (string $path, ...$args)
144
+function run(string $path, ...$args)
145 145
 {
146
-    return (new Process)->start ($path, ...$args);
146
+    return (new Process)->start($path, ...$args);
147 147
 }
148 148
 
149
-function setTimer (int $interval, callable $function): Timer
149
+function setTimer(int $interval, callable $function): Timer
150 150
 {
151 151
     $timer = new Timer;
152 152
     $timer->interval  = $interval;
153
-    $timer->tickEvent = fn ($self) => $function ($self);
153
+    $timer->tickEvent = fn($self) => $function($self);
154 154
     
155
-	$timer->start ();
155
+	$timer->start();
156 156
     
157 157
     return $timer;
158 158
 }
159 159
 
160
-function setTimeout (int $timeout, callable $function): Timer
160
+function setTimeout(int $timeout, callable $function): Timer
161 161
 {
162 162
     $timer = new Timer;
163 163
     $timer->interval  = $timeout;
164
-    $timer->tickEvent = function ($self) use ($function)
164
+    $timer->tickEvent = function($self) use ($function)
165 165
     {
166
-        $self->stop ();
166
+        $self->stop();
167 167
 
168
-        $function ($self);
168
+        $function($self);
169 169
     };
170 170
     
171
-	$timer->start ();
171
+	$timer->start();
172 172
     
173 173
 	return $timer;
174 174
 }
175 175
 
176
-set_error_handler (function ($no, $str, $file, $line)
176
+set_error_handler(function($no, $str, $file, $line)
177 177
 {
178 178
     // Мог ли я здесь сделать более адекватный код с использованием pow/sqrt? Да, мог
179 179
     // Почему не сделал? Скорость важнее
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         16384 => 'E_USER_DEPRECATED'
196 196
     ];
197 197
 
198
-    message ([
198
+    message([
199 199
         'type'      => $errarr[$no],
200 200
         'text'      => $str,
201 201
         'file'      => $file,
Please login to merge, or discard this patch.
engine/common/Components.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,62 +6,62 @@
 block discarded – undo
6 6
 {
7 7
     protected static array $objects = [];
8 8
 
9
-    public static function add (NetObject $object): void
9
+    public static function add(NetObject $object): void
10 10
     {
11
-        self::$objects[$object->selector] = \WeakReference::create ($object);
11
+        self::$objects[$object->selector] = \WeakReference::create($object);
12 12
     }
13 13
 
14
-    public static function get (int $selector): ?NetObject
14
+    public static function get(int $selector): ?NetObject
15 15
     {
16 16
         if (!isset (self::$objects[$selector]))
17 17
             return null;
18 18
         
19
-        $object = self::$objects[$selector]->get ();
19
+        $object = self::$objects[$selector]->get();
20 20
 
21 21
         if ($object === null)
22
-            self::remove ($selector);
22
+            self::remove($selector);
23 23
 
24 24
         return $object;
25 25
     }
26 26
 
27
-    public static function exists (int $selector): bool
27
+    public static function exists(int $selector): bool
28 28
     {
29 29
         return isset (self::$objects[$selector]);
30 30
     }
31 31
 
32
-    public static function getObjects (): array
32
+    public static function getObjects(): array
33 33
     {
34 34
         return self::$objects;
35 35
     }
36 36
 
37
-    public static function remove (int $selector): void
37
+    public static function remove(int $selector): void
38 38
     {
39 39
         unset (self::$objects[$selector]);
40 40
     }
41 41
 
42
-    public static function clean (): void
42
+    public static function clean(): void
43 43
     {
44 44
         foreach (self::$objects as $selector => $reference)
45
-            if ($reference->get () === null)
45
+            if ($reference->get() === null)
46 46
                 unset (self::$objects[$selector]);
47 47
     }
48 48
 }
49 49
 
50
-function _c (int $selector): ?NetObject
50
+function _c(int $selector): ?NetObject
51 51
 {
52
-    return Components::get ($selector);
52
+    return Components::get($selector);
53 53
 }
54 54
 
55 55
 // TODO: поддержка многоуровневых ссылок вида родитель->родитель->объект
56 56
 // VoidCore::getPrevClass
57
-function c (string $name): ?NetObject
57
+function c(string $name): ?NetObject
58 58
 {
59
-    if (is_int ($name) && ($object = _c($name)) !== null)
59
+    if (is_int($name) && ($object = _c($name)) !== null)
60 60
         return $object;
61 61
 
62
-    foreach (Components::getObjects () as $selector => $reference)
62
+    foreach (Components::getObjects() as $selector => $reference)
63 63
     {
64
-        $object = $reference->get ();
64
+        $object = $reference->get();
65 65
 
66 66
         if ($object === null)
67 67
             continue;
Please login to merge, or discard this patch.
Braces   +19 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,13 +13,15 @@  discard block
 block discarded – undo
13 13
 
14 14
     public static function get (int $selector): ?NetObject
15 15
     {
16
-        if (!isset (self::$objects[$selector]))
17
-            return null;
16
+        if (!isset (self::$objects[$selector])) {
17
+                    return null;
18
+        }
18 19
         
19 20
         $object = self::$objects[$selector]->get ();
20 21
 
21
-        if ($object === null)
22
-            self::remove ($selector);
22
+        if ($object === null) {
23
+                    self::remove ($selector);
24
+        }
23 25
 
24 26
         return $object;
25 27
     }
@@ -41,9 +43,10 @@  discard block
 block discarded – undo
41 43
 
42 44
     public static function clean (): void
43 45
     {
44
-        foreach (self::$objects as $selector => $reference)
45
-            if ($reference->get () === null)
46
+        foreach (self::$objects as $selector => $reference) {
47
+                    if ($reference->get () === null)
46 48
                 unset (self::$objects[$selector]);
49
+        }
47 50
     }
48 51
 }
49 52
 
@@ -56,23 +59,24 @@  discard block
 block discarded – undo
56 59
 // VoidCore::getPrevClass
57 60
 function c (string $name): ?NetObject
58 61
 {
59
-    if (is_int ($name) && ($object = _c($name)) !== null)
60
-        return $object;
62
+    if (is_int ($name) && ($object = _c($name)) !== null) {
63
+            return $object;
64
+    }
61 65
 
62 66
     foreach (Components::getObjects () as $selector => $reference)
63 67
     {
64 68
         $object = $reference->get ();
65 69
 
66
-        if ($object === null)
67
-            continue;
70
+        if ($object === null) {
71
+                    continue;
72
+        }
68 73
 
69 74
         try
70 75
         {
71
-            if ($object->name == $name)
72
-                return $object;
73
-        }
74
-
75
-        catch (\Throwable $e) {}
76
+            if ($object->name == $name) {
77
+                            return $object;
78
+            }
79
+        } catch (\Throwable $e) {}
76 80
     }
77 81
 
78 82
     return null;
Please login to merge, or discard this patch.
engine/common/EngineInterfaces.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 $size = $this->count;
56 56
                 $list = [];
57 57
                 
58
-				for ($i = 0; $i < $size; ++$i)
58
+                for ($i = 0; $i < $size; ++$i)
59 59
                     $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i));
60 60
                 
61 61
                 return $list;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     # ArrayAccess
125 125
 
126 126
     public function offsetSet ($index, $value)
127
-	{
127
+    {
128 128
         try
129 129
         {
130 130
             $index === null ?
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
         }
141 141
     }
142 142
 	
143
-	public function offsetGet ($index)
144
-	{
145
-		return EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $index), $this->selector);
143
+    public function offsetGet ($index)
144
+    {
145
+        return EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $index), $this->selector);
146 146
     }
147 147
 	
148
-	public function offsetUnset ($index): void
149
-	{
150
-		$this->callMethod ('RemoveAt', $index);
148
+    public function offsetUnset ($index): void
149
+    {
150
+        $this->callMethod ('RemoveAt', $index);
151 151
     }
152 152
     
153 153
     public function offsetExists ($index): bool
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 class EngineAdditions
239 239
 {
240
-	/**
240
+    /**
241 241
      * * Компиляция PHP кода
242 242
      * 
243 243
      * TODO: дополнить описание
Please login to merge, or discard this patch.
Spacing   +69 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,44 +10,44 @@  discard block
 block discarded – undo
10 10
     protected ?string $name = null;
11 11
     // protected bool $isCollection = false;
12 12
 
13
-    public function __construct ($name, $assembly = false, ...$args)
13
+    public function __construct($name, $assembly = false, ...$args)
14 14
     {
15 15
         foreach ($args as $id => $arg)
16
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
16
+            $args[$id] = EngineAdditions::uncoupleSelector($arg);
17 17
         
18
-        if (is_int ($name) && VoidCore::objectExists ($name))
18
+        if (is_int($name) && VoidCore::objectExists($name))
19 19
             $this->selector = $name;
20 20
 
21
-        elseif (is_string ($name))
22
-            $this->selector = VoidCore::createObject ($name, $assembly, ...$args);
21
+        elseif (is_string($name))
22
+            $this->selector = VoidCore::createObject($name, $assembly, ...$args);
23 23
 
24
-        else throw new \Exception ('Incorrect params passed');
24
+        else throw new \Exception('Incorrect params passed');
25 25
 
26 26
         /*$this->isCollection = $this->getType ()
27 27
             ->isSubclassOf (VoidCore::typeof ('System.Collectons.Generic.ICollection'));*/
28 28
     }
29 29
 
30
-    public function dispose (): void
30
+    public function dispose(): void
31 31
     {
32
-        VoidCore::removeObjects ($this->selector);
32
+        VoidCore::removeObjects($this->selector);
33 33
     }
34 34
 
35 35
     # Основные магические методы
36 36
 
37
-    public function __get (string $name)
37
+    public function __get(string $name)
38 38
     {
39
-        switch (strtolower ($name))
39
+        switch (strtolower($name))
40 40
         {
41 41
             case 'count':
42 42
             case 'length':
43 43
                 try
44 44
                 {
45
-                    return $this->getProperty ('Count');
45
+                    return $this->getProperty('Count');
46 46
                 }
47 47
 
48 48
                 catch (\WinformsException $e)
49 49
                 {
50
-                    return $this->getProperty ('Length');
50
+                    return $this->getProperty('Length');
51 51
                 }
52 52
             break;
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 $list = [];
57 57
                 
58 58
 				for ($i = 0; $i < $size; ++$i)
59
-                    $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i));
59
+                    $list[] = EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $i));
60 60
                 
61 61
                 return $list;
62 62
             break;
@@ -68,93 +68,91 @@  discard block
 block discarded – undo
68 68
                 for ($i = 0; $i < $size; ++$i)
69 69
                     try
70 70
                     {
71
-                        $names[] = VoidCore::getProperty (VoidCore::getArrayValue ($this->selector, [$i, VC_OBJECT]), 'Text');
71
+                        $names[] = VoidCore::getProperty(VoidCore::getArrayValue($this->selector, [$i, VC_OBJECT]), 'Text');
72 72
                     }
73 73
 
74 74
                     catch (\WinformsException $e)
75 75
                     {
76
-                        $names[] = VoidCore::getArrayValue ($this->selector, [$i, VC_STRING]);
76
+                        $names[] = VoidCore::getArrayValue($this->selector, [$i, VC_STRING]);
77 77
                     }
78 78
                 
79 79
                 return $names;
80 80
             break;
81 81
         }
82 82
 
83
-        if (method_exists ($this, $method = 'get_'. $name))
84
-            return $this->$method ();
83
+        if (method_exists($this, $method = 'get_'.$name))
84
+            return $this->$method();
85 85
 
86 86
         return isset ($this->$name) ?
87
-            $this->$name : EngineAdditions::coupleSelector ($this->getProperty ($name));
87
+            $this->$name : EngineAdditions::coupleSelector($this->getProperty($name));
88 88
     }
89 89
 
90
-    public function __set (string $name, $value): void
90
+    public function __set(string $name, $value): void
91 91
     {
92
-        if (substr ($name, -5) == 'Event')
93
-            Events::setEvent ($this->selector, substr ($name, 0, -5), $value);
92
+        if (substr($name, -5) == 'Event')
93
+            Events::setEvent($this->selector, substr($name, 0, -5), $value);
94 94
 
95
-        elseif (method_exists ($this, $method = 'set_'. $name))
96
-            $this->$method ($value);
95
+        elseif (method_exists($this, $method = 'set_'.$name))
96
+            $this->$method($value);
97 97
         
98
-        else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
98
+        else $this->setProperty($name, EngineAdditions::uncoupleSelector($value));
99 99
     }
100 100
 
101
-    public function __call (string $name, array $args)
101
+    public function __call(string $name, array $args)
102 102
     {
103
-        return EngineAdditions::coupleSelector ($this->callMethod ($name,
104
-            array_map ('VoidEngine\\EngineAdditions::uncoupleSelector', $args)));
103
+        return EngineAdditions::coupleSelector($this->callMethod($name,
104
+            array_map('VoidEngine\\EngineAdditions::uncoupleSelector', $args)));
105 105
     }
106 106
 
107 107
     # Управление VoidCore
108 108
 
109
-    protected function getProperty ($name)
109
+    protected function getProperty($name)
110 110
     {
111
-        return VoidCore::getProperty ($this->selector, $name);
111
+        return VoidCore::getProperty($this->selector, $name);
112 112
     }
113 113
 
114
-    protected function setProperty (string $name, $value): void
114
+    protected function setProperty(string $name, $value): void
115 115
     {
116
-        VoidCore::setProperty ($this->selector, $name, $value);
116
+        VoidCore::setProperty($this->selector, $name, $value);
117 117
     }
118 118
 
119
-    protected function callMethod (string $name, array $args = [])
119
+    protected function callMethod(string $name, array $args = [])
120 120
     {
121
-        return VoidCore::callMethod ($this->selector, $name, ...$args);
121
+        return VoidCore::callMethod($this->selector, $name, ...$args);
122 122
     }
123 123
 
124 124
     # ArrayAccess
125 125
 
126
-    public function offsetSet ($index, $value)
126
+    public function offsetSet($index, $value)
127 127
 	{
128 128
         try
129 129
         {
130 130
             $index === null ?
131
-                $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
132
-                $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
131
+                $this->callMethod('Add', EngineAdditions::uncoupleSelector($value)) : $this->callMethod('Insert', $index, EngineAdditions::uncoupleSelector($value));
133 132
         }
134 133
 
135 134
         catch (\Throwable $e)
136 135
         {
137 136
             $index === null ?
138
-                VoidCore::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) :
139
-                VoidCore::setArrayValue ($this->selector, $index, EngineAdditions::uncoupleSelector ($value));
137
+                VoidCore::setArrayValue($this->selector, $this->count, EngineAdditions::uncoupleSelector($value)) : VoidCore::setArrayValue($this->selector, $index, EngineAdditions::uncoupleSelector($value));
140 138
         }
141 139
     }
142 140
 	
143
-	public function offsetGet ($index)
141
+	public function offsetGet($index)
144 142
 	{
145
-		return EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $index), $this->selector);
143
+		return EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $index), $this->selector);
146 144
     }
147 145
 	
148
-	public function offsetUnset ($index): void
146
+	public function offsetUnset($index): void
149 147
 	{
150
-		$this->callMethod ('RemoveAt', $index);
148
+		$this->callMethod('RemoveAt', $index);
151 149
     }
152 150
     
153
-    public function offsetExists ($index): bool
151
+    public function offsetExists($index): bool
154 152
     {
155 153
         try
156 154
         {
157
-            $this->offsetGet ($index);
155
+            $this->offsetGet($index);
158 156
         }
159 157
 
160 158
         catch (\WinformsException $e)
@@ -172,16 +170,16 @@  discard block
 block discarded – undo
172 170
         $size = $this->count;
173 171
 
174 172
         for ($i = 0; $i < $size; ++$i)
175
-            $callback (EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
173
+            $callback(EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
176 174
     }
177 175
 
178
-    public function where (callable $comparator, string $type = null): array
176
+    public function where(callable $comparator, string $type = null): array
179 177
     {
180 178
         $size   = $this->count;
181 179
         $return = [];
182 180
 
183 181
         for ($i = 0; $i < $size; ++$i)
184
-            if ($comparator ($value = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
182
+            if ($comparator($value = EngineAdditions::coupleSelector(VoidCore::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
185 183
                 $return[] = $value;
186 184
 
187 185
         return $return;
@@ -189,30 +187,30 @@  discard block
 block discarded – undo
189 187
 
190 188
     # Магические методы
191 189
 
192
-    public function __destruct ()
190
+    public function __destruct()
193 191
     {
194
-        VoidCore::destructObject ($this->selector);
192
+        VoidCore::destructObject($this->selector);
195 193
     }
196 194
 
197
-    public function __toString (): string
195
+    public function __toString(): string
198 196
     {
199 197
         return $this->selector;
200 198
     }
201 199
 
202
-    public function __debugInfo (): array
200
+    public function __debugInfo(): array
203 201
     {
204 202
         $info = ['selector' => $this->selector];
205 203
 
206 204
         try
207 205
         {
208
-            $info['name'] = $this->getProperty ('Name');
206
+            $info['name'] = $this->getProperty('Name');
209 207
         }
210 208
 
211 209
         catch (\WinformsException $e) {}
212 210
 
213 211
         try
214 212
         {
215
-            $info['info'] = $this->callMethod ('ToString');
213
+            $info['info'] = $this->callMethod('ToString');
216 214
         }
217 215
 
218 216
         catch (\WinformsException $e) {}
@@ -223,15 +221,15 @@  discard block
 block discarded – undo
223 221
 
224 222
 class NetClass extends NetObject
225 223
 {
226
-    public function __construct ($name, $assembly = false)
224
+    public function __construct($name, $assembly = false)
227 225
     {
228
-        if (is_int ($name) && VoidCore::objectExists ($name))
226
+        if (is_int($name) && VoidCore::objectExists($name))
229 227
             $this->selector = $name;
230 228
 
231
-        elseif (is_string ($name))
232
-            $this->selector = VoidCore::getClass ($name, $assembly);
229
+        elseif (is_string($name))
230
+            $this->selector = VoidCore::getClass($name, $assembly);
233 231
 
234
-        else throw new \Exception ('Incorrect params passed');
232
+        else throw new \Exception('Incorrect params passed');
235 233
     }
236 234
 }
237 235
 
@@ -256,16 +254,16 @@  discard block
 block discarded – undo
256 254
      * 
257 255
      * @return array - возвращает список ошибок компиляции
258 256
      */
259
-    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 = '', NetObject $dictionary = null, NetObject $assemblies = null): array
257
+    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 = '', NetObject $dictionary = null, NetObject $assemblies = null): array
260 258
     {
261 259
         if ($dictionary === null)
262
-            $dictionary = new NetObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
260
+            $dictionary = new NetObject('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
263 261
 
264 262
         if ($assemblies === null)
265
-            $assemblies = dnArray ('System.String', []);
263
+            $assemblies = dnArray('System.String', []);
266 264
 
267 265
         if ($productName === null)
268
-            $productName = basenameNoExt ($savePath);
266
+            $productName = basenameNoExt($savePath);
269 267
 
270 268
         if ($productDescription === null)
271 269
             $productDescription = $productName;
@@ -277,16 +275,16 @@  discard block
 block discarded – undo
277 275
             $companyName = 'Company N';
278 276
 
279 277
         if ($copyright === null)
280
-            $copyright = $companyName .' copyright (c) '. date ('Y');
278
+            $copyright = $companyName.' copyright (c) '.date('Y');
281 279
 
282
-        return (new NetClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
280
+        return (new NetClass('WinForms_PHP.WFCompiler', null))->compile($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
283 281
     }
284 282
 
285
-    public static function loadModule (string $path): bool
283
+    public static function loadModule(string $path): bool
286 284
     {
287 285
         try
288 286
         {
289
-            (new NetClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
287
+            (new NetClass('System.Reflection.Assembly', 'mscorlib'))->loadFrom($path);
290 288
         }
291 289
 
292 290
         catch (\WinformsException $e)
@@ -297,15 +295,15 @@  discard block
 block discarded – undo
297 295
         return true;
298 296
     }
299 297
 	
300
-    public static function coupleSelector ($selector)
298
+    public static function coupleSelector($selector)
301 299
     {
302
-        return is_int ($selector) && VoidCore::objectExists ($selector) ?
303
-            new NetObject ($selector) : $selector;
300
+        return is_int($selector) && VoidCore::objectExists($selector) ?
301
+            new NetObject($selector) : $selector;
304 302
     }
305 303
 
306
-    public static function uncoupleSelector ($object)
304
+    public static function uncoupleSelector($object)
307 305
     {
308
-        return is_object ($object) && $object instanceof NetObject ?
306
+        return is_object($object) && $object instanceof NetObject ?
309 307
             $object->selector : $object;
310 308
     }
311 309
 }
Please login to merge, or discard this patch.
Braces   +67 added lines, -68 removed lines patch added patch discarded remove patch
@@ -12,16 +12,17 @@  discard block
 block discarded – undo
12 12
 
13 13
     public function __construct ($name, $assembly = false, ...$args)
14 14
     {
15
-        foreach ($args as $id => $arg)
16
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
15
+        foreach ($args as $id => $arg) {
16
+                    $args[$id] = EngineAdditions::uncoupleSelector ($arg);
17
+        }
17 18
         
18
-        if (is_int ($name) && VoidCore::objectExists ($name))
19
-            $this->selector = $name;
20
-
21
-        elseif (is_string ($name))
22
-            $this->selector = VoidCore::createObject ($name, $assembly, ...$args);
23
-
24
-        else throw new \Exception ('Incorrect params passed');
19
+        if (is_int ($name) && VoidCore::objectExists ($name)) {
20
+                    $this->selector = $name;
21
+        } elseif (is_string ($name)) {
22
+                    $this->selector = VoidCore::createObject ($name, $assembly, ...$args);
23
+        } else {
24
+            throw new \Exception ('Incorrect params passed');
25
+        }
25 26
 
26 27
         /*$this->isCollection = $this->getType ()
27 28
             ->isSubclassOf (VoidCore::typeof ('System.Collectons.Generic.ICollection'));*/
@@ -43,9 +44,7 @@  discard block
 block discarded – undo
43 44
                 try
44 45
                 {
45 46
                     return $this->getProperty ('Count');
46
-                }
47
-
48
-                catch (\WinformsException $e)
47
+                } catch (\WinformsException $e)
49 48
                 {
50 49
                     return $this->getProperty ('Length');
51 50
                 }
@@ -55,8 +54,9 @@  discard block
 block discarded – undo
55 54
                 $size = $this->count;
56 55
                 $list = [];
57 56
                 
58
-				for ($i = 0; $i < $size; ++$i)
59
-                    $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i));
57
+				for ($i = 0; $i < $size; ++$i) {
58
+				                    $list[] = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $i));
59
+				}
60 60
                 
61 61
                 return $list;
62 62
             break;
@@ -65,13 +65,12 @@  discard block
 block discarded – undo
65 65
                 $size  = $this->count;
66 66
                 $names = [];
67 67
                 
68
-                for ($i = 0; $i < $size; ++$i)
69
-                    try
68
+                for ($i = 0; $i < $size; ++$i) {
69
+                                    try
70 70
                     {
71 71
                         $names[] = VoidCore::getProperty (VoidCore::getArrayValue ($this->selector, [$i, VC_OBJECT]), 'Text');
72
-                    }
73
-
74
-                    catch (\WinformsException $e)
72
+                }
73
+                    } catch (\WinformsException $e)
75 74
                     {
76 75
                         $names[] = VoidCore::getArrayValue ($this->selector, [$i, VC_STRING]);
77 76
                     }
@@ -80,8 +79,9 @@  discard block
 block discarded – undo
80 79
             break;
81 80
         }
82 81
 
83
-        if (method_exists ($this, $method = 'get_'. $name))
84
-            return $this->$method ();
82
+        if (method_exists ($this, $method = 'get_'. $name)) {
83
+                    return $this->$method ();
84
+        }
85 85
 
86 86
         return isset ($this->$name) ?
87 87
             $this->$name : EngineAdditions::coupleSelector ($this->getProperty ($name));
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
     public function __set (string $name, $value): void
91 91
     {
92
-        if (substr ($name, -5) == 'Event')
93
-            Events::setEvent ($this->selector, substr ($name, 0, -5), $value);
94
-
95
-        elseif (method_exists ($this, $method = 'set_'. $name))
96
-            $this->$method ($value);
97
-        
98
-        else $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
92
+        if (substr ($name, -5) == 'Event') {
93
+                    Events::setEvent ($this->selector, substr ($name, 0, -5), $value);
94
+        } elseif (method_exists ($this, $method = 'set_'. $name)) {
95
+                    $this->$method ($value);
96
+        } else {
97
+            $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
98
+        }
99 99
     }
100 100
 
101 101
     public function __call (string $name, array $args)
@@ -130,9 +130,7 @@  discard block
 block discarded – undo
130 130
             $index === null ?
131 131
                 $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
132 132
                 $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
133
-        }
134
-
135
-        catch (\Throwable $e)
133
+        } catch (\Throwable $e)
136 134
         {
137 135
             $index === null ?
138 136
                 VoidCore::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) :
@@ -155,9 +153,7 @@  discard block
 block discarded – undo
155 153
         try
156 154
         {
157 155
             $this->offsetGet ($index);
158
-        }
159
-
160
-        catch (\WinformsException $e)
156
+        } catch (\WinformsException $e)
161 157
         {
162 158
             return false;
163 159
         }
@@ -171,8 +167,9 @@  discard block
 block discarded – undo
171 167
     {
172 168
         $size = $this->count;
173 169
 
174
-        for ($i = 0; $i < $size; ++$i)
175
-            $callback (EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
170
+        for ($i = 0; $i < $size; ++$i) {
171
+                    $callback (EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
172
+        }
176 173
     }
177 174
 
178 175
     public function where (callable $comparator, string $type = null): array
@@ -180,9 +177,10 @@  discard block
 block discarded – undo
180 177
         $size   = $this->count;
181 178
         $return = [];
182 179
 
183
-        for ($i = 0; $i < $size; ++$i)
184
-            if ($comparator ($value = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
180
+        for ($i = 0; $i < $size; ++$i) {
181
+                    if ($comparator ($value = EngineAdditions::coupleSelector (VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
185 182
                 $return[] = $value;
183
+        }
186 184
 
187 185
         return $return;
188 186
     }
@@ -206,16 +204,12 @@  discard block
 block discarded – undo
206 204
         try
207 205
         {
208 206
             $info['name'] = $this->getProperty ('Name');
209
-        }
210
-
211
-        catch (\WinformsException $e) {}
207
+        } catch (\WinformsException $e) {}
212 208
 
213 209
         try
214 210
         {
215 211
             $info['info'] = $this->callMethod ('ToString');
216
-        }
217
-
218
-        catch (\WinformsException $e) {}
212
+        } catch (\WinformsException $e) {}
219 213
 
220 214
         return $info;
221 215
     }
@@ -225,13 +219,13 @@  discard block
 block discarded – undo
225 219
 {
226 220
     public function __construct ($name, $assembly = false)
227 221
     {
228
-        if (is_int ($name) && VoidCore::objectExists ($name))
229
-            $this->selector = $name;
230
-
231
-        elseif (is_string ($name))
232
-            $this->selector = VoidCore::getClass ($name, $assembly);
233
-
234
-        else throw new \Exception ('Incorrect params passed');
222
+        if (is_int ($name) && VoidCore::objectExists ($name)) {
223
+                    $this->selector = $name;
224
+        } elseif (is_string ($name)) {
225
+                    $this->selector = VoidCore::getClass ($name, $assembly);
226
+        } else {
227
+            throw new \Exception ('Incorrect params passed');
228
+        }
235 229
     }
236 230
 }
237 231
 
@@ -258,26 +252,33 @@  discard block
 block discarded – undo
258 252
      */
259 253
     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 = '', NetObject $dictionary = null, NetObject $assemblies = null): array
260 254
     {
261
-        if ($dictionary === null)
262
-            $dictionary = new NetObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
255
+        if ($dictionary === null) {
256
+                    $dictionary = new NetObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
257
+        }
263 258
 
264
-        if ($assemblies === null)
265
-            $assemblies = dnArray ('System.String', []);
259
+        if ($assemblies === null) {
260
+                    $assemblies = dnArray ('System.String', []);
261
+        }
266 262
 
267
-        if ($productName === null)
268
-            $productName = basenameNoExt ($savePath);
263
+        if ($productName === null) {
264
+                    $productName = basenameNoExt ($savePath);
265
+        }
269 266
 
270
-        if ($productDescription === null)
271
-            $productDescription = $productName;
267
+        if ($productDescription === null) {
268
+                    $productDescription = $productName;
269
+        }
272 270
 
273
-        if ($productVersion === null)
274
-            $productVersion = '1.0';
271
+        if ($productVersion === null) {
272
+                    $productVersion = '1.0';
273
+        }
275 274
 
276
-        if ($companyName === null)
277
-            $companyName = 'Company N';
275
+        if ($companyName === null) {
276
+                    $companyName = 'Company N';
277
+        }
278 278
 
279
-        if ($copyright === null)
280
-            $copyright = $companyName .' copyright (c) '. date ('Y');
279
+        if ($copyright === null) {
280
+                    $copyright = $companyName .' copyright (c) '. date ('Y');
281
+        }
281 282
 
282 283
         return (new NetClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
283 284
     }
@@ -287,9 +288,7 @@  discard block
 block discarded – undo
287 288
         try
288 289
         {
289 290
             (new NetClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
290
-        }
291
-
292
-        catch (\WinformsException $e)
291
+        } catch (\WinformsException $e)
293 292
         {
294 293
             return false;
295 294
         }
Please login to merge, or discard this patch.
app_bundle/start.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
11 11
 const APP_DIR = __DIR__;
12 12
 
13 13
 define ('VoidEngine\CORE_DIR',
14
-	file_exists ($dir = dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/core') ? $dir : __DIR__);
14
+    file_exists ($dir = dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/core') ? $dir : __DIR__);
15 15
 
16 16
 # Подгружаем PHP расширения
17 17
 foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext)
18
-	if (!extension_loaded (substr (basename ($ext), 4, -4)))
19
-		load_extension ($ext);
18
+    if (!extension_loaded (substr (basename ($ext), 4, -4)))
19
+        load_extension ($ext);
20 20
 
21 21
 # Подгружаем Qero-пакеты
22 22
 require __DIR__ .'/../qero-packages/autoload.php';
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@
 block discarded – undo
10 10
 # Объявление констант
11 11
 const APP_DIR = __DIR__;
12 12
 
13
-define ('VoidEngine\CORE_DIR',
14
-	file_exists ($dir = dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/core') ? $dir : __DIR__);
13
+define('VoidEngine\CORE_DIR',
14
+	file_exists($dir = dirname(__DIR__).'/qero-packages/winforms-php/VoidFramework/core') ? $dir : __DIR__);
15 15
 
16 16
 # Подгружаем PHP расширения
17
-foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext)
18
-	if (!extension_loaded (substr (basename ($ext), 4, -4)))
19
-		load_extension ($ext);
17
+foreach (glob(CORE_DIR.'/ext/php_*.dll') as $ext)
18
+	if (!extension_loaded(substr(basename($ext), 4, -4)))
19
+		load_extension($ext);
20 20
 
21 21
 # Подгружаем Qero-пакеты
22
-require __DIR__ .'/../qero-packages/autoload.php';
22
+require __DIR__.'/../qero-packages/autoload.php';
23 23
 
24
-chdir (APP_DIR); // Меняем стандартную директорию на директорию приложения
24
+chdir(APP_DIR); // Меняем стандартную директорию на директорию приложения
25 25
 
26 26
 # Парсим разметку app.vlf и запускаем приложение
27
-$objects = Interpreter::run (Parser::parse ('app.vlf'));
27
+$objects = Interpreter::run(Parser::parse('app.vlf'));
28 28
 
29
-$APPLICATION->run ($objects['MainForm']);
29
+$APPLICATION->run($objects['MainForm']);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,9 +14,10 @@
 block discarded – undo
14 14
 	file_exists ($dir = dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/core') ? $dir : __DIR__);
15 15
 
16 16
 # Подгружаем PHP расширения
17
-foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext)
17
+foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext) {
18 18
 	if (!extension_loaded (substr (basename ($ext), 4, -4)))
19 19
 		load_extension ($ext);
20
+}
20 21
 
21 22
 # Подгружаем Qero-пакеты
22 23
 require __DIR__ .'/../qero-packages/autoload.php';
Please login to merge, or discard this patch.