Passed
Push — master ( 72f7b3...4061f4 )
by Observer
02:00
created
bin/app/php/ProjectManager.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
 {
7 7
     public static string $projectPath = '';
8 8
 
9
-    public static function createProject (string $name = 'default'): bool
9
+    public static function createProject(string $name = 'default'): bool
10 10
     {
11
-        if (!is_dir ($dir = 'C:/Users/'. USERNAME .'/Documents/VoidStudio'))
12
-            dir_create ($dir);
11
+        if (!is_dir($dir = 'C:/Users/'.USERNAME.'/Documents/VoidStudio'))
12
+            dir_create($dir);
13 13
 
14
-        if (is_dir ($dir = $dir .'/'. $name))
14
+        if (is_dir($dir = $dir.'/'.$name))
15 15
         {
16
-            if (messageBox ('Проект "'. $name .'" уже создан. Перезаписать его?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
17
-                dir_clean ($dir);
16
+            if (messageBox('Проект "'.$name.'" уже создан. Перезаписать его?', 'Подтвердите действие', enum('System.Windows.Forms.MessageBoxButtons.YesNo'), enum('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
17
+                dir_clean($dir);
18 18
 
19 19
             else return false;
20 20
         }
21 21
 
22
-        else dir_create ($dir);
22
+        else dir_create($dir);
23 23
 
24 24
         self::$projectPath = $dir;
25 25
 
26
-        VoidStudioAPI::getObjects ('main')['MainForm']->caption    = $name .' — VoidStudio';
27
-        VoidStudioAPI::getObjects ('modules')['MainForm']->caption = $name .' — модули проекта';
28
-        VoidStudioAPI::getObjects ('main')['ToolsPanel__LogList']->items->add ('Проект "'. $name .'" успешно создан');
26
+        VoidStudioAPI::getObjects('main')['MainForm']->caption    = $name.' — VoidStudio';
27
+        VoidStudioAPI::getObjects('modules')['MainForm']->caption = $name.' — модули проекта';
28
+        VoidStudioAPI::getObjects('main')['ToolsPanel__LogList']->items->add('Проект "'.$name.'" успешно создан');
29 29
 
30
-        dir_create ($dir .'/modules');
30
+        dir_create($dir.'/modules');
31 31
         // copy (__DIR__ .'/../Qero/Qero.phar', $dir .'/Qero.phar');
32 32
 
33 33
         // require $dir .'/Qero.phar';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         return true;
36 36
     }
37 37
 
38
-    public static function saveProject (string $file): void
38
+    public static function saveProject(string $file): void
39 39
     {
40 40
         $info = [
41 41
             'forms'   => [],
@@ -43,84 +43,84 @@  discard block
 block discarded – undo
43 43
             'objects' => []
44 44
         ];
45 45
 
46
-        foreach (VoidStudioAPI::getObjects ('main')['Designer__FormsList']->items->names as $item)
46
+        foreach (VoidStudioAPI::getObjects('main')['Designer__FormsList']->items->names as $item)
47 47
         {
48
-            $designer = VoidStudioAPI::getObjects ('main')['Designer__'. $item .'Designer'];
48
+            $designer = VoidStudioAPI::getObjects('main')['Designer__'.$item.'Designer'];
49 49
 
50
-            $info['forms'][$item]   = VoidStudioBuilder::appendDesignerData ($designer->getSharpCode ($item), $designer);
51
-            $info['objects'][$item] = array_keys ($designer->objects);
50
+            $info['forms'][$item]   = VoidStudioBuilder::appendDesignerData($designer->getSharpCode($item), $designer);
51
+            $info['objects'][$item] = array_keys($designer->objects);
52 52
             $info['events'][$item]  = VoidStudioAPI::$events[$item] ?? null;
53 53
         }
54 54
 
55
-        file_put_contents ($file, gzdeflate (serialize ($info), 9));
55
+        file_put_contents($file, gzdeflate(serialize($info), 9));
56 56
 
57
-        if (replaceSl (self::$projectPath) != replaceSl (dirname ($file)))
58
-            dir_copy (self::$projectPath .'/modules', dirname ($file) .'/modules');
57
+        if (replaceSl(self::$projectPath) != replaceSl(dirname($file)))
58
+            dir_copy(self::$projectPath.'/modules', dirname($file).'/modules');
59 59
 
60
-        VoidStudioAPI::getObjects ('main')['ToolsPanel__LogList']->items->add ('Проект успешно сохранён');
60
+        VoidStudioAPI::getObjects('main')['ToolsPanel__LogList']->items->add('Проект успешно сохранён');
61 61
     }
62 62
 
63
-    public static function openProject (string $file): void
63
+    public static function openProject(string $file): void
64 64
     {
65
-        messageBox ('В настоящий момент пересматривается алгоритм открытия проектов, поэтому возможны многочисленные баги (в т.ч. невозможность компиляции открытого проекта)'. "\n\nБудет исправлено в ближайшее время\nС уважением, разработчики проекта WinForms PHP", 'Предупреждение об ошибках', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Warning'));
65
+        messageBox('В настоящий момент пересматривается алгоритм открытия проектов, поэтому возможны многочисленные баги (в т.ч. невозможность компиляции открытого проекта)'."\n\nБудет исправлено в ближайшее время\nС уважением, разработчики проекта WinForms PHP", 'Предупреждение об ошибках', enum('System.Windows.Forms.MessageBoxButtons.OK'), enum('System.Windows.Forms.MessageBoxIcon.Warning'));
66 66
 
67
-        self::$projectPath = dirname ($file); 
67
+        self::$projectPath = dirname($file); 
68 68
 
69
-        $info    = unserialize (gzinflate (file_get_contents ($file)));
70
-        $objects = VoidStudioAPI::getObjects ('main');
69
+        $info    = unserialize(gzinflate(file_get_contents($file)));
70
+        $objects = VoidStudioAPI::getObjects('main');
71 71
 
72 72
         foreach ($objects['Designer__FormsList']->items->names as $form)
73 73
         {
74
-            $designer = VoidStudioAPI::$objects['main']['Designer__'. $form .'Designer'];
74
+            $designer = VoidStudioAPI::$objects['main']['Designer__'.$form.'Designer'];
75 75
 
76
-            $designer->form->dispose ();
77
-            $designer->control->dispose ();
76
+            $designer->form->dispose();
77
+            $designer->control->dispose();
78 78
 
79
-            unset (VoidStudioAPI::$objects['main']['Designer__'. $form .'Designer'], $designer);
79
+            unset (VoidStudioAPI::$objects['main']['Designer__'.$form.'Designer'], $designer);
80 80
         }
81 81
 
82 82
         $objects['PropertiesList__List']->selectedObject = null;
83
-        $objects['Designer__FormsList']->items->clear ();
83
+        $objects['Designer__FormsList']->items->clear();
84 84
 
85 85
         foreach ($info['forms'] as $formName => $form)
86 86
         {
87
-            $sourceForm = (new WFClass ('WinForms_PHP.WFCompiler', ''))->evalCS ("using System;\nusing System.Windows.Forms;\nusing System.Reflection;\nusing System.Linq;\nusing System.ComponentModel;\n\npublic class CodeEvaler\n{\n\tpublic object EvalCode ()\n\t{\n\t\tForm form = new $formName ();\n\n\t\tVoidControlsParser.ParseControlsForOpening (\"$formName\", (Control) form);\n\n\t\treturn form;\n\t}\n}\n\n". file_get_contents (APP_DIR .'/system/presets/compile_parser_preset.cs') ."\n\n". (string)($form), true);
87
+            $sourceForm = (new WFClass('WinForms_PHP.WFCompiler', ''))->evalCS("using System;\nusing System.Windows.Forms;\nusing System.Reflection;\nusing System.Linq;\nusing System.ComponentModel;\n\npublic class CodeEvaler\n{\n\tpublic object EvalCode ()\n\t{\n\t\tForm form = new $formName ();\n\n\t\tVoidControlsParser.ParseControlsForOpening (\"$formName\", (Control) form);\n\n\t\treturn form;\n\t}\n}\n\n".file_get_contents(APP_DIR.'/system/presets/compile_parser_preset.cs')."\n\n".(string) ($form), true);
88 88
 
89 89
             $form = $GLOBALS['__underConstruction'][$formName];
90 90
             unset ($GLOBALS['__underConstruction'], $form[$formName]);
91 91
 
92
-            $formObjects = array_flip ($info['objects'][$formName]);
92
+            $formObjects = array_flip($info['objects'][$formName]);
93 93
 
94 94
             foreach ($form as $name => $selector)
95 95
                 if (!isset ($formObjects[$name]))
96 96
                     unset ($form[$name]);
97 97
 
98
-            $page = new TabPage ($formName);
98
+            $page = new TabPage($formName);
99 99
             $page->backgroundColor = clWhite;
100 100
 
101
-            $objects['Designer__FormsList']->items->add ($page);
101
+            $objects['Designer__FormsList']->items->add($page);
102 102
 
103
-            $designer = new VoidDesigner ($page, $formName, $objects['PropertiesList__List'], $objects['PropertiesPanel__SelectedComponent'], $objects['Designer__FormsList'], $sourceForm);
104
-            $designer->initDesigner ();
103
+            $designer = new VoidDesigner($page, $formName, $objects['PropertiesList__List'], $objects['PropertiesPanel__SelectedComponent'], $objects['Designer__FormsList'], $sourceForm);
104
+            $designer->initDesigner();
105 105
 
106 106
             // VoidStudioAPI::$objects['main']['Designer__'. $formName .'Designer'] = $designer;
107 107
             VoidStudioAPI::$events[$formName] = $info['events'][$formName] ?? null;
108 108
 
109 109
             foreach ($form as $name => $selector)
110
-                $designer->addComponent ($selector, $name);
110
+                $designer->addComponent($selector, $name);
111 111
         }
112 112
 
113 113
         // Components::cleanJunk ();
114 114
 
115 115
         $objects['Designer__FormsList']->selectedTab = $page;
116 116
 
117
-        $objects['PropertiesPanel__SelectedComponent']->items->clear ();
118
-        $objects['PropertiesPanel__SelectedComponent']->items->addRange (array_keys ($designer->objects));
117
+        $objects['PropertiesPanel__SelectedComponent']->items->clear();
118
+        $objects['PropertiesPanel__SelectedComponent']->items->addRange(array_keys($designer->objects));
119 119
         $objects['PropertiesPanel__SelectedComponent']->selectedItem = $formName;
120 120
 
121
-        VoidStudioAPI::getObjects ('main')['MainForm']->caption = basenameNoExt ($file) .' — VoidStudio';
121
+        VoidStudioAPI::getObjects('main')['MainForm']->caption = basenameNoExt($file).' — VoidStudio';
122 122
 
123 123
         $objects['PropertiesList__List']->selectedObject = $designer->form;
124
-        $designer->focus ();
124
+        $designer->focus();
125 125
     }
126 126
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,18 +8,20 @@  discard block
 block discarded – undo
8 8
 
9 9
     public static function createProject (string $name = 'default'): bool
10 10
     {
11
-        if (!is_dir ($dir = 'C:/Users/'. USERNAME .'/Documents/VoidStudio'))
12
-            dir_create ($dir);
11
+        if (!is_dir ($dir = 'C:/Users/'. USERNAME .'/Documents/VoidStudio')) {
12
+                    dir_create ($dir);
13
+        }
13 14
 
14 15
         if (is_dir ($dir = $dir .'/'. $name))
15 16
         {
16
-            if (messageBox ('Проект "'. $name .'" уже создан. Перезаписать его?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6)
17
-                dir_clean ($dir);
18
-
19
-            else return false;
20
-        }
21
-
22
-        else dir_create ($dir);
17
+            if (messageBox ('Проект "'. $name .'" уже создан. Перезаписать его?', 'Подтвердите действие', enum ('System.Windows.Forms.MessageBoxButtons.YesNo'), enum ('System.Windows.Forms.MessageBoxIcon.Question')) == 6) {
18
+                            dir_clean ($dir);
19
+            } else {
20
+                return false;
21
+            }
22
+        } else {
23
+            dir_create ($dir);
24
+        }
23 25
 
24 26
         self::$projectPath = $dir;
25 27
 
@@ -54,8 +56,9 @@  discard block
 block discarded – undo
54 56
 
55 57
         file_put_contents ($file, gzdeflate (serialize ($info), 9));
56 58
 
57
-        if (replaceSl (self::$projectPath) != replaceSl (dirname ($file)))
58
-            dir_copy (self::$projectPath .'/modules', dirname ($file) .'/modules');
59
+        if (replaceSl (self::$projectPath) != replaceSl (dirname ($file))) {
60
+                    dir_copy (self::$projectPath .'/modules', dirname ($file) .'/modules');
61
+        }
59 62
 
60 63
         VoidStudioAPI::getObjects ('main')['ToolsPanel__LogList']->items->add ('Проект успешно сохранён');
61 64
     }
@@ -91,9 +94,10 @@  discard block
 block discarded – undo
91 94
 
92 95
             $formObjects = array_flip ($info['objects'][$formName]);
93 96
 
94
-            foreach ($form as $name => $selector)
95
-                if (!isset ($formObjects[$name]))
96
-                    unset ($form[$name]);
97
+            foreach ($form as $name => $selector) {
98
+                            if (!isset ($formObjects[$name]))
99
+                    unset ($form[$name]);
100
+            }
97 101
 
98 102
             $page = new TabPage ($formName);
99 103
             $page->backgroundColor = clWhite;
@@ -106,8 +110,9 @@  discard block
 block discarded – undo
106 110
             // VoidStudioAPI::$objects['main']['Designer__'. $formName .'Designer'] = $designer;
107 111
             VoidStudioAPI::$events[$formName] = $info['events'][$formName] ?? null;
108 112
 
109
-            foreach ($form as $name => $selector)
110
-                $designer->addComponent ($selector, $name);
113
+            foreach ($form as $name => $selector) {
114
+                            $designer->addComponent ($selector, $name);
115
+            }
111 116
         }
112 117
 
113 118
         // Components::cleanJunk ();
Please login to merge, or discard this patch.
qero-packages/winforms-php/VoidFramework/engine/common/EngineInterfaces.php 3 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
     
199 199
     public function __get ($name)
200
-	{
200
+    {
201 201
         if (method_exists ($this, $method = "get_$name"))
202 202
             $value = $this->$method ();
203 203
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                 $size = $this->count;
227 227
                 $list = [];
228 228
                 
229
-				for ($i = 0; $i < $size; ++$i)
229
+                for ($i = 0; $i < $size; ++$i)
230 230
                     $list[] = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $i));
231 231
                 
232 232
                 return $list;
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
         }
257 257
 
258 258
         return EngineAdditions::coupleSelector ($value, $this->selector);
259
-	}
259
+    }
260 260
 	
261
-	public function __set ($name, $value)
262
-	{
261
+    public function __set ($name, $value)
262
+    {
263 263
         if (method_exists ($this, $method = "set_$name"))
264 264
             try
265 265
             {
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
         }
288 288
     }
289 289
 	
290
-	public function __call ($method, $args)
291
-	{
290
+    public function __call ($method, $args)
291
+    {
292 292
         $args = array_map (function ($arg)
293 293
         {
294 294
             return EngineAdditions::uncoupleSelector ($arg);
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     }
308 308
     
309 309
     public function offsetSet ($index, $value)
310
-	{
310
+    {
311 311
         try
312 312
         {
313 313
             return $index === null ?
@@ -323,14 +323,14 @@  discard block
 block discarded – undo
323 323
         }
324 324
     }
325 325
 	
326
-	public function offsetGet ($index)
327
-	{
328
-		return EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $index), $this->selector);
326
+    public function offsetGet ($index)
327
+    {
328
+        return EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $index), $this->selector);
329 329
     }
330 330
 	
331
-	public function offsetUnset ($index): void
332
-	{
333
-		$this->callMethod ('RemoveAt', $index);
331
+    public function offsetUnset ($index): void
332
+    {
333
+        $this->callMethod ('RemoveAt', $index);
334 334
     }
335 335
     
336 336
     public function offsetExists ($index): bool
@@ -348,19 +348,19 @@  discard block
 block discarded – undo
348 348
         return true;
349 349
     }
350 350
 	
351
-	public function indexOf ($value): int
352
-	{
353
-		return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
351
+    public function indexOf ($value): int
352
+    {
353
+        return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
354 354
     }
355 355
     
356 356
     public function lastIndexOf ($value): int
357
-	{
358
-		return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
359
-	}
357
+    {
358
+        return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
359
+    }
360 360
 	
361
-	public function contains ($value): bool
362
-	{
363
-		return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
361
+    public function contains ($value): bool
362
+    {
363
+        return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
364 364
     }
365 365
 
366 366
     public function foreach (callable $callback, string $type = null): void
@@ -414,45 +414,45 @@  discard block
 block discarded – undo
414 414
         return \VoidCore::callMethod ($this->selector, $method, ...$args);
415 415
     }
416 416
 	
417
-	protected function getArrayProperty ($name, string $type = null)
418
-	{
417
+    protected function getArrayProperty ($name, string $type = null)
418
+    {
419 419
         $array  = $this->getProperty ($name);
420 420
         $size   = \VoidCore::getProperty ($array, 'Length');
421 421
         $return = [];
422 422
 
423
-		for ($i = 0; $i < $size; ++$i)
423
+        for ($i = 0; $i < $size; ++$i)
424 424
             $return[] = \VoidCore::getArrayValue ($array, $type === null ? $i : [$i, $type]);
425 425
         
426 426
         \VoidCore::removeObjects ($array);
427 427
         
428
-		return $return;
428
+        return $return;
429 429
     }
430 430
 
431 431
     public function get_name ()
432
-	{
433
-		try
434
-		{
435
-			return $this->getProperty ('Name');
432
+    {
433
+        try
434
+        {
435
+            return $this->getProperty ('Name');
436 436
         }
437 437
         
438
-		catch (\Throwable $e)
439
-		{
440
-			return $this->name;
441
-		}
442
-	}
438
+        catch (\Throwable $e)
439
+        {
440
+            return $this->name;
441
+        }
442
+    }
443 443
 	
444
-	public function set_name (string $name)
445
-	{
446
-		try
447
-		{
448
-			$this->setProperty ('Name', $name);
444
+    public function set_name (string $name)
445
+    {
446
+        try
447
+        {
448
+            $this->setProperty ('Name', $name);
449 449
         }
450 450
         
451
-		catch (\Throwable $e)
452
-		{
453
-			$this->name = $name;
454
-		}
455
-	}
451
+        catch (\Throwable $e)
452
+        {
453
+            $this->name = $name;
454
+        }
455
+    }
456 456
 
457 457
     public function __toString (): string
458 458
     {
Please login to merge, or discard this patch.
Spacing   +104 added lines, -106 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
      * @return array - возвращает список ошибок компиляции
25 25
      * 
26 26
      */
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
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 29
         if ($dictionary === null)
30
-            $dictionary = new WFObject ('System.Collections.Generic.Dictionary`2[System.String,System.String]', 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
+            $assemblies = getNetArray('System.String', [
34 34
                 // CORE_DIR .'/CefSharp.dll',
35
-                CORE_DIR .'/FastColoredTextBox.dll',
36
-                CORE_DIR .'/ScintillaNET.dll'
35
+                CORE_DIR.'/FastColoredTextBox.dll',
36
+                CORE_DIR.'/ScintillaNET.dll'
37 37
             ]);
38 38
 
39 39
         if ($productName === null)
40
-            $productName = basenameNoExt ($savePath);
40
+            $productName = basenameNoExt($savePath);
41 41
 
42 42
         if ($productDescription === null)
43 43
             $productDescription = $productName;
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
             $companyName = 'Company N';
50 50
 
51 51
         if ($copyright === null)
52
-            $copyright = $companyName .' copyright (c) '. date ('Y');
52
+            $copyright = $companyName.' copyright (c) '.date('Y');
53 53
 
54
-        return (new WFClass ('WinForms_PHP.WFCompiler', null))->compile ($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
54
+        return (new WFClass('WinForms_PHP.WFCompiler', null))->compile($savePath, $iconPath, $phpCode, $productDescription, $productName, $productVersion, $companyName, $copyright, $callSharpCode, $declareSharpCode, $dictionary, $assemblies)->names;
55 55
     }
56 56
 
57
-    public static function loadModule (string $path): bool
57
+    public static function loadModule(string $path): bool
58 58
     {
59 59
         try
60 60
         {
61
-            (new WFClass ('System.Reflection.Assembly', 'mscorlib'))->loadFrom ($path);
61
+            (new WFClass('System.Reflection.Assembly', 'mscorlib'))->loadFrom($path);
62 62
         }
63 63
 
64 64
         catch (\WinFormsException $e)
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
         return true;
70 70
     }
71 71
 
72
-    public static function getProperty (int $selector, string $name): array
72
+    public static function getProperty(int $selector, string $name): array
73 73
     {
74
-        $property = \VoidCore::callMethod (\VoidCore::callMethod ($selector, 'GetType'), 'GetProperty', $name);
74
+        $property = \VoidCore::callMethod(\VoidCore::callMethod($selector, 'GetType'), 'GetProperty', $name);
75 75
 
76
-        if (!is_int ($property))
76
+        if (!is_int($property))
77 77
             return false;
78 78
 
79 79
         try
80 80
         {
81
-            $propertyType = \VoidCore::getProperty ($property, ['PropertyType', 'string']);
81
+            $propertyType = \VoidCore::getProperty($property, ['PropertyType', 'string']);
82 82
 
83 83
             switch ($propertyType)
84 84
             {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 default:
115 115
                     try
116 116
                     {
117
-                        \VoidCore::getProperty ($selector, [$name, 'int']);
117
+                        \VoidCore::getProperty($selector, [$name, 'int']);
118 118
 
119 119
                         $property = 'int';
120 120
                     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                     {
124 124
                         return [
125 125
                             'type'  => 'vrsf',
126
-                            'value' => \VoidCore::exportObject (\VoidCore::getProperty ($selector, [$name, 'object']))
126
+                            'value' => \VoidCore::exportObject(\VoidCore::getProperty($selector, [$name, 'object']))
127 127
                         ];
128 128
                     }
129 129
                 break;
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 
138 138
         return [
139 139
             'type'  => $property,
140
-            'value' => \VoidCore::getProperty ($selector, [$name, $property])
140
+            'value' => \VoidCore::getProperty($selector, [$name, $property])
141 141
         ];
142 142
     }
143 143
 
144
-    public static function getObjectEvents (int $object): array
144
+    public static function getObjectEvents(int $object): array
145 145
     {
146 146
         $events = [];
147 147
 
148
-        $props = \VoidCore::callMethod (\VoidCore::callMethod ($object, 'GetType'), 'GetEvents');
149
-        $len   = \VoidCore::getProperty ($props, 'Length');
148
+        $props = \VoidCore::callMethod(\VoidCore::callMethod($object, 'GetType'), 'GetEvents');
149
+        $len   = \VoidCore::getProperty($props, 'Length');
150 150
 
151 151
         for ($i = 0; $i < $len; ++$i)
152
-            $events[] = \VoidCore::getProperty (\VoidCore::getArrayValue ($props, $i), 'Name');
152
+            $events[] = \VoidCore::getProperty(\VoidCore::getArrayValue($props, $i), 'Name');
153 153
 
154 154
         return $events;
155 155
     }
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
      * Тогда получается бесконечный цикл вида object->selector->selector->selector->...
160 160
      * Чтобы этого избежать нужно добавить исключение - переменную $selfSelector
161 161
      */
162
-    public static function coupleSelector ($value, int $selfSelector = null)
162
+    public static function coupleSelector($value, int $selfSelector = null)
163 163
     {
164
-        return is_int ($value) && \VoidCore::objectExists ($value) && $value != $selfSelector ?
165
-            new WFObject ($value) : $value;
164
+        return is_int($value) && \VoidCore::objectExists($value) && $value != $selfSelector ?
165
+            new WFObject($value) : $value;
166 166
     }
167 167
 
168
-    public static function uncoupleSelector ($value)
168
+    public static function uncoupleSelector($value)
169 169
     {
170 170
         return $value instanceof WFObject ?
171 171
             $value->selector : $value;
@@ -177,48 +177,48 @@  discard block
 block discarded – undo
177 177
     protected int $selector = 0;
178 178
     protected $name;
179 179
 
180
-    public function __construct ($object, $classGroup = false, ...$args)
180
+    public function __construct($object, $classGroup = false, ...$args)
181 181
     {
182 182
         foreach ($args as $id => $arg)
183
-            $args[$id] = EngineAdditions::uncoupleSelector ($arg);
183
+            $args[$id] = EngineAdditions::uncoupleSelector($arg);
184 184
 
185
-        if (is_string ($object))
185
+        if (is_string($object))
186 186
         {
187
-            $this->selector = \VoidCore::createObject ($object, $classGroup, ...$args);
187
+            $this->selector = \VoidCore::createObject($object, $classGroup, ...$args);
188 188
             
189 189
             /*$this->selector = \VoidCore::createObject ($object, $classGroup == 'auto' ?
190 190
                 substr ($object, 0, strrpos ($object, '.')) : $classGroup, ...$args);*/
191 191
         }
192 192
 
193
-        elseif (is_int ($object) && \VoidCore::objectExists ($object))
193
+        elseif (is_int($object) && \VoidCore::objectExists($object))
194 194
             $this->selector = $object;
195 195
 
196
-        else throw new \Exception ('$object parameter must be string or object selector');
196
+        else throw new \Exception('$object parameter must be string or object selector');
197 197
     }
198 198
     
199
-    public function __get ($name)
199
+    public function __get($name)
200 200
 	{
201
-        if (method_exists ($this, $method = "get_$name"))
202
-            $value = $this->$method ();
201
+        if (method_exists($this, $method = "get_$name"))
202
+            $value = $this->$method();
203 203
 
204
-        elseif (substr ($name, -5) == 'Event')
205
-            $value = Events::getObjectEvent ($this->selector, substr ($name, 0, -5));
204
+        elseif (substr($name, -5) == 'Event')
205
+            $value = Events::getObjectEvent($this->selector, substr($name, 0, -5));
206 206
 
207
-        elseif (property_exists ($this, $name))
207
+        elseif (property_exists($this, $name))
208 208
             $value = $this->$name;
209 209
 
210
-        else switch (strtolower ($name))
210
+        else switch (strtolower($name))
211 211
         {
212 212
             case 'count':
213 213
             case 'length':
214 214
                 try
215 215
                 {
216
-                    return $this->getProperty ('Count');
216
+                    return $this->getProperty('Count');
217 217
                 }
218 218
 
219 219
                 catch (\WinFormsException $e)
220 220
                 {
221
-                    return $this->getProperty ('Length');
221
+                    return $this->getProperty('Length');
222 222
                 }
223 223
             break;
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 $list = [];
228 228
                 
229 229
 				for ($i = 0; $i < $size; ++$i)
230
-                    $list[] = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $i));
230
+                    $list[] = EngineAdditions::coupleSelector(\VoidCore::getArrayValue($this->selector, $i));
231 231
                 
232 232
                 return $list;
233 233
             break;
@@ -239,31 +239,31 @@  discard block
 block discarded – undo
239 239
                 for ($i = 0; $i < $size; ++$i)
240 240
                     try
241 241
                     {
242
-                        $names[] = \VoidCore::getProperty (\VoidCore::getArrayValue ($this->selector, [$i, 'object']), 'Text');
242
+                        $names[] = \VoidCore::getProperty(\VoidCore::getArrayValue($this->selector, [$i, 'object']), 'Text');
243 243
                     }
244 244
 
245 245
                     catch (\WinFormsException $e)
246 246
                     {
247
-                        $names[] = \VoidCore::getArrayValue ($this->selector, [$i, 'string']);
247
+                        $names[] = \VoidCore::getArrayValue($this->selector, [$i, 'string']);
248 248
                     }
249 249
                 
250 250
                 return $names;
251 251
             break;
252 252
 
253 253
             default:
254
-                $value = $this->getProperty ($name);
254
+                $value = $this->getProperty($name);
255 255
             break;
256 256
         }
257 257
 
258
-        return EngineAdditions::coupleSelector ($value, $this->selector);
258
+        return EngineAdditions::coupleSelector($value, $this->selector);
259 259
 	}
260 260
 	
261
-	public function __set ($name, $value)
261
+	public function __set($name, $value)
262 262
 	{
263
-        if (method_exists ($this, $method = "set_$name"))
263
+        if (method_exists($this, $method = "set_$name"))
264 264
             try
265 265
             {
266
-                return $this->$method ($value);
266
+                return $this->$method($value);
267 267
             }
268 268
 
269 269
             # Метод "set_$name" может принимать в качестве параметра объект WFObject
@@ -272,72 +272,70 @@  discard block
 block discarded – undo
272 272
             catch (\Throwable $e)
273 273
             {
274 274
                 return $value instanceof WFObject ?
275
-                    $this->$method ($value->selector) : null;
275
+                    $this->$method($value->selector) : null;
276 276
             }
277 277
 
278
-        elseif (substr ($name, -5) == 'Event')
279
-            Events::setObjectEvent ($this->selector, substr ($name, 0, -5), $value);
278
+        elseif (substr($name, -5) == 'Event')
279
+            Events::setObjectEvent($this->selector, substr($name, 0, -5), $value);
280 280
         
281 281
         else
282 282
         {
283
-            if (is_array ($value) && is_string (current ($value)))
284
-                $value = getNetArray ('System.String', $value);
283
+            if (is_array($value) && is_string(current($value)))
284
+                $value = getNetArray('System.String', $value);
285 285
 
286
-            $this->setProperty ($name, EngineAdditions::uncoupleSelector ($value));
286
+            $this->setProperty($name, EngineAdditions::uncoupleSelector($value));
287 287
         }
288 288
     }
289 289
 	
290
-	public function __call ($method, $args)
290
+	public function __call($method, $args)
291 291
 	{
292
-        $args = array_map (function ($arg)
292
+        $args = array_map(function($arg)
293 293
         {
294
-            return EngineAdditions::uncoupleSelector ($arg);
294
+            return EngineAdditions::uncoupleSelector($arg);
295 295
         }, $args);
296 296
 
297
-        return EngineAdditions::coupleSelector ($this->callMethod ($method, ...$args), $this->selector);
297
+        return EngineAdditions::coupleSelector($this->callMethod($method, ...$args), $this->selector);
298 298
     }
299 299
 
300
-    public function addRange ($values, $assoc = false): void
300
+    public function addRange($values, $assoc = false): void
301 301
     {
302
-        if (is_array ($values))
302
+        if (is_array($values))
303 303
             foreach ($values as $id => $value)
304
-                $this->offsetSet ($assoc ? $id : null, $value);
304
+                $this->offsetSet($assoc ? $id : null, $value);
305 305
 
306
-        else $this->callMethod ('AddRange', EngineAdditions::uncoupleSelector ($values));
306
+        else $this->callMethod('AddRange', EngineAdditions::uncoupleSelector($values));
307 307
     }
308 308
     
309
-    public function offsetSet ($index, $value)
309
+    public function offsetSet($index, $value)
310 310
 	{
311 311
         try
312 312
         {
313 313
             return $index === null ?
314
-                $this->callMethod ('Add', EngineAdditions::uncoupleSelector ($value)) :
315
-                $this->callMethod ('Insert', $index, EngineAdditions::uncoupleSelector ($value));
314
+                $this->callMethod('Add', EngineAdditions::uncoupleSelector($value)) : $this->callMethod('Insert', $index, EngineAdditions::uncoupleSelector($value));
316 315
         }
317 316
 
318 317
         catch (\Throwable $e)
319 318
         {
320 319
             return $index === null ?
321
-                \VoidCore::setArrayValue ($this->selector, $this->count, EngineAdditions::uncoupleSelector ($value)) :
322
-                \VoidCore::setArrayValue ($this->selector, $index, EngineAdditions::uncoupleSelector ($value));
320
+                \VoidCore::setArrayValue($this->selector, $this->count, EngineAdditions::uncoupleSelector($value)) : \VoidCore::setArrayValue($this->selector, $index, EngineAdditions::uncoupleSelector($value));
323 321
         }
324 322
     }
325 323
 	
326
-	public function offsetGet ($index)
324
+	public function offsetGet($index)
327 325
 	{
328
-		return EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $index), $this->selector);
326
+		return EngineAdditions::coupleSelector(\VoidCore::getArrayValue($this->selector, $index), $this->selector);
329 327
     }
330 328
 	
331
-	public function offsetUnset ($index): void
329
+	public function offsetUnset($index): void
332 330
 	{
333
-		$this->callMethod ('RemoveAt', $index);
331
+		$this->callMethod('RemoveAt', $index);
334 332
     }
335 333
     
336
-    public function offsetExists ($index): bool
334
+    public function offsetExists($index): bool
337 335
     {
338 336
         try
339 337
         {
340
-            $this->offsetGet ($index);
338
+            $this->offsetGet($index);
341 339
         }
342 340
 
343 341
         catch (\Exception $e)
@@ -348,19 +346,19 @@  discard block
 block discarded – undo
348 346
         return true;
349 347
     }
350 348
 	
351
-	public function indexOf ($value): int
349
+	public function indexOf($value): int
352 350
 	{
353
-		return $this->callMethod ('IndexOf', EngineAdditions::uncoupleSelector ($value));
351
+		return $this->callMethod('IndexOf', EngineAdditions::uncoupleSelector($value));
354 352
     }
355 353
     
356
-    public function lastIndexOf ($value): int
354
+    public function lastIndexOf($value): int
357 355
 	{
358
-		return $this->callMethod ('LastIndexOf', EngineAdditions::uncoupleSelector ($value));
356
+		return $this->callMethod('LastIndexOf', EngineAdditions::uncoupleSelector($value));
359 357
 	}
360 358
 	
361
-	public function contains ($value): bool
359
+	public function contains($value): bool
362 360
 	{
363
-		return $this->callMethod ('Contains', EngineAdditions::uncoupleSelector ($value));
361
+		return $this->callMethod('Contains', EngineAdditions::uncoupleSelector($value));
364 362
     }
365 363
 
366 364
     public function foreach (callable $callback, string $type = null): void
@@ -368,71 +366,71 @@  discard block
 block discarded – undo
368 366
         $size = $this->count;
369 367
 
370 368
         for ($i = 0; $i < $size; ++$i)
371
-            $callback (EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
369
+            $callback(EngineAdditions::coupleSelector(\VoidCore::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i);
372 370
     }
373 371
 
374
-    public function where (callable $comparator, string $type = null): array
372
+    public function where(callable $comparator, string $type = null): array
375 373
     {
376 374
         $size   = $this->count;
377 375
         $return = [];
378 376
 
379 377
         for ($i = 0; $i < $size; ++$i)
380
-            if ($comparator ($value = EngineAdditions::coupleSelector (\VoidCore::getArrayValue ($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
378
+            if ($comparator($value = EngineAdditions::coupleSelector(\VoidCore::getArrayValue($this->selector, $type !== null ? [$i, $type] : $i), $this->selector), $i))
381 379
                 $return[] = $value;
382 380
 
383 381
         return $return;
384 382
     }
385 383
 	
386
-    protected function getProperty ($name)
384
+    protected function getProperty($name)
387 385
     {
388 386
         try
389 387
         {
390
-            return \VoidCore::getProperty ($this->selector, $name);
388
+            return \VoidCore::getProperty($this->selector, $name);
391 389
         }
392 390
 
393 391
         catch (\WinFormsException $e)
394 392
         {
395
-            return \VoidCore::getField ($this->selector, $name);
393
+            return \VoidCore::getField($this->selector, $name);
396 394
         }
397 395
     }
398 396
 
399
-    protected function setProperty ($name, $value)
397
+    protected function setProperty($name, $value)
400 398
     {
401 399
         try
402 400
         {
403
-            \VoidCore::setProperty ($this->selector, $name, $value);
401
+            \VoidCore::setProperty($this->selector, $name, $value);
404 402
         }
405 403
 
406 404
         catch (\WinFormsException $e)
407 405
         {
408
-            \VoidCore::setField ($this->selector, $name, $value);
406
+            \VoidCore::setField($this->selector, $name, $value);
409 407
         }
410 408
     }
411 409
 	
412
-    protected function callMethod ($method, ...$args)
410
+    protected function callMethod($method, ...$args)
413 411
     {
414
-        return \VoidCore::callMethod ($this->selector, $method, ...$args);
412
+        return \VoidCore::callMethod($this->selector, $method, ...$args);
415 413
     }
416 414
 	
417
-	protected function getArrayProperty ($name, string $type = null)
415
+	protected function getArrayProperty($name, string $type = null)
418 416
 	{
419
-        $array  = $this->getProperty ($name);
420
-        $size   = \VoidCore::getProperty ($array, 'Length');
417
+        $array  = $this->getProperty($name);
418
+        $size   = \VoidCore::getProperty($array, 'Length');
421 419
         $return = [];
422 420
 
423 421
 		for ($i = 0; $i < $size; ++$i)
424
-            $return[] = \VoidCore::getArrayValue ($array, $type === null ? $i : [$i, $type]);
422
+            $return[] = \VoidCore::getArrayValue($array, $type === null ? $i : [$i, $type]);
425 423
         
426
-        \VoidCore::removeObjects ($array);
424
+        \VoidCore::removeObjects($array);
427 425
         
428 426
 		return $return;
429 427
     }
430 428
 
431
-    public function get_name ()
429
+    public function get_name()
432 430
 	{
433 431
 		try
434 432
 		{
435
-			return $this->getProperty ('Name');
433
+			return $this->getProperty('Name');
436 434
         }
437 435
         
438 436
 		catch (\Throwable $e)
@@ -441,11 +439,11 @@  discard block
 block discarded – undo
441 439
 		}
442 440
 	}
443 441
 	
444
-	public function set_name (string $name)
442
+	public function set_name(string $name)
445 443
 	{
446 444
 		try
447 445
 		{
448
-			$this->setProperty ('Name', $name);
446
+			$this->setProperty('Name', $name);
449 447
         }
450 448
         
451 449
 		catch (\Throwable $e)
@@ -454,22 +452,22 @@  discard block
 block discarded – undo
454 452
 		}
455 453
 	}
456 454
 
457
-    public function __toString (): string
455
+    public function __toString(): string
458 456
     {
459
-        return $this->callMethod ('ToString');
457
+        return $this->callMethod('ToString');
460 458
     }
461 459
 }
462 460
 
463 461
 class WFClass extends WFObject
464 462
 {
465
-    public function __construct ($class, $classGroup = false)
463
+    public function __construct($class, $classGroup = false)
466 464
     {
467
-        if (is_string ($class))
468
-            $this->selector = \VoidCore::getClass ($class, $classGroup);
465
+        if (is_string($class))
466
+            $this->selector = \VoidCore::getClass($class, $classGroup);
469 467
 
470
-        elseif (is_int ($class) && \VoidCore::objectExists ($class))
468
+        elseif (is_int($class) && \VoidCore::objectExists($class))
471 469
             $this->selector = $class;
472 470
 
473
-        else throw new \Exception ('$class parameter must be string or class selector');
471
+        else throw new \Exception('$class parameter must be string or class selector');
474 472
     }
475 473
 }
Please login to merge, or discard this 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 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2,50 +2,50 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace VoidEngine;
4 4
 
5
-register_superglobals ('APPLICATION', 'SCREEN');
5
+register_superglobals('APPLICATION', 'SCREEN');
6 6
 
7 7
 $APPLICATION = new class
8 8
 {
9 9
     public WFClass $application;
10 10
     public string $executablePath;
11 11
     
12
-    public function __construct ()
12
+    public function __construct()
13 13
     {
14
-        $this->application    = new WFClass ('System.Windows.Forms.Application');
14
+        $this->application    = new WFClass('System.Windows.Forms.Application');
15 15
         $this->executablePath = $this->application->executablePath;
16 16
     }
17 17
     
18
-    public function run ($form = null): void
18
+    public function run($form = null): void
19 19
     {
20 20
         if ($form instanceof WFObject)
21
-            $this->application->run ($form->selector);
21
+            $this->application->run($form->selector);
22 22
         
23
-        elseif (is_int ($form) && \VoidCore::objectExists ($form))
24
-            $this->application->run ($form);
23
+        elseif (is_int($form) && \VoidCore::objectExists($form))
24
+            $this->application->run($form);
25 25
         
26 26
         elseif ($form === null)
27
-            $this->application->run ();
27
+            $this->application->run();
28 28
 
29
-        else throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector');
29
+        else throw new \Exception('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector');
30 30
     }
31 31
     
32
-    public function restart (): void
32
+    public function restart(): void
33 33
     {
34
-        $this->application->restart ();
35
-        $this->close ();
34
+        $this->application->restart();
35
+        $this->close();
36 36
     }
37 37
     
38
-    public function close (): void
38
+    public function close(): void
39 39
     {
40
-        $this->application->exit ();
40
+        $this->application->exit();
41 41
     }
42 42
 
43
-    public function __call (string $name, array $args)
43
+    public function __call(string $name, array $args)
44 44
     {
45
-        return $this->application->$name (...$args);
45
+        return $this->application->$name(...$args);
46 46
     }
47 47
 
48
-    public function __get (string $name)
48
+    public function __get(string $name)
49 49
     {
50 50
         return $this->application->$name;
51 51
     }
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 {
56 56
     public WFObject $screen;
57 57
     
58
-    public function __construct ()
58
+    public function __construct()
59 59
     {
60
-        $this->screen = new WFClass ('System.Windows.Forms.Screen');
60
+        $this->screen = new WFClass('System.Windows.Forms.Screen');
61 61
     }
62 62
     
63
-    public function __get ($name)
63
+    public function __get($name)
64 64
     {
65
-        switch (strtolower ($name))
65
+        switch (strtolower($name))
66 66
         {
67 67
             case 'width':
68 68
             case 'w':
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         }
81 81
     }
82 82
     
83
-    public function __debugInfo (): array
83
+    public function __debugInfo(): array
84 84
     {
85 85
         return [
86 86
             $this->w,
Please login to merge, or discard this 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 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,28 +4,28 @@
 block discarded – undo
4 4
 
5 5
 class Process extends Component
6 6
 {
7
-	public $class 	  = 'System.Diagnostics.Process';
8
-	public $namespace = 'System';
7
+    public $class 	  = 'System.Diagnostics.Process';
8
+    public $namespace = 'System';
9 9
 
10
-	public function __construct (int $pid = null)
11
-	{
10
+    public function __construct (int $pid = null)
11
+    {
12 12
         $this->selector = \VoidCore::getClass ($this->class, $this->namespace);
13 13
 
14
-		if ($pid !== null)
14
+        if ($pid !== null)
15 15
             $this->selector = $pid == getmypid () ?
16 16
                 \VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
17 17
                 \VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
18 18
 
19
-		Components::addComponent ($this->selector, $this);
20
-	}
19
+        Components::addComponent ($this->selector, $this);
20
+    }
21 21
 	
22
-	public static function getProcessById (int $pid)
23
-	{
24
-		return new self ($pid);
25
-	}
22
+    public static function getProcessById (int $pid)
23
+    {
24
+        return new self ($pid);
25
+    }
26 26
 	
27
-	public static function getCurrentProcess ()
28
-	{
29
-		return new self (getmypid ());
30
-	}
27
+    public static function getCurrentProcess ()
28
+    {
29
+        return new self (getmypid ());
30
+    }
31 31
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,28 +4,27 @@
 block discarded – undo
4 4
 
5 5
 class Process extends Component
6 6
 {
7
-	public $class 	  = 'System.Diagnostics.Process';
7
+	public $class = 'System.Diagnostics.Process';
8 8
 	public $namespace = 'System';
9 9
 
10
-	public function __construct (int $pid = null)
10
+	public function __construct(int $pid = null)
11 11
 	{
12
-        $this->selector = \VoidCore::getClass ($this->class, $this->namespace);
12
+        $this->selector = \VoidCore::getClass($this->class, $this->namespace);
13 13
 
14 14
 		if ($pid !== null)
15
-            $this->selector = $pid == getmypid () ?
16
-                \VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
17
-                \VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
15
+            $this->selector = $pid == getmypid() ?
16
+                \VoidCore::callMethod($this->selector, 'GetCurrentProcess') : \VoidCore::callMethod($this->selector, 'GetProcessById', $pid);
18 17
 
19
-		Components::addComponent ($this->selector, $this);
18
+		Components::addComponent($this->selector, $this);
20 19
 	}
21 20
 	
22
-	public static function getProcessById (int $pid)
21
+	public static function getProcessById(int $pid)
23 22
 	{
24
-		return new self ($pid);
23
+		return new self($pid);
25 24
 	}
26 25
 	
27
-	public static function getCurrentProcess ()
26
+	public static function getCurrentProcess()
28 27
 	{
29
-		return new self (getmypid ());
28
+		return new self(getmypid());
30 29
 	}
31 30
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,11 @@
 block discarded – undo
11 11
 	{
12 12
         $this->selector = \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/Image.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@
 block discarded – undo
31 31
     }
32 32
 
33 33
     public function applyToObject (int $selector): void
34
-	{
35
-		\VoidCore::setProperty ($selector, 'Icon', $this->selector);
36
-	}
34
+    {
35
+        \VoidCore::setProperty ($selector, 'Icon', $this->selector);
36
+    }
37 37
 	
38
-	public function saveToFile (string $file): void
39
-	{
40
-		\VoidCore::callMethod ($this->selector, 'Save', $file);
41
-	}
38
+    public function saveToFile (string $file): void
39
+    {
40
+        \VoidCore::callMethod ($this->selector, 'Save', $file);
41
+    }
42 42
 }
43 43
 
44 44
 class Bitmap extends WFObject
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
     public $class     = 'System.Drawing.Image';
8 8
     public $namespace = 'System.Drawing';
9 9
 
10
-    public function __construct ()
10
+    public function __construct()
11 11
     {
12
-        parent::__construct ($this->class);
12
+        parent::__construct($this->class);
13 13
     }
14 14
 
15
-    public function loadFromFile (string $path)
15
+    public function loadFromFile(string $path)
16 16
     {
17
-        return $this->fromFile ($path);
17
+        return $this->fromFile($path);
18 18
     }
19 19
 }
20 20
 
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
     public $class     = 'System.Drawing.Icon';
24 24
     public $namespace = 'System.Drawing';
25 25
 
26
-    public function __construct (string $file)
26
+    public function __construct(string $file)
27 27
     {
28
-        parent::__construct ($this->class);
28
+        parent::__construct($this->class);
29 29
 
30
-        $this->fromFile ($file);
30
+        $this->fromFile($file);
31 31
     }
32 32
 
33
-    public function applyToObject (int $selector): void
33
+    public function applyToObject(int $selector): void
34 34
 	{
35
-		\VoidCore::setProperty ($selector, 'Icon', $this->selector);
35
+		\VoidCore::setProperty($selector, 'Icon', $this->selector);
36 36
 	}
37 37
 	
38
-	public function saveToFile (string $file): void
38
+	public function saveToFile(string $file): void
39 39
 	{
40
-		\VoidCore::callMethod ($this->selector, 'Save', $file);
40
+		\VoidCore::callMethod($this->selector, 'Save', $file);
41 41
 	}
42 42
 }
43 43
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     public $class     = 'System.Drawing.Bitmap';
47 47
     public $namespace = 'System.Drawing';
48 48
 
49
-    public function __construct (string $filename)
49
+    public function __construct(string $filename)
50 50
     {
51
-        parent::__construct ($this->class, $this->namespace, [$filename, 'string']);
51
+        parent::__construct($this->class, $this->namespace, [$filename, 'string']);
52 52
     }
53 53
 }
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/components/Form.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,37 +4,37 @@  discard block
 block discarded – undo
4 4
 
5 5
 class Form extends Control
6 6
 {
7
-	public $class = 'System.Windows.Forms.Form';
7
+    public $class = 'System.Windows.Forms.Form';
8 8
 
9
-	public function get_icon ()
10
-	{
11
-		return new FormIcon ($this->selector);
12
-	}
9
+    public function get_icon ()
10
+    {
11
+        return new FormIcon ($this->selector);
12
+    }
13 13
 	
14
-	public function get_clientSize ()
15
-	{
16
-		$size = $this->getProperty ('ClientSize');
14
+    public function get_clientSize ()
15
+    {
16
+        $size = $this->getProperty ('ClientSize');
17 17
 		
18
-		return [
19
-			\VoidCore::getProperty ($size, 'Width'),
20
-			\VoidCore::getProperty ($size, 'Height')
21
-		];
22
-	}
18
+        return [
19
+            \VoidCore::getProperty ($size, 'Width'),
20
+            \VoidCore::getProperty ($size, 'Height')
21
+        ];
22
+    }
23 23
 	
24
-	public function set_clientSize ($size)
25
-	{
26
-		if (is_array ($size))
27
-		{
28
-			$clientSize = $this->getProperty ('ClientSize');
24
+    public function set_clientSize ($size)
25
+    {
26
+        if (is_array ($size))
27
+        {
28
+            $clientSize = $this->getProperty ('ClientSize');
29 29
 
30
-			\VoidCore::setProperty ($clientSize, 'Width', array_shift ($size));
31
-			\VoidCore::setProperty ($clientSize, 'Height', array_shift ($size));
30
+            \VoidCore::setProperty ($clientSize, 'Width', array_shift ($size));
31
+            \VoidCore::setProperty ($clientSize, 'Height', array_shift ($size));
32 32
 
33
-			$this->setProperty ('ClientSize', $clientSize);
34
-		}
33
+            $this->setProperty ('ClientSize', $clientSize);
34
+        }
35 35
 
36
-		else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
37
-	}
36
+        else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
37
+    }
38 38
 }
39 39
 
40 40
 class FormIcon extends Icon
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
     public function loadFromFile (string $file)
50
-	{
50
+    {
51 51
         $icon = \VoidCore::createObject ('System.Drawing.Icon', 'System.Drawing', $file);
52 52
         
53 53
         \VoidCore::setProperty ($this->formSelector, 'Icon', $icon);
54 54
 
55
-		if (!isset ($this->selector))
56
-		    $this->selector = $icon;
57
-	}
55
+        if (!isset ($this->selector))
56
+            $this->selector = $icon;
57
+    }
58 58
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,34 +6,34 @@  discard block
 block discarded – undo
6 6
 {
7 7
 	public $class = 'System.Windows.Forms.Form';
8 8
 
9
-	public function get_icon ()
9
+	public function get_icon()
10 10
 	{
11
-		return new FormIcon ($this->selector);
11
+		return new FormIcon($this->selector);
12 12
 	}
13 13
 	
14
-	public function get_clientSize ()
14
+	public function get_clientSize()
15 15
 	{
16
-		$size = $this->getProperty ('ClientSize');
16
+		$size = $this->getProperty('ClientSize');
17 17
 		
18 18
 		return [
19
-			\VoidCore::getProperty ($size, 'Width'),
20
-			\VoidCore::getProperty ($size, 'Height')
19
+			\VoidCore::getProperty($size, 'Width'),
20
+			\VoidCore::getProperty($size, 'Height')
21 21
 		];
22 22
 	}
23 23
 	
24
-	public function set_clientSize ($size)
24
+	public function set_clientSize($size)
25 25
 	{
26
-		if (is_array ($size))
26
+		if (is_array($size))
27 27
 		{
28
-			$clientSize = $this->getProperty ('ClientSize');
28
+			$clientSize = $this->getProperty('ClientSize');
29 29
 
30
-			\VoidCore::setProperty ($clientSize, 'Width', array_shift ($size));
31
-			\VoidCore::setProperty ($clientSize, 'Height', array_shift ($size));
30
+			\VoidCore::setProperty($clientSize, 'Width', array_shift($size));
31
+			\VoidCore::setProperty($clientSize, 'Height', array_shift($size));
32 32
 
33
-			$this->setProperty ('ClientSize', $clientSize);
33
+			$this->setProperty('ClientSize', $clientSize);
34 34
 		}
35 35
 
36
-		else $this->setProperty ('ClientSize', EngineAdditions::uncoupleSelector ($size));
36
+		else $this->setProperty('ClientSize', EngineAdditions::uncoupleSelector($size));
37 37
 	}
38 38
 }
39 39
 
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 {
42 42
     protected $formSelector;
43 43
 
44
-    public function __construct (int $formSelector)
44
+    public function __construct(int $formSelector)
45 45
     {
46 46
         $this->formSelector = $formSelector;
47 47
     }
48 48
 
49
-    public function loadFromFile (string $file)
49
+    public function loadFromFile(string $file)
50 50
 	{
51
-        $icon = \VoidCore::createObject ('System.Drawing.Icon', 'System.Drawing', $file);
51
+        $icon = \VoidCore::createObject('System.Drawing.Icon', 'System.Drawing', $file);
52 52
         
53
-        \VoidCore::setProperty ($this->formSelector, 'Icon', $icon);
53
+        \VoidCore::setProperty($this->formSelector, 'Icon', $icon);
54 54
 
55 55
 		if (!isset ($this->selector))
56 56
 		    $this->selector = $icon;
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 			\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/ColorDialog.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 {
7 7
     public $class = 'System.Windows.Forms.ColorDialog';
8 8
 
9
-    public function __construct ()
9
+    public function __construct()
10 10
     {
11
-        parent::__construct ($this->class);
11
+        parent::__construct($this->class);
12 12
     }
13 13
 	
14
-    public function get_color ()
14
+    public function get_color()
15 15
     {
16
-        return $this->getProperty (['Color', 'color']);
16
+        return $this->getProperty(['Color', 'color']);
17 17
     }
18 18
 	
19
-    public function set_color (int $color)
19
+    public function set_color(int $color)
20 20
     {
21
-        $this->setProperty ('Color', $color);
21
+        $this->setProperty('Color', $color);
22 22
     }
23 23
 }
Please login to merge, or discard this patch.
bin/qero-packages/winforms-php/VoidFramework/engine/components/Control.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
         $this->text = $caption;
25 25
     }
26 26
 	
27
-	public function set_font ($font): void
28
-	{
27
+    public function set_font ($font): void
28
+    {
29 29
         if (is_array ($font))
30 30
         {
31 31
             $font = array_values ($font);
Please login to merge, or discard this patch.
Spacing   +51 added lines, -52 removed lines patch added patch discarded remove patch
@@ -6,101 +6,100 @@  discard block
 block discarded – undo
6 6
 {
7 7
     public $class = 'System.Windows.Forms.Control';
8 8
 
9
-    public function __construct (Component $parent = null, $className = null, ...$args)
9
+    public function __construct(Component $parent = null, $className = null, ...$args)
10 10
     {
11
-        parent::__construct ($className, ...$args);
11
+        parent::__construct($className, ...$args);
12 12
 
13 13
         if ($parent)
14 14
             $this->parent = $parent;
15 15
     }
16 16
 	
17
-    public function get_caption (): string
17
+    public function get_caption(): string
18 18
     {
19 19
         return $this->text;
20 20
     }
21 21
 	
22
-    public function set_caption (string $caption)
22
+    public function set_caption(string $caption)
23 23
     {
24 24
         $this->text = $caption;
25 25
     }
26 26
 	
27
-	public function set_font ($font): void
27
+	public function set_font($font): void
28 28
 	{
29
-        if (is_array ($font))
29
+        if (is_array($font))
30 30
         {
31
-            $font = array_values ($font);
31
+            $font = array_values($font);
32 32
 
33 33
             $obj = isset ($font[2]) ?
34
-                \VoidCore::createObject ('System.Drawing.Font', 'System.Drawing', $font[0], $font[1], [$font[2], 'System.Drawing.FontStyle, System.Drawing']) :
35
-                \VoidCore::createObject ('System.Drawing.Font', 'System.Drawing', $font[0], $font[1]);
34
+                \VoidCore::createObject('System.Drawing.Font', 'System.Drawing', $font[0], $font[1], [$font[2], 'System.Drawing.FontStyle, System.Drawing']) : \VoidCore::createObject('System.Drawing.Font', 'System.Drawing', $font[0], $font[1]);
36 35
             
37
-            $this->setProperty ('Font', $obj);
36
+            $this->setProperty('Font', $obj);
38 37
         }
39 38
 
40
-        else $this->setProperty ('Font', EngineAdditions::uncoupleSelector ($font));
39
+        else $this->setProperty('Font', EngineAdditions::uncoupleSelector($font));
41 40
     }
42 41
 	
43
-    public function get_backgroundColor ()
42
+    public function get_backgroundColor()
44 43
     {
45
-        return $this->getProperty (['BackColor', 'color']);
44
+        return $this->getProperty(['BackColor', 'color']);
46 45
     }
47 46
 	
48
-    public function set_backgroundColor ($color)
47
+    public function set_backgroundColor($color)
49 48
     {
50
-        $this->setProperty ('BackColor', $color);
49
+        $this->setProperty('BackColor', $color);
51 50
     }
52 51
 	
53
-    public function get_foregroundColor ()
52
+    public function get_foregroundColor()
54 53
     {
55
-        return $this->getProperty (['ForeColor', 'color']);
54
+        return $this->getProperty(['ForeColor', 'color']);
56 55
     }
57 56
 	
58
-    public function set_foregroundColor ($color)
57
+    public function set_foregroundColor($color)
59 58
     {
60
-        $this->setProperty ('ForeColor', $color);
59
+        $this->setProperty('ForeColor', $color);
61 60
     }
62 61
 	
63
-    public function get_w (): int
62
+    public function get_w(): int
64 63
     {
65 64
         return $this->width;
66 65
     }
67 66
 	
68
-    public function set_w (int $w)
67
+    public function set_w(int $w)
69 68
     {
70 69
         $this->width = $w;
71 70
     }
72 71
 	
73
-    public function get_h (): int
72
+    public function get_h(): int
74 73
     {
75 74
         return $this->height;
76 75
     }
77 76
 	
78
-    public function set_h (int $h)
77
+    public function set_h(int $h)
79 78
     {
80 79
         $this->height = $h;
81 80
     }
82 81
 	
83
-    public function get_x (): int
82
+    public function get_x(): int
84 83
     {
85 84
         return $this->left;
86 85
     }
87 86
 	
88
-    public function set_x (int $x)
87
+    public function set_x(int $x)
89 88
     {
90 89
         $this->left = $x;
91 90
     }
92 91
 	
93
-    public function get_y (): int
92
+    public function get_y(): int
94 93
     {
95 94
         return $this->top;
96 95
     }
97 96
 	
98
-    public function set_y (int $y)
97
+    public function set_y(int $y)
99 98
     {
100 99
         $this->top = $y;
101 100
     }
102 101
 
103
-    public function get_bounds (): array
102
+    public function get_bounds(): array
104 103
     {
105 104
         return [
106 105
             $this->left,
@@ -110,11 +109,11 @@  discard block
 block discarded – undo
110 109
         ];
111 110
     }
112 111
 	
113
-    public function set_bounds ($bounds)
112
+    public function set_bounds($bounds)
114 113
     {
115
-        if (is_array ($bounds))
114
+        if (is_array($bounds))
116 115
         {
117
-            $bounds = array_values ($bounds);
116
+            $bounds = array_values($bounds);
118 117
             
119 118
             $this->left   = (int) $bounds[0];
120 119
             $this->top    = (int) $bounds[1];
@@ -122,10 +121,10 @@  discard block
 block discarded – undo
122 121
             $this->height = (int) $bounds[3];
123 122
         }
124 123
 
125
-        else $this->setProperty ('Bounds', EngineAdditions::uncoupleSelector ($bounds));
124
+        else $this->setProperty('Bounds', EngineAdditions::uncoupleSelector($bounds));
126 125
     }
127 126
 	
128
-    public function get_location (): array
127
+    public function get_location(): array
129 128
     {
130 129
         return [
131 130
             $this->left,
@@ -133,20 +132,20 @@  discard block
 block discarded – undo
133 132
         ];
134 133
     }
135 134
 	
136
-    public function set_location ($location)
135
+    public function set_location($location)
137 136
     {
138
-        if (is_array ($location))
137
+        if (is_array($location))
139 138
         {
140
-            $location = array_values ($location);
139
+            $location = array_values($location);
141 140
             
142 141
             $this->left = $location[0];
143 142
             $this->top  = $location[1];
144 143
         }
145 144
 
146
-        else $this->setProperty ('Location', EngineAdditions::uncoupleSelector ($location));
145
+        else $this->setProperty('Location', EngineAdditions::uncoupleSelector($location));
147 146
     }
148 147
 	
149
-    public function get_size (): array
148
+    public function get_size(): array
150 149
     {
151 150
         return [
152 151
             $this->width,
@@ -154,42 +153,42 @@  discard block
 block discarded – undo
154 153
         ];
155 154
     }
156 155
 	
157
-    public function set_size ($size)
156
+    public function set_size($size)
158 157
     {
159
-        if (is_array ($size))
158
+        if (is_array($size))
160 159
         {
161
-            $size = array_values ($size);
160
+            $size = array_values($size);
162 161
             
163 162
             $this->width  = (int) $size[0];
164 163
             $this->height = (int) $size[1];
165 164
         }
166 165
 
167
-        else $this->setProperty ('Size', EngineAdditions::uncoupleSelector ($size));
166
+        else $this->setProperty('Size', EngineAdditions::uncoupleSelector($size));
168 167
     }
169 168
 	
170
-    public function setBounds (int $x, int $y, int $w, int $h)
169
+    public function setBounds(int $x, int $y, int $w, int $h)
171 170
     {
172
-        $this->set_bounds ([$x, $y, $w, $h]);
171
+        $this->set_bounds([$x, $y, $w, $h]);
173 172
     }
174 173
 	
175
-    public function setLocation (int $x, int $y)
174
+    public function setLocation(int $x, int $y)
176 175
     {
177
-        $this->set_location ([$x, $y]);
176
+        $this->set_location([$x, $y]);
178 177
     }
179 178
 	
180
-    public function setSize (int $w, int $h)
179
+    public function setSize(int $w, int $h)
181 180
     {
182
-        $this->set_size ([$w, $h]);
181
+        $this->set_size([$w, $h]);
183 182
     }
184 183
 	
185
-    public function toBack ()
184
+    public function toBack()
186 185
     {
187
-        $this->callMethod ('SendToBack');
186
+        $this->callMethod('SendToBack');
188 187
     }
189 188
 	
190
-    public function toFront ()
189
+    public function toFront()
191 190
     {
192
-        $this->callMethod ('BringToFront');
191
+        $this->callMethod('BringToFront');
193 192
     }
194 193
 }
195 194
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
     {
11 11
         parent::__construct ($className, ...$args);
12 12
 
13
-        if ($parent)
14
-            $this->parent = $parent;
13
+        if ($parent) {
14
+                    $this->parent = $parent;
15
+        }
15 16
     }
16 17
 	
17 18
     public function get_caption (): string
@@ -35,9 +36,9 @@  discard block
 block discarded – undo
35 36
                 \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.
qero-packages/winforms-php/VoidFramework/engine/components/PictureBox.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,48 +4,48 @@
 block discarded – undo
4 4
 
5 5
 class PictureBox extends Control
6 6
 {
7
-	public $class = 'System.Windows.Forms.PictureBox';
7
+    public $class = 'System.Windows.Forms.PictureBox';
8 8
 
9
-	protected $image;
9
+    protected $image;
10 10
 	
11
-	public function __construct (Component $parent = null)
12
-	{
11
+    public function __construct (Component $parent = null)
12
+    {
13 13
         parent::__construct ($parent, $this->class);
14 14
         
15
-		$this->image = new PictureBoxImage ($this->selector);
16
-	}
15
+        $this->image = new PictureBoxImage ($this->selector);
16
+    }
17 17
 }
18 18
 
19 19
 class PictureBoxImage
20 20
 {
21
-	protected $selector;
21
+    protected $selector;
22 22
     protected $pictureBoxSelector;
23 23
     protected $clipboard;
24 24
     
25
-	public function __construct (int $pictureBoxSelector)
26
-	{
27
-		$this->pictureBoxSelector = $pictureBoxSelector;
28
-		$this->selector			  = \VoidCore::getProperty ($pictureBoxSelector, 'Image');
29
-		$this->clipboard		  = new WFClass ('System.Windows.Forms.Clipboard');
30
-	}
25
+    public function __construct (int $pictureBoxSelector)
26
+    {
27
+        $this->pictureBoxSelector = $pictureBoxSelector;
28
+        $this->selector			  = \VoidCore::getProperty ($pictureBoxSelector, 'Image');
29
+        $this->clipboard		  = new WFClass ('System.Windows.Forms.Clipboard');
30
+    }
31 31
 	
32
-	public function loadFromFile (string $file)
33
-	{
32
+    public function loadFromFile (string $file)
33
+    {
34 34
         \VoidCore::setProperty ($this->pictureBoxSelector, 'Image', (new Image ())->loadFromFile ($file)->selector);
35
-	}
35
+    }
36 36
 	
37
-	public function saveToFile (string $file)
38
-	{
39
-		\VoidCore::callMethod ($this->selector, 'Save', $file);
40
-	}
37
+    public function saveToFile (string $file)
38
+    {
39
+        \VoidCore::callMethod ($this->selector, 'Save', $file);
40
+    }
41 41
 	
42
-	public function loadFromClipboard ()
43
-	{
44
-		\VoidCore::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ());
45
-	}
42
+    public function loadFromClipboard ()
43
+    {
44
+        \VoidCore::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ());
45
+    }
46 46
 	
47
-	public function saveToClipboard ()
48
-	{
49
-		$this->clipboard->setImage (\VoidCore::getProperty ($this->pictureBoxSelector, 'Image'));
50
-	}
47
+    public function saveToClipboard ()
48
+    {
49
+        $this->clipboard->setImage (\VoidCore::getProperty ($this->pictureBoxSelector, 'Image'));
50
+    }
51 51
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
 
9 9
 	protected $image;
10 10
 	
11
-	public function __construct (Component $parent = null)
11
+	public function __construct(Component $parent = null)
12 12
 	{
13
-        parent::__construct ($parent, $this->class);
13
+        parent::__construct($parent, $this->class);
14 14
         
15
-		$this->image = new PictureBoxImage ($this->selector);
15
+		$this->image = new PictureBoxImage($this->selector);
16 16
 	}
17 17
 }
18 18
 
@@ -22,30 +22,30 @@  discard block
 block discarded – undo
22 22
     protected $pictureBoxSelector;
23 23
     protected $clipboard;
24 24
     
25
-	public function __construct (int $pictureBoxSelector)
25
+	public function __construct(int $pictureBoxSelector)
26 26
 	{
27 27
 		$this->pictureBoxSelector = $pictureBoxSelector;
28
-		$this->selector			  = \VoidCore::getProperty ($pictureBoxSelector, 'Image');
29
-		$this->clipboard		  = new WFClass ('System.Windows.Forms.Clipboard');
28
+		$this->selector			  = \VoidCore::getProperty($pictureBoxSelector, 'Image');
29
+		$this->clipboard		  = new WFClass('System.Windows.Forms.Clipboard');
30 30
 	}
31 31
 	
32
-	public function loadFromFile (string $file)
32
+	public function loadFromFile(string $file)
33 33
 	{
34
-        \VoidCore::setProperty ($this->pictureBoxSelector, 'Image', (new Image ())->loadFromFile ($file)->selector);
34
+        \VoidCore::setProperty($this->pictureBoxSelector, 'Image', (new Image())->loadFromFile($file)->selector);
35 35
 	}
36 36
 	
37
-	public function saveToFile (string $file)
37
+	public function saveToFile(string $file)
38 38
 	{
39
-		\VoidCore::callMethod ($this->selector, 'Save', $file);
39
+		\VoidCore::callMethod($this->selector, 'Save', $file);
40 40
 	}
41 41
 	
42
-	public function loadFromClipboard ()
42
+	public function loadFromClipboard()
43 43
 	{
44
-		\VoidCore::setProperty ($this->pictureBoxSelector, 'Image', $this->clipboard->getImage ());
44
+		\VoidCore::setProperty($this->pictureBoxSelector, 'Image', $this->clipboard->getImage());
45 45
 	}
46 46
 	
47
-	public function saveToClipboard ()
47
+	public function saveToClipboard()
48 48
 	{
49
-		$this->clipboard->setImage (\VoidCore::getProperty ($this->pictureBoxSelector, 'Image'));
49
+		$this->clipboard->setImage(\VoidCore::getProperty($this->pictureBoxSelector, 'Image'));
50 50
 	}
51 51
 }
Please login to merge, or discard this patch.