Passed
Push — master ( 72f7b3...4061f4 )
by Observer
02:00
created
bin/qero-packages/winforms-php/VoidFramework/engine/common/Others.php 1 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 \VoidCore::callMethod (\VoidCore::getClass ('System.Enum',''), ['parse', 'object'], \VoidCore::typeof ($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 (\VoidCore::typeof ($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 (\VoidCore::typeof ('System.Windows.Forms.Form', 'System.Windows.Forms')))
233
-                    continue;
234
-            }
235
-
236
-            catch (\Exception $e) {}
239
+                if ($object->getType ()->isSubclassOf (\VoidCore::typeof ('System.Windows.Forms.Form', 'System.Windows.Forms'))) {
240
+                                    continue;
241
+                }
242
+            } catch (\Exception $e) {}
237 243
             
238 244
             \VoidCore::destructObject ($selector);
239 245
 
240
-            if (!\VoidCore::objectExists ($selector))
241
-                unset (self::$components[$selector]);
246
+            if (!\VoidCore::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 (\VoidCore::typeof ('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
         \VoidCore::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.
qero-packages/winforms-php/VoidFramework/engine/common/EngineInterfaces.php 1 patch
Braces   +90 added lines, -99 removed lines patch added patch discarded remove patch
@@ -26,30 +26,37 @@  discard block
 block discarded – undo
26 26
      */
27 27
     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
28 28
     {
29
-        if ($dictionary === null)
30
-            $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
29
+        if ($dictionary === null) {
30
+                    $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', null);
31
+        }
31 32
 
32
-        if ($assemblies === null)
33
-            $assemblies = getNetArray ('System.String', [
33
+        if ($assemblies === null) {
34
+                    $assemblies = getNetArray ('System.String', [
34 35
                 // CORE_DIR .'/CefSharp.dll',
35 36
                 CORE_DIR .'/FastColoredTextBox.dll',
36 37
                 CORE_DIR .'/ScintillaNET.dll'
37 38
             ]);
39
+        }
38 40
 
39
-        if ($productName === null)
40
-            $productName = basenameNoExt ($savePath);
41
+        if ($productName === null) {
42
+                    $productName = basenameNoExt ($savePath);
43
+        }
41 44
 
42
-        if ($productDescription === null)
43
-            $productDescription = $productName;
45
+        if ($productDescription === null) {
46
+                    $productDescription = $productName;
47
+        }
44 48
 
45
-        if ($productVersion === null)
46
-            $productVersion = '1.0';
49
+        if ($productVersion === null) {
50
+                    $productVersion = '1.0';
51
+        }
47 52
 
48
-        if ($companyName === null)
49
-            $companyName = 'Company N';
53
+        if ($companyName === null) {
54
+                    $companyName = 'Company N';
55
+        }
50 56
 
51
-        if ($copyright === null)
52
-            $copyright = $companyName .' copyright (c) '. date ('Y');
57
+        if ($copyright === null) {
58
+                    $copyright = $companyName .' copyright (c) '. date ('Y');
59
+        }
53 60
 
54 61
         return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
55 62
     }
@@ -59,9 +66,7 @@  discard block
 block discarded – undo
59 66
         try
60 67
         {
61 68
             (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
62
-        }
63
-
64
-        catch (\WinFormsException $e)
69
+        } catch (\WinFormsException $e)
65 70
         {
66 71
             return false;
67 72
         }
@@ -73,8 +78,9 @@  discard block
 block discarded – undo
73 78
     {
74 79
         $property = \VoidCore::callMethod (\VoidCore::callMethod ($selector, 'GetType'), 'GetProperty', $name);
75 80
 
76
-        if (!is_int ($property))
77
-            return false;
81
+        if (!is_int ($property)) {
82
+                    return false;
83
+        }
78 84
 
79 85
         try
80 86
         {
@@ -117,9 +123,7 @@  discard block
 block discarded – undo
117 123
                         \VoidCore::getProperty ($selector, [$name, 'int']);
118 124
 
119 125
                         $property = 'int';
120
-                    }
121
-
122
-                    catch (\WinFormsException $e)
126
+                    } catch (\WinFormsException $e)
123 127
                     {
124 128
                         return [
125 129
                             'type'  => 'vrsf',
@@ -128,9 +132,7 @@  discard block
 block discarded – undo
128 132
                     }
129 133
                 break;
130 134
             }
131
-        }
132
-
133
-        catch (\Throwable $e)
135
+        } catch (\Throwable $e)
134 136
         {
135 137
             $property = 'object';
136 138
         }
@@ -148,8 +150,9 @@  discard block
 block discarded – undo
148 150
         $props = \VoidCore::callMethod (\VoidCore::callMethod ($object, 'GetType'), 'GetEvents');
149 151
         $len   = \VoidCore::getProperty ($props, 'Length');
150 152
 
151
-        for ($i = 0; $i < $len; ++$i)
152
-            $events[] = \VoidCore::getProperty (\VoidCore::getArrayValue ($props, $i), 'Name');
153
+        for ($i = 0; $i < $len; ++$i) {
154
+                    $events[] = \VoidCore::getProperty (\VoidCore::getArrayValue ($props, $i), 'Name');
155
+        }
153 156
 
154 157
         return $events;
155 158
     }
@@ -179,8 +182,9 @@  discard block
 block discarded – undo
179 182
 
180 183
     public function __construct ($object, $classGroup = false, ...$args)
181 184
     {
182
-        foreach ($args as $id => $arg)
183
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
185
+        foreach ($args as $id => $arg) {
186
+                    $args[$id] = EngineAdditions::uncoupleSelector ($arg);
187
+        }
184 188
 
185 189
         if (is_string ($object))
186 190
         {
@@ -188,35 +192,31 @@  discard block
 block discarded – undo
188 192
             
189 193
             /*$this->selector = \VoidCore::createObject ($object, $classGroup == 'auto' ?
190 194
                 substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args);*/
195
+        } elseif (is_int ($object) && \VoidCore::objectExists ($object)) {
196
+                    $this->selector = $object;
197
+        } else {
198
+            throw new \Exception ('$object parameter must be string or object selector');
191 199
         }
192
-
193
-        elseif (is_int ($object) && \VoidCore::objectExists ($object))
194
-            $this->selector = $object;
195
-
196
-        else throw new \Exception ('$object parameter must be string or object selector');
197 200
     }
198 201
     
199 202
     public function __get ($name)
200 203
 	{
201
-        if (method_exists ($this, $method = "get_$name"))
202
-            $value = $this->$method ();
203
-
204
-        elseif (substr ($name, -5) == 'Event')
205
-            $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
206
-
207
-        elseif (property_exists ($this, $name))
208
-            $value = $this->$name;
209
-
210
-        else switch (strtolower ($name))
204
+        if (method_exists ($this, $method = "get_$name")) {
205
+                    $value = $this->$method ();
206
+        } elseif (substr ($name, -5) == 'Event') {
207
+                    $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
208
+        } elseif (property_exists ($this, $name)) {
209
+                    $value = $this->$name;
210
+        } else {
211
+            switch (strtolower ($name))
211 212
         {
212 213
             case 'count':
213 214
             case 'length':
214 215
                 try
215 216
                 {
216 217
                     return $this->getProperty ('Count');
217
-                }
218
-
219
-                catch (\WinFormsException $e)
218
+        }
219
+                } catch (\WinFormsException $e)
220 220
                 {
221 221
                     return $this->getProperty ('Length');
222 222
                 }
@@ -226,8 +226,9 @@  discard block
 block discarded – undo
226 226
                 $size = $this->count;
227 227
                 $list = [];
228 228
                 
229
-				for ($i = 0; $i < $size; ++$i)
230
-                    $list[] = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $i));
229
+				for ($i = 0; $i < $size; ++$i) {
230
+				                    $list[] = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $i));
231
+				}
231 232
                 
