Passed
Push — master ( 72f7b3...4061f4 )
by Observer
02:00
created
bin/app/php/VoidStudio API.php 2 patches
Spacing   +24 added lines, -25 removed lines patch added patch discarded remove patch
@@ -8,85 +8,84 @@
 block discarded – undo
8 8
     public static array $events  = [];
9 9
     public static $project;
10 10
 
11
-    public static function addObjects (string $group, array $objects)
11
+    public static function addObjects(string $group, array $objects)
12 12
     {
13
-        self::$objects[$group] = array_merge
14
-        (
13
+        self::$objects[$group] = array_merge(
15 14
             self::$objects[$group] ?? [],
16 15
             $objects
17 16
         );
18 17
     }
19 18
 
20
-    public static function getObjects (string $group)
19
+    public static function getObjects(string $group)
21 20
     {
22 21
         return self::$objects[$group] ?? false;
23 22
     }
24 23
 
25
-    public static function openEventEditor (int $component, string $method, WFObject $eventDescriptor, string $form, VoidDesigner $designer = null)
24
+    public static function openEventEditor(int $component, string $method, WFObject $eventDescriptor, string $form, VoidDesigner $designer = null)
26 25
     {
27
-        $objects = self::getObjects ('editor');
26
+        $objects = self::getObjects('editor');
28 27
         $editor  = $objects['Editor'];
29 28
 
30 29
         $args = [];
31 30
 
32 31
         $eventDescriptor->eventType
33
-            ->getMethod ('Invoke')
34
-            ->getParameters ()
35
-            ->foreach (function ($param) use (&$args)
32
+            ->getMethod('Invoke')
33
+            ->getParameters()
34
+            ->foreach(function($param) use (&$args)
36 35
             {
37
-                $args[] = $param->parameterType->toString ();
36
+                $args[] = $param->parameterType->toString();
38 37
             });
39 38
 
40
-        $args = array_slice ($args, 1);
39
+        $args = array_slice($args, 1);
41 40
         $comments = '';
42 41
 
43 42
         foreach ($args as $id => $arg)
44 43
         {
45
-            $comments .= "\n\t * @param WFObject \$args". ($id > 0 ? $id : '') .' - '. $arg;
44
+            $comments .= "\n\t * @param WFObject \$args".($id > 0 ? $id : '').' - '.$arg;
46 45
 
47
-            $args[$id] = '$args'. ($id > 0 ? $id : '');
46
+            $args[$id] = '$args'.($id > 0 ? $id : '');
48 47
         }
49 48
 
50 49
         $comments = "\t/**\n\t * @method $method\n\n\t * @param WFObject \$self$comments\n\t */";
51 50
 
52 51
         if (!isset (self::$events[$form]))
53
-            self::$events[$form] = "class $form extends Form\n{\n$comments\n\tpublic function $method (WFObject \$self, ". implode (', ', $args) .")\n\t{\n\t\t\n\t}\n}\n";
52
+            self::$events[$form] = "class $form extends Form\n{\n$comments\n\tpublic function $method (WFObject \$self, ".implode(', ', $args).")\n\t{\n\t\t\n\t}\n}\n";
54 53
 
55 54
         // preg_match ('/function(\s)*'. $method .'(\s)*\(/i', self::$events[$form])
56
-        elseif (!in_array ($method, ClassWorker::getAvailableClassMethods (self::$events[$form], $form)))
57
-            self::$events[$form] = ClassWorker::applyClass (self::$events[$form], $form, "\n$comments\n\tpublic function $method (WFObject \$self, ". implode (', ', $args) .")\n\t{\n\t\t\n\t}\n");
55
+        elseif (!in_array($method, ClassWorker::getAvailableClassMethods(self::$events[$form], $form)))
56
+            self::$events[$form] = ClassWorker::applyClass(self::$events[$form], $form, "\n$comments\n\tpublic function $method (WFObject \$self, ".implode(', ', $args).")\n\t{\n\t\t\n\t}\n");
58 57
 
59 58
         $editor->text = self::$events[$form];
60 59
         $editor->helpStorage = $form;
61 60
 
62 61
         // $form->caption = 'Событие "'. $event .'", объект "'. ($designer === null ? \VoidCore::getProperty ($component, 'Name') : $designer->getComponentName ($component)) .'"';
63 62
 
64
-        $objects['MainForm']->showDialog ();
63
+        $objects['MainForm']->showDialog();
65 64
     }
66 65
 
67
-    public static function stopProject ()
66
+    public static function stopProject()
68 67
     {
69 68
         if (self::$project instanceof WFObject && !self::$project->hasExited)
70 69
         {
71
-            self::$project->kill ();
72
-            self::$project->waitForExit ();
70
+            self::$project->kill();
71
+            self::$project->waitForExit();
73 72
         }
74 73
     }
75 74
 
76
-    public static function startProject (TabControl $formsList, bool $debug = true): ?WFObject
75
+    public static function startProject(TabControl $formsList, bool $debug = true): ?WFObject
77 76
     {
78
-        self::stopProject ();
77
+        self::stopProject();
79 78
 
80 79
         try
81 80
         {
82
-            VoidStudioBuilder::compileProject (VoidStudioProjectManager::$projectPath .'/build.exe', $formsList->items[0]->text, VoidStudioBuilder::getReferences (ENGINE_DIR .'/VoidEngine.php'), [], false, $debug);
81
+            VoidStudioBuilder::compileProject(VoidStudioProjectManager::$projectPath.'/build.exe', $formsList->items[0]->text, VoidStudioBuilder::getReferences(ENGINE_DIR.'/VoidEngine.php'), [], false, $debug);
83 82
 
84
-            self::$project = run (VoidStudioProjectManager::$projectPath .'/build/build.exe');
83
+            self::$project = run(VoidStudioProjectManager::$projectPath.'/build/build.exe');
85 84
         }
86 85
 
87 86
         catch (\Throwable $e)
88 87
         {
89
-            messageBox ('Нельзя сохранить проект или произошла ошибка компиляции' ."\n\nПодробнее:\n\n". print_r ($e, true), 'Ошибка запуска проекта', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
88
+            messageBox('Нельзя сохранить проект или произошла ошибка компиляции'."\n\nПодробнее:\n\n".print_r($e, true), 'Ошибка запуска проекта', enum('System.Windows.Forms.MessageBoxButtons.OK'), enum('System.Windows.Forms.MessageBoxIcon.Error'));
90 89
 
91 90
             return null;
92 91
         }
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,12 +49,14 @@  discard block
 block discarded – undo
49 49
 
50 50
         $comments = "\t/**\n\t * @method $method\n\n\t * @param WFObject \$self$comments\n\t */";
51 51
 
52
-        if (!isset (self::$events[$form]))
53
-            self::$events[$form] = "class $form extends Form\n{\n$comments\n\tpublic function $method (WFObject \$self, ". implode (', ', $args) .")\n\t{\n\t\t\n\t}\n}\n";
52
+        if (!isset (self::$events[$form])) {
53
+                    self::$events[$form] = "class $form extends Form\n{\n$comments\n\tpublic function $method (WFObject \$self, ". implode (', ', $args) .")\n\t{\n\t\t\n\t}\n}\n";
54
+        }
54 55
 
55 56
         // preg_match ('/function(\s)*'. $method .'(\s)*\(/i', self::$events[$form])
56
-        elseif (!in_array ($method, ClassWorker::getAvailableClassMethods (self::$events[$form], $form)))
57
-            self::$events[$form] = ClassWorker::applyClass (self::$events[$form], $form, "\n$comments\n\tpublic function $method (WFObject \$self, ". implode (', ', $args) .")\n\t{\n\t\t\n\t}\n");
57
+        elseif (!in_array ($method, ClassWorker::getAvailableClassMethods (self::$events[$form], $form))) {
58
+                    self::$events[$form] = ClassWorker::applyClass (self::$events[$form], $form, "\n$comments\n\tpublic function $method (WFObject \$self, ". implode (', ', $args) .")\n\t{\n\t\t\n\t}\n");
59
+        }
58 60
 
59 61
         $editor->text = self::$events[$form];
60 62
         $editor->helpStorage = $form;
@@ -82,9 +84,7 @@  discard block
 block discarded – undo
82 84
             VoidStudioBuilder::compileProject (VoidStudioProjectManager::$projectPath .'/build.exe', $formsList->items[0]->text, VoidStudioBuilder::getReferences (ENGINE_DIR .'/VoidEngine.php'), [], false, $debug);
83 85
 
84 86
             self::$project = run (VoidStudioProjectManager::$projectPath .'/build/build.exe');
85
-        }
86
-
87
-        catch (\Throwable $e)
87
+        } catch (\Throwable $e)
88 88
         {
89 89
             messageBox ('Нельзя сохранить проект или произошла ошибка компиляции' ."\n\nПодробнее:\n\n". print_r ($e, true), 'Ошибка запуска проекта', enum ('System.Windows.Forms.MessageBoxButtons.OK'), enum ('System.Windows.Forms.MessageBoxIcon.Error'));
90 90
 
Please login to merge, or discard this patch.