Passed
Push — master ( e3e478...ac5450 )
by Observer
01:33
created
engine/components/system/ImageList.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class ImageList extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.ImageList';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+    protected ?string $assembly  = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class ImageList extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.ImageList';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+	protected ?string $assembly = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
engine/components/system/Timer.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class Timer extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.Timer';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+    protected ?string $assembly  = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 class Timer extends Control
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.Timer';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+	protected ?string $assembly = 'System.Windows.Forms';
9 9
 }
Please login to merge, or discard this patch.
engine/components/dialogs/CommonDialog.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 abstract class CommonDialog extends Component
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.CommonDialog';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+    protected ?string $assembly  = 'System.Windows.Forms';
9 9
 
10 10
     public function execute (): int
11 11
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 abstract class CommonDialog extends Component
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.CommonDialog';
8
-	protected ?string $assembly  = 'System.Windows.Forms';
8
+	protected ?string $assembly = 'System.Windows.Forms';
9 9
 
10
-    public function execute (): int
10
+    public function execute(): int
11 11
     {
12
-        return $this->callMethod ('ShowDialog');
12
+        return $this->callMethod('ShowDialog');
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
engine/components/dialogs/FolderBrowserDialog.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 {
7 7
     protected ?string $classname = 'System.Windows.Forms.FolderBrowserDialog';
8 8
 	
9
-    public function get_path ()
9
+    public function get_path()
10 10
     {
11
-        return $this->getProperty ('SelectedPath');
11
+        return $this->getProperty('SelectedPath');
12 12
     }
13 13
 }
Please login to merge, or discard this patch.
engine/components/dialogs/MessageBox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@
 block discarded – undo
7 7
     protected ?string $classname = 'System.Windows.Forms.MessageBox';
8 8
     protected ?string $assembly  = 'System.Windows.Forms';
9 9
     
10
-    public function __construct ()
10
+    public function __construct()
11 11
     {
12
-        parent::__construct ($this->classname, $this->assembly);
12
+        parent::__construct($this->classname, $this->assembly);
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
engine/components/system/Process.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@
 block discarded – undo
6 6
 
7 7
 class Process extends Component
8 8
 {
9
-	protected ?string $classname = 'System.Diagnostics.Process';
10
-	protected ?string $assembly  = 'System';
9
+    protected ?string $classname = 'System.Diagnostics.Process';
10
+    protected ?string $assembly  = 'System';
11 11
 
12
-	public function __construct (int $pid = null)
13
-	{
12
+    public function __construct (int $pid = null)
13
+    {
14 14
         $this->selector = VoidCore::getClass ($this->classname, $this->assembly);
15 15
 
16
-		if ($pid !== null)
16
+        if ($pid !== null)
17 17
             $this->selector = $pid == getmypid () ?
18 18
                 VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
19 19
                 VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
20 20
 
21
-		Components::add ($this);
22
-	}
21
+        Components::add ($this);
22
+    }
23 23
 	
24
-	public static function getProcessById (int $pid)
25
-	{
26
-		return new self ($pid);
27
-	}
24
+    public static function getProcessById (int $pid)
25
+    {
26
+        return new self ($pid);
27
+    }
28 28
 	
29
-	public static function getCurrentProcess ()
30
-	{
31
-		return new self (getmypid ());
32
-	}
29
+    public static function getCurrentProcess ()
30
+    {
31
+        return new self (getmypid ());
32
+    }
33 33
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,25 +9,24 @@
 block discarded – undo
9 9
 	protected ?string $classname = 'System.Diagnostics.Process';
10 10
 	protected ?string $assembly  = 'System';
11 11
 
12
-	public function __construct (int $pid = null)
12
+	public function __construct(int $pid = null)
13 13
 	{
14
-        $this->selector = VoidCore::getClass ($this->classname, $this->assembly);
14
+        $this->selector = VoidCore::getClass($this->classname, $this->assembly);
15 15
 
16 16
 		if ($pid !== null)
17
-            $this->selector = $pid == getmypid () ?
18
-                VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
19
-                VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
17
+            $this->selector = $pid == getmypid() ?
18
+                VoidCore::callMethod($this->selector, 'GetCurrentProcess') : VoidCore::callMethod($this->selector, 'GetProcessById', $pid);
20 19
 
21
-		Components::add ($this);
20
+		Components::add($this);
22 21
 	}
23 22
 	
24
-	public static function getProcessById (int $pid)
23
+	public static function getProcessById(int $pid)
25 24
 	{
26
-		return new self ($pid);
25
+		return new self($pid);
27 26
 	}
28 27
 	
29
-	public static function getCurrentProcess ()
28
+	public static function getCurrentProcess()
30 29
 	{
31
-		return new self (getmypid ());
30
+		return new self(getmypid());
32 31
 	}
33 32
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,10 +13,11 @@
 block discarded – undo
13 13
 	{
14 14
         $this->selector = VoidCore::getClass ($this->classname, $this->assembly);
15 15
 
16
-		if ($pid !== null)
17
-            $this->selector = $pid == getmypid () ?
16
+		if ($pid !== null) {
17
+		            $this->selector = $pid == getmypid () ?
18 18
                 VoidCore::callMethod ($this->selector, 'GetCurrentProcess') :
19 19
                 VoidCore::callMethod ($this->selector, 'GetProcessById', $pid);
20
+		}
20 21
 
21 22
 		Components::add ($this);
22 23
 	}
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/VST/Parser.php 2 patches
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -20,33 +20,33 @@  discard block
 block discarded – undo
20 20
      * 
21 21
      * @return AST - возвращает AST дерево разметки
22 22
      */
23
-    public static function parse (string $vst): AST
23
+    public static function parse(string $vst): AST
24 24
     {
25 25
         $tree    = new AST;
26 26
         $objects = new Stack;
27 27
 
28
-        if (file_exists ($vst))
29
-            $vst = file_get_contents ($vst);
28
+        if (file_exists($vst))
29
+            $vst = file_get_contents($vst);
30 30
 
31
-        $lines   = explode (self::$divider, $vst);
31
+        $lines   = explode(self::$divider, $vst);
32 32
         $skip_at = -1;
33 33
 
34 34
         foreach ($lines as $line_num => $line)
35 35
         {
36 36
             // \VoidEngine\pre ($line_num .', '. ($skip_at > $line_num ? 'skip' : 'not skip') .': '. $line);
37 37
 
38
-            if ($skip_at > $line_num || !self::filter ($line))
38
+            if ($skip_at > $line_num || !self::filter($line))
39 39
                 continue;
40 40
 
41
-            $height = self::getHeight ($line);
42
-            $words  = array_filter (explode (' ', $line), 'VLF\Parser::filter');
41
+            $height = self::getHeight($line);
42
+            $words  = array_filter(explode(' ', $line), 'VLF\Parser::filter');
43 43
             $poped  = false;
44 44
 
45 45
             # Очищаем стек объектов
46
-            while ($objects->size () > 0)
47
-                if ($objects->current ()->height >= $height)
46
+            while ($objects->size() > 0)
47
+                if ($objects->current()->height >= $height)
48 48
                 {
49
-                    $objects->pop ();
49
+                    $objects->pop();
50 50
                     
51 51
                     $poped = true;
52 52
                 }
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
                 else break;
55 55
 
56 56
             # Создаём новую ссылку на объект
57
-            if ($poped && $objects->size () > 0)
57
+            if ($poped && $objects->size() > 0)
58 58
             {
59
-                $object = $objects->pop ();
59
+                $object = $objects->pop();
60 60
 
61
-                $objects->push (new Node (array_merge ($object->export (), ['nodes' => []])));
62
-                $tree->push ($objects->current ());
61
+                $objects->push(new Node(array_merge($object->export(), ['nodes' => []])));
62
+                $tree->push($objects->current());
63 63
             }
64 64
 
65 65
             /**
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
                 if (isset ($words[0][1]))
74 74
                 {
75 75
                     if ($words[0][1] == '^')
76
-                        $skip_at = self::parseSubtext ($lines, $line_num, $height)[1];
76
+                        $skip_at = self::parseSubtext($lines, $line_num, $height)[1];
77 77
 
78
-                    else throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1));
78
+                    else throw new \Exception('Unknown char founded after comment definition at line '.($line_num + 1));
79 79
                 }
80 80
 
81 81
                 continue;
@@ -86,30 +86,30 @@  discard block
 block discarded – undo
86 86
              */
87 87
             elseif ($words[0][0] == '.')
88 88
             {
89
-                $pos     = strpos ($line, ':');
89
+                $pos     = strpos($line, ':');
90 90
                 $parents = null;
91 91
 
92 92
                 if ($pos !== false)
93 93
                 {
94
-                    $name = trim (substr ($line, 1, $pos - 1));
94
+                    $name = trim(substr($line, 1, $pos - 1));
95 95
 
96 96
                     if (isset ($line[$pos]))
97 97
                     {
98
-                        $parents = trim (substr ($line, $pos + 1));
98
+                        $parents = trim(substr($line, $pos + 1));
99 99
 
100
-                        if (strlen ($parents) == 0)
100
+                        if (strlen($parents) == 0)
101 101
                             $parents = null;
102 102
 
103
-                        else $parents = array_map ('trim', explode (',', $parents));
103
+                        else $parents = array_map('trim', explode(',', $parents));
104 104
                     }
105 105
                 }
106 106
 
107
-                else $name = trim (substr ($line, 1));
107
+                else $name = trim(substr($line, 1));
108 108
 
109
-                if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height)
110
-                    $parents = [$objects->current ()->args['name']];
109
+                if ($parents === null && $objects->size() > 0 && $objects->current()->height < $height)
110
+                    $parents = [$objects->current()->args['name']];
111 111
 
112
-                $objects->push (new Node ([
112
+                $objects->push(new Node([
113 113
                     'type'   => \VLF\STYLE_DEFINITION,
114 114
                     'line'   => $line,
115 115
                     'words'  => $words,
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                     ]
123 123
                 ]));
124 124
 
125
-                $tree->push ($objects->current ());
125
+                $tree->push($objects->current());
126 126
             }
127 127
 
128 128
             /**
@@ -130,30 +130,30 @@  discard block
 block discarded – undo
130 130
              */
131 131
             elseif ($words[0][0] == '*')
132 132
             {
133
-                $pos     = strpos ($line, ':');
133
+                $pos     = strpos($line, ':');
134 134
                 $parents = null;
135 135
 
136 136
                 if ($pos !== false)
137 137
                 {
138
-                    $name = trim (substr ($line, 1, $pos - 1));
138
+                    $name = trim(substr($line, 1, $pos - 1));
139 139
 
140 140
                     if (isset ($line[$pos]))
141 141
                     {
142
-                        $parents = trim (substr ($line, $pos + 1));
142
+                        $parents = trim(substr($line, $pos + 1));
143 143
 
144
-                        if (strlen ($parents) == 0)
144
+                        if (strlen($parents) == 0)
145 145
                             $parents = null;
146 146
 
147
-                        else $parents = array_map ('trim', explode (',', $parents));
147
+                        else $parents = array_map('trim', explode(',', $parents));
148 148
                     }
149 149
                 }
150 150
 
151
-                else $name = trim (substr ($line, 1));
151
+                else $name = trim(substr($line, 1));
152 152
 
153
-                if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height)
154
-                    $parents = [$objects->current ()->args['name']];
153
+                if ($parents === null && $objects->size() > 0 && $objects->current()->height < $height)
154
+                    $parents = [$objects->current()->args['name']];
155 155
 
156
-                $objects->push (new Node ([
156
+                $objects->push(new Node([
157 157
                     'type'   => \VLF\STYLE_DEFINITION,
158 158
                     'line'   => $line,
159 159
                     'words'  => $words,
@@ -166,35 +166,35 @@  discard block
 block discarded – undo
166 166
                     ]
167 167
                 ]));
168 168
 
169
-                $tree->push ($objects->current ());
169
+                $tree->push($objects->current());
170 170
             }
171 171
 
172 172
             /**
173 173
              * Установка свойства
174 174
              */
175
-            elseif (($pos = strpos ($line, ':')) !== false)
175
+            elseif (($pos = strpos($line, ':')) !== false)
176 176
             {
177
-                if ($objects->size () == 0)
178
-                    throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1));
177
+                if ($objects->size() == 0)
178
+                    throw new \Exception('Trying to set property to unknown object at line '.($line_num + 1));
179 179
 
180 180
                 if (!isset ($words[1]))
181
-                    throw new \Exception ('Trying to set void property value at line '. ($line_num + 1));
181
+                    throw new \Exception('Trying to set void property value at line '.($line_num + 1));
182 182
 
183
-                $propertyName  = substr ($line, 0, $pos);
184
-                $propertyValue = substr ($line, $pos + 1);
183
+                $propertyName  = substr($line, 0, $pos);
184
+                $propertyValue = substr($line, $pos + 1);
185 185
 
186 186
                 /**
187 187
                  * Обработка многострочных свойств
188 188
                  */
189 189
                 if ($line[$pos + 1] == '^')
190 190
                 {
191
-                    $parsed = self::parseSubtext ($lines, $line_num, $height);
191
+                    $parsed = self::parseSubtext($lines, $line_num, $height);
192 192
 
193
-                    $propertyValue = substr ($propertyValue, 1) . $parsed[0];
193
+                    $propertyValue = substr($propertyValue, 1).$parsed[0];
194 194
                     $skip_at       = $parsed[1];
195 195
                 }
196 196
 
197
-                $objects->current ()->push (new Node ([
197
+                $objects->current()->push(new Node([
198 198
                     'type'   => \VLF\PROPERTY_SET,
199 199
                     'line'   => $line,
200 200
                     'words'  => $words,
@@ -212,26 +212,26 @@  discard block
 block discarded – undo
212 212
              */
213 213
             elseif (isset ($words[0][1]) && $words[0][0] == '-' && $words[0][1] == '>')
214 214
             {
215
-                if ($objects->size () == 0)
216
-                    throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1));
215
+                if ($objects->size() == 0)
216
+                    throw new \Exception('Trying to call method from unknown object at line '.($line_num + 1));
217 217
 
218 218
                 $methodArgs = [];
219 219
 
220
-                if (($pos = strpos ($line, '(')) !== false)
220
+                if (($pos = strpos($line, '(')) !== false)
221 221
                 {
222
-                    if (($end = strrpos ($line, ')', $pos)) === false)
223
-                        throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1));
222
+                    if (($end = strrpos($line, ')', $pos)) === false)
223
+                        throw new \Exception('Incorrect method arguments syntax at line '.($line_num + 1));
224 224
 
225
-                    $methodArgs = substr ($line, $pos + 1, $end - $pos - 1);
225
+                    $methodArgs = substr($line, $pos + 1, $end - $pos - 1);
226 226
 
227
-                    $methodName = trim (substr ($line, 2, $pos - 2));
228
-                    $methodArgs = self::filter ($methodArgs) ?
229
-                        self::parseArguments ($methodArgs) : [];
227
+                    $methodName = trim(substr($line, 2, $pos - 2));
228
+                    $methodArgs = self::filter($methodArgs) ?
229
+                        self::parseArguments($methodArgs) : [];
230 230
                 }
231 231
 
232
-                else $methodName = trim (substr ($line, 2));
232
+                else $methodName = trim(substr($line, 2));
233 233
 
234
-                $objects->current ()->push (new Node ([
234
+                $objects->current()->push(new Node([
235 235
                     'type'   => \VLF\METHOD_CALL,
236 236
                     'line'   => $line,
237 237
                     'words'  => $words,
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             /**
248 248
              * Неопознанная структура
249 249
              */
250
-            else throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1));
250
+            else throw new \Exception('Unsupported structure founded at line '.($line_num + 1));
251 251
         }
252 252
 
253 253
         return $tree;
Please login to merge, or discard this patch.
Braces   +53 added lines, -39 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
         $tree    = new AST;
26 26
         $objects = new Stack;
27 27
 
28
-        if (file_exists ($vst))
29
-            $vst = file_get_contents ($vst);
28
+        if (file_exists ($vst)) {
29
+                    $vst = file_get_contents ($vst);
30
+        }
30 31
 
31 32
         $lines   = explode (self::$divider, $vst);
32 33
         $skip_at = -1;
@@ -35,24 +36,26 @@  discard block
 block discarded – undo
35 36
         {
36 37
             // \VoidEngine\pre ($line_num .', '. ($skip_at > $line_num ? 'skip' : 'not skip') .': '. $line);
37 38
 
38
-            if ($skip_at > $line_num || !self::filter ($line))
39
-                continue;
39
+            if ($skip_at > $line_num || !self::filter ($line)) {
40
+                            continue;
41
+            }
40 42
 
41 43
             $height = self::getHeight ($line);
42 44
             $words  = array_filter (explode (' ', $line), 'VLF\Parser::filter');
43 45
             $poped  = false;
44 46
 
45 47
             # Очищаем стек объектов
46
-            while ($objects->size () > 0)
47
-                if ($objects->current ()->height >= $height)
48
+            while ($objects->size () > 0) {
49
+                            if ($objects->current ()->height >= $height)
48 50
                 {
49 51
                     $objects->pop ();
52
+            }
50 53
                     
51 54
                     $poped = true;
55
+                } else {
56
+                    break;
52 57
                 }
53 58
 
54
-                else break;
55
-
56 59
             # Создаём новую ссылку на объект
57 60
             if ($poped && $objects->size () > 0)
58 61
             {
@@ -72,10 +75,11 @@  discard block
 block discarded – undo
72 75
                  */
73 76
                 if (isset ($words[0][1]))
74 77
                 {
75
-                    if ($words[0][1] == '^')
76
-                        $skip_at = self::parseSubtext ($lines, $line_num, $height)[1];
77
-
78
-                    else throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1));
78
+                    if ($words[0][1] == '^') {
79
+                                            $skip_at = self::parseSubtext ($lines, $line_num, $height)[1];
80
+                    } else {
81
+                        throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1));
82
+                    }
79 83
                 }
80 84
 
81 85
                 continue;
@@ -97,17 +101,19 @@  discard block
 block discarded – undo
97 101
                     {
98 102
                         $parents = trim (substr ($line, $pos + 1));
99 103
 
100
-                        if (strlen ($parents) == 0)
101
-                            $parents = null;
102
-
103
-                        else $parents = array_map ('trim', explode (',', $parents));
104
+                        if (strlen ($parents) == 0) {
105
+                                                    $parents = null;
106
+                        } else {
107
+                            $parents = array_map ('trim', explode (',', $parents));
108
+                        }
104 109
                     }
110
+                } else {
111
+                    $name = trim (substr ($line, 1));
105 112
                 }
106 113
 
107
-                else $name = trim (substr ($line, 1));
108
-
109
-                if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height)
110
-                    $parents = [$objects->current ()->args['name']];
114
+                if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) {
115
+                                    $parents = [$objects->current ()->args['name']];
116
+                }
111 117
 
112 118
                 $objects->push (new Node ([
113 119
                     'type'   => \VLF\STYLE_DEFINITION,
@@ -141,17 +147,19 @@  discard block
 block discarded – undo
141 147
                     {
142 148
                         $parents = trim (substr ($line, $pos + 1));
143 149
 
144
-                        if (strlen ($parents) == 0)
145
-                            $parents = null;
146
-
147
-                        else $parents = array_map ('trim', explode (',', $parents));
150
+                        if (strlen ($parents) == 0) {
151
+                                                    $parents = null;
152
+                        } else {
153
+                            $parents = array_map ('trim', explode (',', $parents));
154
+                        }
148 155
                     }
156
+                } else {
157
+                    $name = trim (substr ($line, 1));
149 158
                 }
150 159
 
151
-                else $name = trim (substr ($line, 1));
152
-
153
-                if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height)
154
-                    $parents = [$objects->current ()->args['name']];
160
+                if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) {
161
+                                    $parents = [$objects->current ()->args['name']];
162
+                }
155 163
 
156 164
                 $objects->push (new Node ([
157 165
                     'type'   => \VLF\STYLE_DEFINITION,
@@ -174,11 +182,13 @@  discard block
 block discarded – undo
174 182
              */
175 183
             elseif (($pos = strpos ($line, ':')) !== false)
176 184
             {
177
-                if ($objects->size () == 0)
178
-                    throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1));
185
+                if ($objects->size () == 0) {
186
+                                    throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1));
187
+                }
179 188
 
180
-                if (!isset ($words[1]))
181
-                    throw new \Exception ('Trying to set void property value at line '. ($line_num + 1));
189
+                if (!isset ($words[1])) {
190
+                                    throw new \Exception ('Trying to set void property value at line '. ($line_num + 1));
191
+                }
182 192
 
183 193
                 $propertyName  = substr ($line, 0, $pos);
184 194
                 $propertyValue = substr ($line, $pos + 1);
@@ -212,25 +222,27 @@  discard block
 block discarded – undo
212 222
              */
213 223
             elseif (isset ($words[0][1]) && $words[0][0] == '-' && $words[0][1] == '>')
214 224
             {
215
-                if ($objects->size () == 0)
216
-                    throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1));
225
+                if ($objects->size () == 0) {
226
+                                    throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1));
227
+                }
217 228
 
218 229
                 $methodArgs = [];
219 230
 
220 231
                 if (($pos = strpos ($line, '(')) !== false)
221 232
                 {
222
-                    if (($end = strrpos ($line, ')', $pos)) === false)
223
-                        throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1));
233
+                    if (($end = strrpos ($line, ')', $pos)) === false) {
234
+                                            throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1));
235
+                    }
224 236
 
225 237
                     $methodArgs = substr ($line, $pos + 1, $end - $pos - 1);
226 238
 
227 239
                     $methodName = trim (substr ($line, 2, $pos - 2));
228 240
                     $methodArgs = self::filter ($methodArgs) ?
229 241
                         self::parseArguments ($methodArgs) : [];
242
+                } else {
243
+                    $methodName = trim (substr ($line, 2));
230 244
                 }