232 233
                 return $list;
233 234
             break;
@@ -236,13 +237,12 @@  discard block
 block discarded – undo
236 237
                 $size = $this->count;
237 238
                 $names = [];
238 239
                 
239
-                for ($i = 0; $i < $size; ++$i)
240
-                    try
240
+                for ($i = 0; $i < $size; ++$i) {
241
+                                    try
241 242
                     {
242 243
                         $names[] = \VoidCore::getProperty (\VoidCore::getArrayValue ($this->selector, [$i, 'object']), 'Text');
243
-                    }
244
-
245
-                    catch (\WinFormsException $e)
244
+                }
245
+                    } catch (\WinFormsException $e)
246 246
                     {
247 247
                         $names[] = \VoidCore::getArrayValue ($this->selector, [$i, 'string']);
248 248
                     }
@@ -260,10 +260,11 @@  discard block
 block discarded – undo
260 260
 	
261 261
 	public function __set ($name, $value)
262 262
 	{
263
-        if (method_exists ($this, $method = "set_$name"))
264
-            try
263
+        if (method_exists ($this, $method = "set_$name")) {
264
+                    try
265 265
             {
266 266
                 return $this->$method ($value);
267
+        }
267 268
             }
268 269
 
269 270
             # Метод "set_$name" может принимать в качестве параметра объект WFObject
@@ -273,15 +274,13 @@  discard block
 block discarded – undo
273 274
             {
274 275
                 return $value instanceof WFObject ?
275 276
                     $this->$method ($value->selector) : null;
276
-            }
277
-
278
-        elseif (substr ($name, -5) == 'Event')
279
-            Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
280
-        
281
-        else
277
+            } elseif (substr ($name, -5) == 'Event') {
278
+                    Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
279
+        } else
282 280
         {
283
-            if (is_array ($value) && is_string (current ($value)))
284
-                $value = getNetArray ('System.String', $value);
281
+            if (is_array ($value) && is_string (current ($value))) {
282
+                            $value = getNetArray ('System.String', $value);
283
+            }
285 284
 
286 285
             $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
287 286
         }
@@ -299,11 +298,12 @@  discard block
 block discarded – undo
299 298
 
300 299
     public function addRange ($values, $assoc = false): void
301 300
     {
302
-        if (is_array ($values))
303
-            foreach ($values as $id => $value)
301
+        if (is_array ($values)) {
302
+                    foreach ($values as $id => $value)
304 303
                 $this->offsetSet ($assoc ? $id : null, $value);
305
-
306
-        else $this->callMethod ('AddRange', EngineAdditions::uncoupleSelector ($values));
304
+        } else {
305
+            $this->callMethod ('AddRange', EngineAdditions::uncoupleSelector ($values));
306
+        }
307 307
     }
308 308
     
309 309
     public function offsetSet ($index, $value)
@@ -313,9 +313,7 @@  discard block
 block discarded – undo
313 313
             return $index === null ?
314 314
                 $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
315 315
                 $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
316
-        }
317
-
318
-        catch (\Throwable $e)
316
+        } catch (\Throwable $e)
319 317
         {
320 318
             return $index === null ?
321 319
                 \VoidCore::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) :
@@ -338,9 +336,7 @@  discard block
 block discarded – undo
338 336
         try
339 337
         {
340 338
             $this->offsetGet ($index);
341
-        }
342
-
343
-        catch (\Exception $e)
339
+        } catch (\Exception $e)
344 340
         {
345 341
             return false;
346 342
         }
@@ -367,8 +363,9 @@  discard block
 block discarded – undo