231 245
 
232
-                else $methodName = trim (substr ($line, 2));
233
-
234 246
                 $objects->current ()->push (new Node ([
235 247
                     'type'   => \VLF\METHOD_CALL,
236 248
                     'line'   => $line,
@@ -247,7 +259,9 @@  discard block
 block discarded – undo
247 259
             /**
248 260
              * Неопознанная структура
249 261
              */
250
-            else throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1));
262
+            else {
263
+                throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1));
264
+            }
251 265
         }
252 266
 
253 267
         return $tree;
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/VST/Interpreter.php 3 patches
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,22 +36,24 @@
 block discarded – undo
36 36
                 $name  = $node->args['name'];
37 37
                 $nodes = $node->getNodes ();
38 38
 
39
-                if ($node->args['parents'] !== null)
40
-                    foreach ($node->args['parents'] as $parent)
39
+                if ($node->args['parents'] !== null) {
40
+                                    foreach ($node->args['parents'] as $parent)
41 41
                         if (!isset (self::$styles[$parent]) && !isset (self::$default_styles[$parent]))
42 42
                         {
43 43
                             if (self::$throw_errors)
44 44
                                 throw new \Exception ('Style "'. $parent .'" not founded');
45
+                }
46
+                        } else {
47
+                            $nodes = array_merge (self::$styles[$parent] ?? self::$default_styles[$parent], $nodes);
45 48
                         }