367 363
     {
368 364
         $size = $this->count;
369 365
 
370
-        for ($i = 0; $i < $size; ++$i)
371
-            $callback (EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
366
+        for ($i = 0; $i < $size; ++$i) {
367
+                    $callback (EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
368
+        }
372 369
     }
373 370
 
374 371
     public function where (callable $comparator, string $type = null): array
@@ -376,9 +373,10 @@  discard block
 block discarded – undo
376 373
         $size   = $this->count;
377 374
         $return = [];
378 375
 
379
-        for ($i = 0; $i < $size; ++$i)
380
-            if ($comparator ($value = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
376
+        for ($i = 0; $i < $size; ++$i) {
377
+                    if ($comparator ($value = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
381 378
                 $return[] = $value;
379
+        }
382 380
 
383 381
         return $return;
384 382
     }
@@ -388,9 +386,7 @@  discard block
 block discarded – undo
388 386
         try
389 387
         {
390 388
             return \VoidCore::getProperty ($this->selector, $name);
391
-        }
392
-
393
-        catch (\WinFormsException $e)
389
+        } catch (\WinFormsException $e)
394 390
         {
395 391
             return \VoidCore::getField ($this->selector, $name);
396 392
         }
@@ -401,9 +397,7 @@  discard block
 block discarded – undo
401 397
         try
402 398
         {
403 399
             \VoidCore::setProperty ($this->selector, $name, $value);
404
-        }
405
-
406
-        catch (\WinFormsException $e)
400
+        } catch (\WinFormsException $e)
407 401
         {
408 402
             \VoidCore::setField ($this->selector, $name, $value);
409 403
         }
@@ -420,8 +414,9 @@  discard block
 block discarded – undo
420 414
         $size   = \VoidCore::getProperty ($array, 'Length');
421 415
         $return = [];
422 416
 
423
-		for ($i = 0; $i < $size; ++$i)
424
-            $return[] = \VoidCore::getArrayValue ($array, $type === null ? $i : [$i, $type]);
417
+		for ($i = 0; $i < $size; ++$i) {
418
+		            $return[] = \VoidCore::getArrayValue ($array, $type === null ? $i : [$i, $type]);
419
+		}
425 420
         
426 421
         \VoidCore::removeObjects ($array);
427 422
         
@@ -433,9 +428,7 @@  discard block
 block discarded – undo
433 428
 		try
434 429
 		{
435 430
 			return $this->getProperty ('Name');
436
-        }
437
-        
438
-		catch (\Throwable $e)
431
+        } catch (\Throwable $e)
439 432
 		{
440 433
 			return $this->name;
441 434
 		}
@@ -446,9 +439,7 @@  discard block
 block discarded – undo
446 439
 		try
447 440
 		{
448 441
 			$this->setProperty ('Name', $name);
449
-        }
450
-        
451
-		catch (\Throwable $e)
442
+        } catch (\Throwable $e)
452 443
 		{
453 444
 			$this->name = $name;
454 445
 		}
@@ -464,12 +455,12 @@  discard block
 block discarded – undo
464 455
 {
465 456
     public function __construct ($class, $classGroup = false)
466 457
     {
467
-        if (is_string ($class))
468
-            $this->selector = \VoidCore::getClass ($class, $classGroup);
469
-
470
-        elseif (is_int ($class) && \VoidCore::objectExists ($class))
471
-            $this->selector = $class;
472
-
473
-        else throw new \Exception ('$class parameter must be string or class selector');
458
+        if (is_string ($class)) {
459
+                    $this->selector = \VoidCore::getClass ($class, $classGroup);
460
+        } elseif (is_int ($class) && \VoidCore::objectExists ($class)) {
461
+                    $this->selector = $class;
462
+        } else {
463
+            throw new \Exception ('$class parameter must be string or class selector');
464
+        }
474 465
     }
475 466
 }
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/common/Globals.php 1 patch
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,16 +17,15 @@
 block discarded – undo
17 17
     
18 18
     public function run ($form = null): void
19 19
     {
20
-        if ($form instanceof WFObject)
21
-            $this->application->run ($form->selector);
22
-        
23
-        elseif (is_int ($form) && \VoidCore::objectExists ($form))
24
-            $this->application->run ($form);
25
-        
26
-        elseif ($form === null)
27
-            $this->application->run ();
28
-
29
-        else throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector');
20
+        if ($form instanceof WFObject) {
21
+                    $this->application->run ($form->selector);
22
+        } elseif (is_int ($form) && \VoidCore::objectExists ($form)) {
23
+                    $this->application->run ($form);
24
+        } elseif ($form === null) {
25
+                    $this->application->run ();
26
+        } else {
27
+            throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector');
28
+        }
30 29
     }
31 30
     
32 31
     public function restart (): void
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/components/Process.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,11 @@
 block discarded – undo
11 11
 	{
12 12
         $this->selector = \VoidCore::getClass ($this->class, $this->namespace);
13 13
 
14
-		if ($pid !== null)
15
-            $this->selector = $pid == getmypid () ?
14
+		if ($pid !== null) {
15
+		            $this->selector = $pid == getmypid () ?
16 16
                 \VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
17 17
                 \VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
18
+		}
18 19
 
19 20
 		Components::addComponent ($this->selector, $this);
20 21
 	}
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/components/Form.php 1 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
 			\VoidCore::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
         \VoidCore::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.
qero-packages/winforms-php/VoidFramework/engine/components/Component.php 1 patch
Braces   +13 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
             {
39 39
                 Components::removeComponent ($this->$name);
40 40
 
41
-                if (\VoidCore::objectExists ($this->$name))
42
-                    \VoidCore::removeObjects ($this->$name);
41
+                if (\VoidCore::objectExists ($this->$name)) {
42
+                                    \VoidCore::removeObjects ($this->$name);
43
+                }
44
+            } elseif ($this->$name instanceof Component) {
45
+                            $this->$name->dispose ();
43 46
             }
44
-
45
-            elseif ($this->$name instanceof Component)
46
-                $this->$name->dispose ();
47 47
         }
48 48
 
49 49
         unset ($this->$name);
@@ -57,20 +57,21 @@  discard block
 block discarded – undo
57 57
             {
58 58
                 Components::removeComponent ($value);
59 59
 
60
-                if (\VoidCore::objectExists ($value))
61
-                    \VoidCore::removeObjects ($value);
60
+                if (\VoidCore::objectExists ($value)) {
61
+                                    \VoidCore::removeObjects ($value);
62
+                }
63
+            } elseif ($value instanceof Component) {
64
+                            $value->dispose ();
62 65
             }
63 66
 
64
-            elseif ($value instanceof Component)
65
-                $value->dispose ();
66
-
67 67
             unset ($this->$param);
68 68
         }
69 69
 
70 70
         if (isset ($this->selector))
71 71
         {
72
-            if (\VoidCore::objectExists ($this->selector))
73
-                \VoidCore::removeObjects ($this->selector);
72
+            if (\VoidCore::objectExists ($this->selector)) {
73
+                            \VoidCore::removeObjects ($this->selector);
74
+            }
74 75
             
75 76
             Components::removeComponent ($this->selector);
76 77
         }
Please login to merge, or discard this patch.
qero-packages/winforms-php/VoidFramework/engine/components/Scintilla.php 1 patch
Braces   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function set_syntax ($syntax)
42 42
     {
43
-        if (file_exists ($syntax))
44
-            $syntax = file_get_contents ($syntax);
43
+        if (file_exists ($syntax)) {
44
+                    $syntax = file_get_contents ($syntax);
45
+        }
45 46
 
46 47
         $syntax = json_decode ($syntax, true);
47 48
 
@@ -49,30 +50,33 @@  discard block
 block discarded – undo
49 50
             !is_array ($syntax['syntax']) ||
50 51
             !is_array ($syntax['references']) ||
51 52
             !isset ($syntax['lexer'])
52
-        ) return false;
53
-
54
-        else
53
+        ) {
54
+            return false;
55
+        } else
55 56
         {
56 57
             $this->resetSyntax ();
57 58
             $this->clearSyntax ();
58 59
             
59
-            foreach ($syntax['references'] as $name => $value)
60
-                if (isset ($syntax['syntax'][$name]))
60
+            foreach ($syntax['references'] as $name => $value) {
61
+                            if (isset ($syntax['syntax'][$name]))
61 62
                 {
62 63
                     $element = \VoidCore::getArrayValue ($this->styles, $value);
64
+            }
63 65
                     $color   = $syntax['syntax'][$name];
64 66
 
65
-                    if (defined ($color))
66
-                        $color = constant ($color);
67
+                    if (defined ($color)) {
68
+                                            $color = constant ($color);
69
+                    }
67 70
                     
68 71
                     \VoidCore::setProperty ($element, 'ForeColor', [$color, 'color']);
69 72
                 }
70 73
 
71 74
             $this->lexer = $syntax['lexer'];
72 75
 
73
-            if (is_array ($syntax['keywords']))
74
-                foreach ($syntax['keywords'] as $id => $keywords)
76
+            if (is_array ($syntax['keywords'])) {
77
+                            foreach ($syntax['keywords'] as $id => $keywords)
75 78
                     $this->setKeywords ($id, $keywords);
79
+            }
76 80
 
77 81
             $this->propertyInit ('fold', 1);
78 82
             $this->propertyInit ('fold.compact', 1);
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/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.
bin/qero-packages/winforms-php/VoidFramework/engine/components/Control.php 1 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
                 \VoidCore::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.