46 49
 
47
-                        else $nodes = array_merge (self::$styles[$parent] ?? self::$default_styles[$parent], $nodes);
48
-
49
-                if ($node->args['is_default'])
50
-                    self::$default_styles[$name] = isset (self::$objects[$name]) ?
50
+                if ($node->args['is_default']) {
51
+                                    self::$default_styles[$name] = isset (self::$objects[$name]) ?
51 52
                         array_merge (self::$default_styles[$name], $nodes) : $nodes;
52
-
53
-                else self::$styles[$name] = isset (self::$objects[$name]) ?
53
+                } else {
54
+                    self::$styles[$name] = isset (self::$objects[$name]) ?
54 55
                     array_merge (self::$styles[$name], $nodes) : $nodes;
56
+                }
55 57
             }
56 58
 
57 59
             list (self::$styles, self::$default_styles) = self::run (new AST (array_map (
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@
 block discarded – undo
61 61
         return [self::$styles, self::$default_styles];
62 62
     }
63 63
 	
64
-	public static function clear (): void
65
-	{
66
-		self::$styles = [];
67
-		self::$default_styles = [];
68
-	}
64
+    public static function clear (): void
65
+    {
66
+        self::$styles = [];
67
+        self::$default_styles = [];
68
+    }
69 69
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,24 +27,24 @@  discard block
 block discarded – undo
27 27
      * 
28 28
      * @return array - возвращает список созданных стилей
29 29
      */
30
-    public static function run (AST $tree, Node $parent = null): array
30
+    public static function run(AST $tree, Node $parent = null): array
31 31
     {
32
-        foreach ($tree->getNodes () as $id => $node)
32
+        foreach ($tree->getNodes() as $id => $node)
33 33
         {
34 34
             if ($node->type == \VLF\STYLE_DEFINITION)
35 35
             {
36 36
                 $name  = $node->args['name'];
37
-                $nodes = $node->getNodes ();
37
+                $nodes = $node->getNodes();
38 38
 
39 39
                 if ($node->args['parents'] !== null)
40 40
                     foreach ($node->args['parents'] as $parent)
41 41
                         if (!isset (self::$styles[$parent]) && !isset (self::$default_styles[$parent]))
42 42
                         {
43 43
                             if (self::$throw_errors)
44
-                                throw new \Exception ('Style "'. $parent .'" not founded');
44
+                                throw new \Exception('Style "'.$parent.'" not founded');
45 45
                         }
46 46
 
47
-                        else $nodes = array_merge (self::$styles[$parent] ?? self::$default_styles[$parent], $nodes);
47
+                        else $nodes = array_merge(self::$styles[$parent] ?? self::$default_styles[$parent], $nodes);
48 48
 
49 49
                 if ($node->args['is_default'])
50 50
                     self::$default_styles[$name] = isset (self::$objects[$name]) ?
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
                     array_merge (self::$styles[$name], $nodes) : $nodes;
55 55
             }
56 56
 
57
-            list (self::$styles, self::$default_styles) = self::run (new AST (array_map (
58
-                fn ($node) => $node->export (), $node->getNodes ())), $node);
57
+            list (self::$styles, self::$default_styles) = self::run(new AST(array_map(
58
+                fn($node) => $node->export(), $node->getNodes())), $node);
59 59
         }
60 60
 
61 61
         return [self::$styles, self::$default_styles];
62 62
     }
63 63
 	
64
-	public static function clear (): void
64
+	public static function clear(): void
65 65
 	{
66 66
 		self::$styles = [];
67 67
 		self::$default_styles = [];
Please login to merge, or discard this patch.
engine/extensions/VLF/bin/parser.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
      * 
18 18
      * @return AST - возвращает AST дерево разметки
19 19
      */
20
-    public static function parse (string $vlf): AST
20
+    public static function parse(string $vlf): AST
21 21
     {
22 22
         $tree    = new AST;
23 23
         $objects = new Stack;
24 24
 
25
-        if (file_exists ($vlf))
26
-            $vlf = file_get_contents ($vlf);
25
+        if (file_exists($vlf))
26
+            $vlf = file_get_contents($vlf);
27 27
 
28
-        $lines   = explode (self::$divider, $vlf);
28
+        $lines   = explode(self::$divider, $vlf);
29 29
         $skip_at = -1;
30 30
 
31 31
         foreach ($lines as $line_num => $line)
32 32
         {
33 33
             // \VoidEngine\pre ($line_num .', '. ($skip_at > $line_num ? 'skip' : 'not skip') .': '. $line);
34 34
 
35
-            if ($skip_at > $line_num || !self::filter ($line))
35
+            if ($skip_at > $line_num || !self::filter($line))
36 36
                 continue;
37 37
 
38
-            $height = self::getHeight ($line);
39
-            $words  = array_filter (explode (' ', $line), 'VLF\Parser::filter');
38
+            $height = self::getHeight($line);
39
+            $words  = array_filter(explode(' ', $line), 'VLF\Parser::filter');
40 40
             $poped  = false;
41 41
 
42 42
             # Очищаем стек объектов
43
-            while ($objects->size () > 0)
44
-                if ($objects->current ()->height >= $height)
43
+            while ($objects->size() > 0)
44
+                if ($objects->current()->height >= $height)
45 45
                 {
46
-                    $objects->pop ();
46
+                    $objects->pop();
47 47
                     
48 48
                     $poped = true;
49 49
                 }
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
                 else break;
52 52
 
53 53
             # Создаём новую ссылку на объект
54
-            if ($poped && $objects->size () > 0)
54
+            if ($poped && $objects->size() > 0)
55 55
             {
56
-                $object = $objects->pop ();
56
+                $object = $objects->pop();
57 57
 
58
-                $objects->push (new Node (array_merge ($object->export (), ['nodes' => []])));
59
-                $tree->push ($objects->current ());
58
+                $objects->push(new Node(array_merge($object->export(), ['nodes' => []])));
59
+                $tree->push($objects->current());
60 60
             }
61 61
 
62 62
             /**
@@ -64,16 +64,16 @@  discard block
 block discarded – undo
64 64
              */
65 65
             if ($words[0] == 'import')
66 66
             {
67
-                $imports = substr ($line, strlen ($words[0]));
68
-                $parsed  = self::parseSubtext ($lines, $line_num, $height);
67
+                $imports = substr($line, strlen($words[0]));
68
+                $parsed  = self::parseSubtext($lines, $line_num, $height);
69 69
 
70 70
                 $imports .= $parsed[0];
71 71
                 $skip_at  = $parsed[1];
72 72
 
73
-                $imports = self::filter ($imports) ?
74
-                    array_map ('trim', self::parseArguments ($imports)) : [];
73
+                $imports = self::filter($imports) ?
74
+                    array_map ('trim', self::parseArguments($imports)) : [];
75 75
 
76
-                $tree->push (new Node ([
76
+                $tree->push(new Node([
77 77
                     'type'   => STYLES_IMPORTING,
78 78
                     'line'   => $line,
79 79
                     'words'  => $words,
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
                 if (isset ($words[0][1]))
97 97
                 {
98 98
                     if ($words[0][1] == '^')
99
-                        $skip_at = self::parseSubtext ($lines, $line_num, $height)[1];
99
+                        $skip_at = self::parseSubtext($lines, $line_num, $height)[1];
100 100
 
101
-                    else throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1));
101
+                    else throw new \Exception('Unknown char founded after comment definition at line '.($line_num + 1));
102 102
                 }
103 103
 
104 104
                 continue;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
              */
110 110
             elseif ($words[0][0] == '%')
111 111
             {
112
-                $code = substr ($line, strlen ($words[0]));
112
+                $code = substr($line, strlen($words[0]));
113 113
 
114 114
                 /**
115 115
                  * Обработка многострочного кода
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
                 {
119 119
                     if ($words[0][1] == '^')
120 120
                     {
121
-                        $parsed = self::parseSubtext ($lines, $line_num, $height);
121
+                        $parsed = self::parseSubtext($lines, $line_num, $height);
122 122
 
123 123
                         $code   .= $parsed[0];
124 124
                         $skip_at = $parsed[1];
125 125
                     }
126 126
 
127
-                    else throw new \Exception ('Unknown char founded after runtime execution definition at line '. ($line_num + 1));
127
+                    else throw new \Exception('Unknown char founded after runtime execution definition at line '.($line_num + 1));
128 128
                 }
129 129
 
130
-                $tree->push (new Node ([
130
+                $tree->push(new Node([
131 131
                     'type'   => RUNTIME_EXECUTION,
132 132
                     'line'   => $line,
133 133
                     'words'  => $words,
@@ -142,29 +142,29 @@  discard block
 block discarded – undo
142 142
             /**
143 143
              * Установка свойства
144 144
              */
145
-            elseif (($pos = strpos ($line, ':')) !== false)
145
+            elseif (($pos = strpos($line, ':')) !== false)
146 146
             {
147
-                if ($objects->size () == 0)
148
-                    throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1));
147
+                if ($objects->size() == 0)
148
+                    throw new \Exception('Trying to set property to unknown object at line '.($line_num + 1));
149 149
 
150 150
                 if (!isset ($words[1]))
151
-                    throw new \Exception ('Trying to set void property value at line '. ($line_num + 1));
151
+                    throw new \Exception('Trying to set void property value at line '.($line_num + 1));
152 152
 
153
-                $propertyName  = substr ($line, 0, $pos);
154
-                $propertyValue = substr ($line, $pos + 1);
153
+                $propertyName  = substr($line, 0, $pos);
154
+                $propertyValue = substr($line, $pos + 1);
155 155
 
156 156
                 /**
157 157
                  * Обработка многострочных свойств
158 158
                  */
159 159
                 if ($line[$pos + 1] == '^')
160 160
                 {
161
-                    $parsed = self::parseSubtext ($lines, $line_num, $height);
161
+                    $parsed = self::parseSubtext($lines, $line_num, $height);
162 162
 
163
-                    $propertyValue = substr ($propertyValue, 1) . $parsed[0];
163
+                    $propertyValue = substr($propertyValue, 1).$parsed[0];
164 164
                     $skip_at       = $parsed[1];
165 165
                 }
166 166
 
167
-                $objects->current ()->push (new Node ([
167
+                $objects->current()->push(new Node([
168 168
                     'type'   => PROPERTY_SET,
169 169
                     'line'   => $line,
170 170
                     'words'  => $words,
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
              */
183 183
             elseif (isset ($words[0][1]) && $words[0][0] == '-' && $words[0][1] == '>')
184 184
             {
185
-                if ($objects->size () == 0)
186
-                    throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1));
185
+                if ($objects->size() == 0)
186
+                    throw new \Exception('Trying to call method from unknown object at line '.($line_num + 1));
187 187
 
188 188
                 $methodArgs = [];
189 189
 
190
-                if (($pos = strpos ($line, '(')) !== false)
190
+                if (($pos = strpos($line, '(')) !== false)
191 191
                 {
192
-                    if (($end = strrpos ($line, ')', $pos)) === false)
193
-                        throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1));
192
+                    if (($end = strrpos($line, ')', $pos)) === false)
193
+                        throw new \Exception('Incorrect method arguments syntax at line '.($line_num + 1));
194 194
 
195
-                    $methodArgs = substr ($line, $pos + 1, $end - $pos - 1);
195
+                    $methodArgs = substr($line, $pos + 1, $end - $pos - 1);
196 196
 
197
-                    $methodName = trim (substr ($line, 2, $pos - 2));
198
-                    $methodArgs = self::filter ($methodArgs) ?
199
-                        self::parseArguments ($methodArgs) : [];
197
+                    $methodName = trim(substr($line, 2, $pos - 2));
198
+                    $methodArgs = self::filter($methodArgs) ?
199
+                        self::parseArguments($methodArgs) : [];
200 200
                 }
201 201
 
202
-                else $methodName = trim (substr ($line, 2));
202
+                else $methodName = trim(substr($line, 2));
203 203
 
204
-                $objects->current ()->push (new Node ([
204
+                $objects->current()->push(new Node([
205 205
                     'type'   => METHOD_CALL,
206 206
                     'line'   => $line,
207 207
                     'words'  => $words,
@@ -217,39 +217,39 @@  discard block
 block discarded – undo
217 217
             /**
218 218
              * Объявление объекта
219 219
              */
220
-            elseif (sizeof ($words) > 1)
220
+            elseif (sizeof($words) > 1)
221 221
             {
222 222
                 $class  = $words[0];
223 223
                 $name   = $words[1];
224 224
                 $args   = [];
225 225
                 $styles = [];
226 226
 
227
-                if ($objects->size () > 0 && $objects->current ()->height < $height)
228
-                    $args[] = $objects->current ()->args['name'];
227
+                if ($objects->size() > 0 && $objects->current()->height < $height)
228
+                    $args[] = $objects->current()->args['name'];
229 229
 
230
-                if (($pos = strpos ($line, '(')) !== false)
230
+                if (($pos = strpos($line, '(')) !== false)
231 231
                 {
232
-                    if (($end = strrpos ($line, ')', $pos)) === false)
233
-                        throw new \Exception ('Incorrect class constructor arguments syntax at line '. ($line_num + 1));
232
+                    if (($end = strrpos($line, ')', $pos)) === false)
233
+                        throw new \Exception('Incorrect class constructor arguments syntax at line '.($line_num + 1));
234 234
 
235
-                    $args = substr ($line, $pos + 1, $end - $pos - 1);
235
+                    $args = substr($line, $pos + 1, $end - $pos - 1);
236 236
 
237
-                    $name = substr ($line, $len = strlen ($class), $pos - $len);
238
-                    $args = self::filter ($args) ?
239
-                        self::parseArguments ($args) : [];
237
+                    $name = substr($line, $len = strlen($class), $pos - $len);
238
+                    $args = self::filter($args) ?
239
+                        self::parseArguments($args) : [];
240 240
                 }
241 241
 
242
-                if (($end = strrpos ($line, ' > ')) !== false)
242
+                if (($end = strrpos($line, ' > ')) !== false)
243 243
                 {
244
-                    $styles = trim (substr ($line, $end + 3));
244
+                    $styles = trim(substr($line, $end + 3));
245 245
 
246
-                    if (strlen ($styles) == 0)
247
-                        throw new \Exception ('Trying to set empty style to object');
246
+                    if (strlen($styles) == 0)
247
+                        throw new \Exception('Trying to set empty style to object');
248 248
 
249
-                    $styles = array_map ('trim', explode (',', $styles));
249
+                    $styles = array_map('trim', explode(',', $styles));
250 250
                 }
251 251
 
252
-                $objects->push (new Node ([
252
+                $objects->push(new Node([
253 253
                     'type'   => OBJECT_DEFINITION,
254 254
                     'line'   => $line,
255 255
                     'words'  => $words,
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
 
258 258
                     'args' => [
259 259
                         'class'  => $class,
260
-                        'name'   => trim ($name),
260
+                        'name'   => trim($name),
261 261
                         'args'   => $args,
262 262
                         'styles' => $styles
263 263
                     ]
264 264
                 ]));
265 265
 
266
-                $tree->push ($objects->current ());
266
+                $tree->push($objects->current());
267 267
             }
268 268
 
269 269
             /**
270 270
              * Неопознанная структура
271 271
              */
272
-            else throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1));
272
+            else throw new \Exception('Unsupported structure founded at line '.($line_num + 1));
273 273
         }
274 274
 
275 275
         return $tree;
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
      * 
283 283
      * @return int - возвращает её высоту
284 284
      */
285
-    protected static function getHeight (string &$line): int
285
+    protected static function getHeight(string &$line): int
286 286
     {
287 287
         $i = 0;
288 288
         $height = 0;
289 289
 
290
-        while (isset ($line[$i]) && ctype_space ($line[$i]))
290
+        while (isset ($line[$i]) && ctype_space($line[$i]))
291 291
         {
292 292
             ++$height;
293 293
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             ++$i;
298 298
         }
299 299
 
300
-        $line = substr ($line, $i);
300
+        $line = substr($line, $i);
301 301
 
302 302
         return $height;
303 303
     }
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
      * 
310 310
      * @return bool - возвращает true если строка не пустая
311 311
      */
312
-    protected static function filter (string $line): bool
312
+    protected static function filter(string $line): bool
313 313
     {
314
-        return strlen (trim ($line)) > 0;
314
+        return strlen(trim($line)) > 0;
315 315
     }
316 316
 
317 317
     /**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      * 
324 324
      * @return array - возвращает массив [текст, конечный индекс]
325 325
      */
326
-    protected static function parseSubtext (array $lines, $begin_id, int $down_height): array
326
+    protected static function parseSubtext(array $lines, $begin_id, int $down_height): array
327 327
     {
328 328
         $parsed = "\n";
329 329
 
@@ -332,17 +332,17 @@  discard block
 block discarded – undo
332 332
             if ($line_id <= $begin_id)
333 333
                 continue;
334 334
 
335
-            if (!self::filter ($line))
335
+            if (!self::filter($line))
336 336
             {
337 337
                 $parsed .= "\n";
338 338
             
339 339
                 continue;
340 340
             }
341 341
 
342
-            $height = self::getHeight ($line);
342
+            $height = self::getHeight($line);
343 343
 
344 344
             if ($height > $down_height)
345
-                $parsed .= str_repeat (' ', $height - $down_height) ."$line\n";
345
+                $parsed .= str_repeat(' ', $height - $down_height)."$line\n";
346 346
 
347 347
             else return [$parsed, $line_id];
348 348
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      * 
358 358
      * @return array - возвращает массив аргументов
359 359
      */
360
-    protected static function parseArguments (string $arguments): array
360
+    protected static function parseArguments(string $arguments): array
361 361
     {
362 362
         $args = [];
363 363
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
         $t = '';
368 368
 
369
-        for ($i = 0, $len = strlen ($arguments); $i < $len; ++$i)
369
+        for ($i = 0, $len = strlen($arguments); $i < $len; ++$i)
370 370
         {
371 371
             $t .= $arguments[$i];
372 372
             
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 
384 384
                 elseif (!$split1 && !$split2 && $arguments[$i] == ',')
385 385
                 {
386
-                    $args[] = substr ($t, 0, -1);
386
+                    $args[] = substr($t, 0, -1);
387 387
                     $t = '';
388 388
                 }
389 389
             }
Please login to merge, or discard this patch.
Braces   +63 added lines, -50 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
         $tree    = new AST;
23 23
         $objects = new Stack;
24 24
 
25
-        if (file_exists ($vlf))
26
-            $vlf = file_get_contents ($vlf);
25
+        if (file_exists ($vlf)) {
26
+                    $vlf = file_get_contents ($vlf);
27
+        }
27 28
 
28 29
         $lines   = explode (self::$divider, $vlf);
29 30
         $skip_at = -1;
@@ -32,24 +33,26 @@  discard block
 block discarded – undo
32 33
         {
33 34
             // \VoidEngine\pre ($line_num .', '. ($skip_at > $line_num ? 'skip' : 'not skip') .': '. $line);
34 35
 
35
-            if ($skip_at > $line_num || !self::filter ($line))
36
-                continue;
36
+            if ($skip_at > $line_num || !self::filter ($line)) {
37
+                            continue;
38
+            }
37 39
 
38 40
             $height = self::getHeight ($line);
39 41
             $words  = array_filter (explode (' ', $line), 'VLF\Parser::filter');
40 42
             $poped  = false;
41 43
 
42 44
             # Очищаем стек объектов
43
-            while ($objects->size () > 0)
44
-                if ($objects->current ()->height >= $height)
45
+            while ($objects->size () > 0) {
46
+                            if ($objects->current ()->height >= $height)
45 47
                 {
46 48
                     $objects->pop ();
49
+            }
47 50
                     
48 51
                     $poped = true;
52
+                } else {
53
+                    break;
49 54
                 }
50 55
 
51
-                else break;
52
-
53 56
             # Создаём новую ссылку на объект
54 57
             if ($poped && $objects->size () > 0)
55 58
             {
@@ -95,10 +98,11 @@  discard block
 block discarded – undo
95 98
                  */
96 99
                 if (isset ($words[0][1]))
97 100
                 {
98
-                    if ($words[0][1] == '^')
99
-                        $skip_at = self::parseSubtext ($lines, $line_num, $height)[1];
100
-
101
-                    else throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1));
101
+                    if ($words[0][1] == '^') {
102
+                                            $skip_at = self::parseSubtext ($lines, $line_num, $height)[1];
103
+                    } else {
104
+                        throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1));
105
+                    }
102 106
                 }
103 107
 
104 108
                 continue;
@@ -122,9 +126,9 @@  discard block
 block discarded – undo
122 126
 
123 127
                         $code   .= $parsed[0];
124 128
                         $skip_at = $parsed[1];
129
+                    } else {
130
+                        throw new \Exception ('Unknown char founded after runtime execution definition at line '. ($line_num + 1));
125 131
                     }
126
-
127
-                    else throw new \Exception ('Unknown char founded after runtime execution definition at line '. ($line_num + 1));
128 132
                 }
129 133
 
130 134
                 $tree->push (new Node ([
@@ -144,11 +148,13 @@  discard block
 block discarded – undo
144 148
              */
145 149
             elseif (($pos = strpos ($line, ':')) !== false)
146 150
             {
147
-                if ($objects->size () == 0)
148
-                    throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1));
151
+                if ($objects->size () == 0) {
152
+                                    throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1));
153
+                }
149 154
 
150
-                if (!isset ($words[1]))
151
-                    throw new \Exception ('Trying to set void property value at line '. ($line_num + 1));
155
+                if (!isset ($words[1])) {
156
+                                    throw new \Exception ('Trying to set void property value at line '. ($line_num + 1));
157
+                }
152 158
 
153 159
                 $propertyName  = substr ($line, 0, $pos);
154 160
                 $propertyValue = substr ($line, $pos + 1);
@@ -182,25 +188,27 @@  discard block
 block discarded – undo
182 188
              */
183 189
             elseif (isset ($words[0][1]) && $words[0][0] == '-' && $words[0][1] == '>')
184 190
             {
185
-                if ($objects->size () == 0)
186
-                    throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1));
191
+                if ($objects->size () == 0) {
192
+                                    throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1));
193
+                }
187 194
 
188 195
                 $methodArgs = [];
189 196
 
190 197
                 if (($pos = strpos ($line, '(')) !== false)
191 198
                 {
192
-                    if (($end = strrpos ($line, ')', $pos)) === false)
193
-                        throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1));
199
+                    if (($end = strrpos ($line, ')', $pos)) === false) {
200
+                                            throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1));
201
+                    }
194 202
 
195 203
                     $methodArgs = substr ($line, $pos + 1, $end - $pos - 1);
196 204
 
197 205
                     $methodName = trim (substr ($line, 2, $pos - 2));
198 206
                     $methodArgs = self::filter ($methodArgs) ?
199 207
                         self::parseArguments ($methodArgs) : [];
208
+                } else {
209
+                    $methodName = trim (substr ($line, 2));
200 210
                 }
201 211
 
202
-                else $methodName = trim (substr ($line, 2));
203
-
204 212
                 $objects->current ()->push (new Node ([
205 213
                     'type'   => METHOD_CALL,
206 214
                     'line'   => $line,
@@ -224,13 +232,15 @@  discard block
 block discarded – undo
224 232
                 $args   = [];
225 233
                 $styles = [];
226 234
 
227
-                if ($objects->size () > 0 && $objects->current ()->height < $height)
228
-                    $args[] = $objects->current ()->args['name'];
235
+                if ($objects->size () > 0 && $objects->current ()->height < $height) {
236
+                                    $args[] = $objects->current ()->args['name'];
237
+                }
229 238
 
230 239
                 if (($pos = strpos ($line, '(')) !== false)
231 240
                 {
232
-                    if (($end = strrpos ($line, ')', $pos)) === false)
233
-                        throw new \Exception ('Incorrect class constructor arguments syntax at line '. ($line_num + 1));
241
+                    if (($end = strrpos ($line, ')', $pos)) === false) {
242
+                                            throw new \Exception ('Incorrect class constructor arguments syntax at line '. ($line_num + 1));
243
+                    }
234 244
 
235 245
                     $args = substr ($line, $pos + 1, $end - $pos - 1);
236 246
 
@@ -243,8 +253,9 @@  discard block
 block discarded – undo
243 253
                 {
244 254
                     $styles = trim (substr ($line, $end + 3));
245 255
 
246
-                    if (strlen ($styles) == 0)
247
-                        throw new \Exception ('Trying to set empty style to object');
256
+                    if (strlen ($styles) == 0) {
257
+                                            throw new \Exception ('Trying to set empty style to object');
258
+                    }
248 259
 
249 260
                     $styles = array_map ('trim', explode (',', $styles));
250 261
                 }
@@ -269,7 +280,9 @@  discard block
 block discarded – undo
269 280
             /**
270 281
              * Неопознанная структура
271 282
              */
272
-            else throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1));
283
+            else {
284
+                throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1));
285
+            }
273 286
         }
274 287
 
275 288
         return $tree;
@@ -291,8 +304,9 @@  discard block
 block discarded – undo
291 304
         {
292 305
             ++$height;
293 306
 
294
-            if ($line[$i] == "\t")
295
-                $height += 3;
307
+            if ($line[$i] == "\t") {
308
+                            $height += 3;
309
+            }
296 310
 
297 311
             ++$i;
298 312
         }
@@ -329,8 +343,9 @@  discard block
 block discarded – undo
329 343
 
330 344
         foreach ($lines as $line_id => $line)
331 345
         {
332
-            if ($line_id <= $begin_id)
333
-                continue;
346
+            if ($line_id <= $begin_id) {
347
+                            continue;
348
+            }
334 349
 
335 350
             if (!self::filter ($line))
336 351
             {
@@ -341,10 +356,11 @@  discard block
 block discarded – undo
341 356
 
342 357
             $height = self::getHeight ($line);
343 358
 
344
-            if ($height > $down_height)
345
-                $parsed .= str_repeat (' ', $height - $down_height) ."$line\n";
346
-
347
-            else return [$parsed, $line_id];
359
+            if ($height > $down_height) {
360
+                            $parsed .= str_repeat (' ', $height - $down_height) ."$line\n";
361
+            } else {
362
+                return [$parsed, $line_id];
363
+            }
348 364
         }
349 365
 
350 366
         return [$parsed, $line_id + 1];
@@ -370,18 +386,15 @@  discard block
 block discarded – undo
370 386
         {
371 387
             $t .= $arguments[$i];
372 388
             
373
-            if ($arguments[$i] == '\\')
374
-                $canSplit = $i + 1;
375
-
376
-            elseif ($canSplit < $i)
389
+            if ($arguments[$i] == '\\') {
390
+                            $canSplit = $i + 1;
391
+            } elseif ($canSplit < $i)
377 392
             {
378
-                if ($arguments[$i] == '\'' && !$split2)
379
-                    $split1 = !$split1;
380
-
381
-                elseif ($arguments[$i] == '"' && !$split1)
382
-                    $split2 = !$split2;
383
-
384
-                elseif (!$split1 && !$split2 && $arguments[$i] == ',')
393
+                if ($arguments[$i] == '\'' && !$split2) {
394
+                                    $split1 = !$split1;
395
+                } elseif ($arguments[$i] == '"' && !$split1) {
396
+                                    $split2 = !$split2;
397
+                } elseif (!$split1 && !$split2 && $arguments[$i] == ',')
385 398
                 {
386 399
                     $args[] = substr ($t, 0, -1);
387 400
                     $t = '';
Please login to merge, or discard this patch.