Completed
Pull Request — master (#1)
by Fenz
07:21
created
libs/Parser/Document.php 1 patch
Braces   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
         $this->htsl = $htsl;
146 146
         $this->buffer = $buffer;
147 147
 
148
-        if ($parent) {
148
+        if ($parent){
149 149
             $this->parent = $parent;
150 150
             $this->docType = $parent->docType;
151 151
             $this->indentation = $parent->indentation;
152
-        } else {
152
+        } else{
153 153
             $this->parseFirstLine();
154 154
         }
155 155
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function execute():self
163 163
     {
164
-        if ($this->isExecuted) {
164
+        if ($this->isExecuted){
165 165
             return $this;
166 166
         }
167 167
 
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
      */
187 187
     protected function getContent():string
188 188
     {
189
-        if ($this->parent) {
189
+        if ($this->parent){
190 190
             return $this->execute()->parent->getContent();
191
-        } else {
191
+        } else{
192 192
             return $this->execute()->content;
193 193
         }
194 194
     }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     protected function getLine():Line
202 202
     {
203
-        do {
203
+        do{
204 204
             $line = $this->buffer->getLine();
205 205
         } while ($line->isEmpty() && $line->hasMore());
206 206
 
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $line = $this->getLine();
260 260
 
261
-        if ('@' === $line->getChar(0)) {
261
+        if ('@' === $line->getChar(0)){
262 262
             return $this->setExtending($line);
263 263
         }
264 264
 
265 265
         $this->docType = $line->content;
266 266
         $docTypeContent = $this->getConfig('doc_types') or $this->throw("DocType $this->docType is not supported");
267 267
 
268
-        $this->indentation = $this->htsl->getConfig('indentation', $this->docType) ?? (function ($scalarOrFalse) {
268
+        $this->indentation = $this->htsl->getConfig('indentation', $this->docType) ?? (function ($scalarOrFalse){
269 269
             return is_scalar($scalarOrFalse) ? $scalarOrFalse : false;
270 270
         })($this->htsl->getConfig('indentation'));
271 271
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      */
282 282
     protected function setExtending(Line $firstLine):self
283 283
     {
284
-        switch ($name = $firstLine->pregGet('/(?<=^@)[\w-:]+/')) {
284
+        switch ($name = $firstLine->pregGet('/(?<=^@)[\w-:]+/')){
285 285
             default:{
286 286
                 $this->throw("The @$name is not supported.");
287 287
             }break;
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
      */
306 306
     protected function lineByLine():self
307 307
     {
308
-        while (($line = $this->getLine())->hasMore()) {
308
+        while (($line = $this->getLine())->hasMore()){
309 309
             $this->lineNumber += 1;
310 310
 
311
-            if ($this->embedment) {
311
+            if ($this->embedment){
312 312
                 $this->embeddingParse($line);
313
-            } else {
313
+            } else{
314 314
                 $this->parseLine($line);
315 315
             }
316 316
         }
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
      */
334 334
     protected function embeddingParse(Line $line):self
335 335
     {
336
-        if ($line->content === '<}') {
336
+        if ($line->content === '<}'){
337 337
             $this->breakEmbedding();
338
-        } else {
338
+        } else{
339 339
             $this->embedment->parseLine($line->getSubIndentLine());
340 340
         }
341 341
 
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
         $this->currentLine = $line;
385 385
         $this->setLevel($line->getIndentLevel());
386 386
 
387
-        switch ($line->getChar(0)) {
387
+        switch ($line->getChar(0)){
388 388
             default:{
389 389
                 $this->parseStringLine($line);
390 390
             }break;
391 391
             case '`':{
392
-                if ('=' === $line->getChar(1)) {
392
+                if ('=' === $line->getChar(1)){
393 393
                     $this->parseExpressionHtmlLine($line);
394
-                } else {
394
+                } else{
395 395
                     $this->parseHtmlLine($line);
396 396
                 }
397 397
             }break;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
      */
558 558
     protected function parseDocControlLine(Line $line):self
559 559
     {
560
-        switch ($name = $line->pregGet('/(?<=^@)[\w-:]+/')) {
560
+        switch ($name = $line->pregGet('/(?<=^@)[\w-:]+/')){
561 561
             default:{
562 562
                 $this->throw("The @$name is not supported.");
563 563
             }break;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
     {
607 607
         $inclued = (new static($this->htsl, $this->buffer->goSide($line->pregGet('/(?<=\( ).*(?= \))/')), $this, $this->indentation))->execute()->content;
608 608
 
609
-        if (false !== $this->indentation) {
609
+        if (false !== $this->indentation){
610 610
             $inclued = preg_replace('/(?<=^|\\n)(?!$)/', str_repeat($this->indentation, $this->level - $this->sectionLevel), $inclued);
611 611
         }
612 612
 
@@ -648,14 +648,14 @@  discard block
 block discarded – undo
648 648
     {
649 649
         $sectionName = $line->pregGet('/(?<=\( ).*(?= \))/');
650 650
 
651
-        if (!isset($this->sections[$sectionName])) {
651
+        if (!isset($this->sections[$sectionName])){
652 652
             $this->openNode(new StringNode($this, $line));
653 653
 
654 654
             return $this;
655 655
         }
656 656
         $content = $this->sections[$sectionName]->content;
657 657
 
658
-        if (false !== $this->indentation) {
658
+        if (false !== $this->indentation){
659 659
             $content = preg_replace('/(?<=^|\\n)(?!$)/', str_repeat($this->indentation, $this->level), $content);
660 660
         }
661 661
 
@@ -677,24 +677,24 @@  discard block
 block discarded – undo
677 677
      */
678 678
     public function setSection(Section $section = null):self
679 679
     {
680
-        if (!$section) {
680
+        if (!$section){
681 681
             $this->sectionLevel = 0;
682 682
             $this->currentSection = null;
683 683
 
684 684
             return $this;
685 685
         }
686 686
 
687
-        if ($this->currentSection) {
687
+        if ($this->currentSection){
688 688
             $this->throw('Nesting definition of section is forbidden.');
689 689
         }
690 690
 
691
-        if (isset($this->parent->sections[$section->name])) {
691
+        if (isset($this->parent->sections[$section->name])){
692 692
             $this->throw("Section $sectionName already defined.");
693 693
         }
694 694
 
695 695
         $this->currentSection = $section;
696 696
 
697
-        if ($section->name) {
697
+        if ($section->name){
698 698
             $this->parent->sections[$section->name] = $section;
699 699
         }
700 700
 
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
      */
711 711
     protected function bubbleSections():self
712 712
     {
713
-        if ($this->parent) {
714
-            foreach ($this->sections as $name => $section) {
715
-                if (!isset($this->parent->sections[$name])) {
713
+        if ($this->parent){
714
+            foreach ($this->sections as $name => $section){
715
+                if (!isset($this->parent->sections[$name])){
716 716
                     $this->parent->sections[$name] = $section;
717 717
                 }
718 718
             }
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
     {
743 743
         $level -= $this->level;
744 744
 
745
-        if ($level <= 0) {
745
+        if ($level <= 0){
746 746
             $this->closeNodes(-$level);
747
-        } elseif ($level == 1) {
747
+        } elseif ($level == 1){
748 748
             $this->level += 1;
749
-        } else {
749
+        } else{
750 750
             $this->throw('Indent error.');
751 751
         }
752 752
 
@@ -778,11 +778,11 @@  discard block
 block discarded – undo
778 778
      */
779 779
     protected function closeNodes(int $level = 0):self
780 780
     {
781
-        if (empty($this->openedNodes)) {
781
+        if (empty($this->openedNodes)){
782 782
             return $this;
783 783
         }
784 784
 
785
-        while ($level-- >= 0) {
785
+        while ($level-- >= 0){
786 786
             $node = array_pop($this->openedNodes);
787 787
 
788 788
             $node->scope and $this->removeScope($node);
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
      */
825 825
     protected function removeScope(Node $scope):self
826 826
     {
827
-        if ($scope !== array_shift($this->scopes)) {
827
+        if ($scope !== array_shift($this->scopes)){
828 828
             $this->throw('Scope nesting error');
829 829
         }
830 830
 
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
      */
841 841
     protected function appendLine(string $content):self
842 842
     {
843
-        if (false !== $this->indentation) {
843
+        if (false !== $this->indentation){
844 844
             $content = str_repeat($this->indentation, $this->level - $this->sectionLevel).$content."\n";
845 845
         }
846 846
 
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
      */
857 857
     protected function append(string $content):self
858 858
     {
859
-        if ($this->currentSection) {
859
+        if ($this->currentSection){
860 860
             $this->currentSection->append($content);
861
-        } else {
861
+        } else{
862 862
             $this->content .= $content;
863 863
         }
864 864
 
Please login to merge, or discard this patch.
libs/Parser/Node/TagNode.php 1 patch
Braces   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         $this->tagName = $this->config['name'] ?? $name;
47 47
         $this->isEmpty = $this->line->getChar(-1) === '/' || $this->document->getConfig('empty_tags', $this->tagName);
48
-        isset($this->config['default_attributes']) and array_walk($this->config['default_attributes'], function ($value, $key) {
48
+        isset($this->config['default_attributes']) and array_walk($this->config['default_attributes'], function ($value, $key){
49 49
             $this->setAttribute($key, $value);
50 50
         });
51 51
 
@@ -59,33 +59,33 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function open():string
61 61
     {
62
-        if (isset($this->config['opener'])) {
62
+        if (isset($this->config['opener'])){
63 63
             return $this->config['opener'];
64 64
         }
65 65
 
66
-        if (isset($this->config['params'])) {
66
+        if (isset($this->config['params'])){
67 67
             $this->parseParams();
68 68
         }
69 69
 
70
-        if (isset($this->config['name_value'])) {
70
+        if (isset($this->config['name_value'])){
71 71
             $this->parseNameValue();
72 72
         }
73 73
 
74
-        if (isset($this->config['link'])) {
74
+        if (isset($this->config['link'])){
75 75
             $this->parseLink();
76 76
         }
77 77
 
78
-        if (isset($this->config['target'])) {
78
+        if (isset($this->config['target'])){
79 79
             $this->parseTarget();
80 80
         }
81 81
 
82
-        if (isset($this->config['alt'])) {
82
+        if (isset($this->config['alt'])){
83 83
             $this->parseAlt();
84 84
         }
85 85
 
86 86
         $this->parseCommonAttributes();
87 87
 
88
-        if (isset($this->config['in_scope']) && isset($this->config['scope_function']) && is_callable($this->config['scope_function'])) {
88
+        if (isset($this->config['in_scope']) && isset($this->config['scope_function']) && is_callable($this->config['scope_function'])){
89 89
             $this->config['scope_function']->call($this, $this->document->scope);
90 90
         }
91 91
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
     {
136 136
         $params = preg_split('/(?<!\\\\)\\|/', $this->line->pregGet('/^-[\w-:]+\((.*?)\)(?= |(\\{>)?$)/', 1));
137 137
 
138
-        if (($m = count($params)) != ($n = count($this->config['params']))) {
138
+        if (($m = count($params)) != ($n = count($this->config['params']))){
139 139
             $this->document->throw("Tag $this->name has $n parameters $m given.");
140 140
         }
141 141
 
142
-        array_map(function ($key, $value) {
142
+        array_map(function ($key, $value){
143 143
             return $this->setAttribute($key, str_replace('\\|', '|', $value));
144 144
         }, $this->config['params'], $params);
145 145
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $params = $this->line->pregGet('/ <(.*?)>(?= |$)/', 1)
157 157
          and $params = preg_split('/(?<!\\\\)\\|/', $params)
158
-          and array_map(function ($key, $value) {
158
+          and array_map(function ($key, $value){
159 159
               return isset($key) && isset($value) ? $this->setAttribute($key, $this->checkExpression(str_replace('\\|', '|', $value))) : '';
160 160
           }, $this->config['name_value'], $params);
161 161
 
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
     {
172 172
         $link = $this->line->pregGet('/ @((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1);
173 173
 
174
-        if (strlen($link)) {
175
-            if (isset($this->config['target']) && ':' === $link[0]) {
174
+        if (strlen($link)){
175
+            if (isset($this->config['target']) && ':' === $link[0]){
176 176
                 $this->setAttribute($this->config['link'], 'javascript'.$link);
177
-            } elseif ('//' === ($firstTwoLetters = substr($link, 0, 2))) {
177
+            } elseif ('//' === ($firstTwoLetters = substr($link, 0, 2))){
178 178
                 $this->setAttribute($this->config['link'], 'http:'.$link);
179
-            } elseif ('\\\\' === $firstTwoLetters) {
179
+            } elseif ('\\\\' === $firstTwoLetters){
180 180
                 $this->setAttribute($this->config['link'], 'https://'.substr($link, 2));
181
-            } else {
181
+            } else{
182 182
                 $this->setAttribute($this->config['link'], $this->checkExpression($link));
183 183
             }
184 184
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     {
196 196
         $target = $this->line->pregGet('/ >((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1);
197 197
 
198
-        if (strlen($target)) {
198
+        if (strlen($target)){
199 199
             $this->setAttribute($this->config['target'], $this->checkExpression($target));
200 200
         }
201 201
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $alt = $this->line->pregGet('/ _((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1);
213 213
 
214
-        if (strlen($alt)) {
214
+        if (strlen($alt)){
215 215
             $this->setAttribute($this->config['alt'], $this->checkExpression($alt));
216 216
         }
217 217
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
         $classes = $this->line->pregGet('/ \.[^ ]+(?= |$)/')
234 234
          and preg_match_all('/\.((?(?!\()[^.]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\))))/', $classes, $matches)
235
-          and $classes = implode(' ', array_filter(array_map(function ($className) {
235
+          and $classes = implode(' ', array_filter(array_map(function ($className){
236 236
               return $this->checkExpression($className);
237 237
           }, $matches[1])))
238 238
            and $this->setAttribute('class', $classes);
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
         $style = $this->line->pregGet('/ \[([^\]]+;)(?=\]( |$))/', 1)
244 244
          and $this->setAttribute('style', $style);
245 245
 
246
-        $eventListeners = $this->line->pregMap('/ %(\w+)\{>(.*?)<\}(?= |$)/', function ($string, $name, $code) {
246
+        $eventListeners = $this->line->pregMap('/ %(\w+)\{>(.*?)<\}(?= |$)/', function ($string, $name, $code){
247 247
             $this->setAttribute('on'.$name, str_replace('"', '&quot;', $code));
248 248
         })
249 249
          and implode('', $eventListeners);
250 250
 
251 251
         $other = $this->line->pregGet('/(?<=\{).*?(?=;\}( |$))/')
252
-         and array_map(function ($keyValue) {
253
-             preg_replace_callback('/^([\w-:]+)(?:\?(.+?))?(?:\=(.*))?$/', function ($matches) {
252
+         and array_map(function ($keyValue){
253
+             preg_replace_callback('/^([\w-:]+)(?:\?(.+?))?(?:\=(.*))?$/', function ($matches){
254 254
                  $this->setAttribute($matches[1], ($matches[3] ?? $matches[1]) ?: $matches[1], $matches[2] ?? null);
255 255
              }, $keyValue);
256 256
          }, explode(';', $other));
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     {
280 280
         ksort($this->attributes);
281 281
 
282
-        return implode('', array_map(static function (string $key, array $data) {
282
+        return implode('', array_map(static function (string $key, array $data){
283 283
             return isset($data['condition']) && strlen($data['condition']) ?
284 284
                 "<?php if( {$data['condition']} ){?> $key=\"{$data['value']}\"<?php }?>"
285 285
                 :
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      */
297 297
     protected function setAttribute(string $key, string $value, string $condition = null):self
298 298
     {
299
-        if (isset($this->attributes[$key])) {
299
+        if (isset($this->attributes[$key])){
300 300
             $this->document->throw("Attribute $key of $this->name cannot redeclare.");
301 301
         }
302 302
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      */
355 355
     public function offsetUnset($offset)
356 356
     {
357
-        if (isset($this->attributes[$offset])) {
357
+        if (isset($this->attributes[$offset])){
358 358
             unset($this->attributes[$offset]);
359 359
         }
360 360
     }
Please login to merge, or discard this patch.
libs/Parser/Node/Contracts/ANode.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         static $nodeType;
100 100
 
101
-        return $nodeType ?? $nodeType = $this->nodeType ?? (static function ($className) {
101
+        return $nodeType ?? $nodeType = $this->nodeType ?? (static function ($className){
102 102
             return strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_$1', preg_replace('/^(?:\\w+\\\\)*(\\w+)Node$/', '$1', $className)));
103 103
         })(get_class($this));
104 104
     }
@@ -115,37 +115,37 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $config = $configProvider->getConfig($this->nodeType.'_nodes', $name) ?: $configProvider->getConfig($this->nodeType.'_nodes', '*');
117 117
 
118
-        if (isset($config['multiple'])) {
119
-            foreach ($config['multiple'] as $value) {
120
-                if ($this->line->pregGet($value['pattern'])) {
118
+        if (isset($config['multiple'])){
119
+            foreach ($config['multiple'] as $value){
120
+                if ($this->line->pregGet($value['pattern'])){
121 121
                     $config = $value;
122 122
                     break;
123 123
                 }
124 124
             }
125 125
         }
126 126
 
127
-        if (isset($config['in'])) {
128
-            $config = (function (array $config) use ($name) {
129
-                foreach ($config['in'] as $key => $value) {
130
-                    if ($this->document->scope && $this->document->scope->scope === $key) {
127
+        if (isset($config['in'])){
128
+            $config = (function (array $config) use ($name){
129
+                foreach ($config['in'] as $key => $value){
130
+                    if ($this->document->scope && $this->document->scope->scope === $key){
131 131
                         $value['in_scope'] = $key;
132 132
 
133 133
                         return $value;
134 134
                     }
135 135
                 }
136
-                if (!isset($config['out'])) {
136
+                if (!isset($config['out'])){
137 137
                     $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',', array_keys($config['in'])));
138 138
                 }
139 139
 
140 140
                 return $config['out'];
141 141
             })($config);
142
-        } elseif (isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope, $config['only_in']))) {
142
+        } elseif (isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope, $config['only_in']))){
143 143
             $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',', $config['only_in']));
144
-        } elseif (isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope, $config['not_in']))) {
144
+        } elseif (isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope, $config['not_in']))){
145 145
             $this->document->throw("The $this->nodeType node $name not use in scope ".implode(',', $config['not_in']));
146 146
         }
147 147
 
148
-        if (!is_array($config)) {
148
+        if (!is_array($config)){
149 149
             $this->document->throw("The $this->nodeType node $name is not supported.");
150 150
         }
151 151
 
Please login to merge, or discard this patch.
libs/Parser/Node/ControlNode.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function close(Line $closerLine):string
83 83
     {
84
-        if (isset($this->config['close_by']) && $closerLine->indentLevel == $this->line->indentLevel) {
85
-            foreach ($this->config['close_by'] as $key => $value) {
86
-                if ($closerLine->pregMatch($key)) {
84
+        if (isset($this->config['close_by']) && $closerLine->indentLevel == $this->line->indentLevel){
85
+            foreach ($this->config['close_by'] as $key => $value){
86
+                if ($closerLine->pregMatch($key)){
87 87
                     return $this->withParam($value);
88 88
                 }
89 89
             }
90 90
         }
91 91
 
92
-        if (isset($this->config['closer'])) {
92
+        if (isset($this->config['closer'])){
93 93
             return $this->withParam($this->config['closer']);
94 94
         }
95 95
 
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
      */
106 106
     private function withParam(string $input)
107 107
     {
108
-        return str_replace('$_FLAG_$', "__HTSL_CTRL_FLAG_{$this->id}__", preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/', function (array $matches) {
108
+        return str_replace('$_FLAG_$', "__HTSL_CTRL_FLAG_{$this->id}__", preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/', function (array $matches){
109 109
             $param = $this->param;
110 110
 
111
-            if (isset($matches[1])) {
111
+            if (isset($matches[1])){
112 112
                 array_map(...[
113
-                    function ($replacer) use (&$param) {
113
+                    function ($replacer) use (&$param){
114 114
                         list($pattern, $replacement) = preg_split('/(?<!\\\\)\\//', $replacer);
115 115
                         $param = preg_replace(...[
116 116
                             "/$pattern/",
Please login to merge, or discard this patch.
libs/ReadingBuffer/FileBuffer.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     {
26 26
         substr($filePath, -5) === '.htsl' or $filePath .= '.htsl';
27 27
 
28
-        if (!file_exists($filePath) || !is_file($filePath)) {
28
+        if (!file_exists($filePath) || !is_file($filePath)){
29 29
             throw new \Exception("File $filePath not exists.", 1);
30 30
         }
31 31
 
Please login to merge, or discard this patch.
libs/ReadingBuffer/StringBuffer.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      */
25 25
     public function __construct(Htsl $htsl, string $content, string $filePath = '')
26 26
     {
27
-        if (false !== strpos($content, "\r")) {
27
+        if (false !== strpos($content, "\r")){
28 28
             throw new \Exception('Line ending must be LF.', 1);
29 29
         }
30 30
 
Please login to merge, or discard this patch.
libs/Htsl.php 1 patch
Braces   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
         $result = $this->execute(new FileBuffer($this, $fromFile));
67 67
 
68
-        if ($toFile) {
68
+        if ($toFile){
69 69
             return file_put_contents($toFile, $result);
70
-        } else {
70
+        } else{
71 71
             return $result;
72 72
         }
73 73
     }
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $result = $this->config;
133 133
 
134
-        foreach ($keys as $key) {
135
-            if (!isset($result[$key])) {
134
+        foreach ($keys as $key){
135
+            if (!isset($result[$key])){
136 136
                 return;
137 137
             }
138 138
 
@@ -152,26 +152,26 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function getFilePath(string $filePath, string $path = null):string
154 154
     {
155
-        if (!isset($this->basePath)) {
155
+        if (!isset($this->basePath)){
156 156
             throw new \Exception('BasePath musbe set.');
157 157
         }
158 158
 
159
-        if (!strlen($filePath)) {
159
+        if (!strlen($filePath)){
160 160
             throw new \Exception('FilePath cannot be empty.');
161 161
         }
162 162
 
163
-        if ('/' === $filePath[0]) {
164
-            if (is_null($path)) {
163
+        if ('/' === $filePath[0]){
164
+            if (is_null($path)){
165 165
                 return $filePath;
166
-            } else {
166
+            } else{
167 167
                 return $this->basePath.$filePath;
168 168
             }
169
-        } else {
170
-            if (!strlen($path)) {
169
+        } else{
170
+            if (!strlen($path)){
171 171
                 return $this->basePath.'/'.$filePath;
172
-            } elseif ('/' === substr($path, -1)) {
172
+            } elseif ('/' === substr($path, -1)){
173 173
                 return $path.$filePath;
174
-            } else {
174
+            } else{
175 175
                 return $path.'/'.$filePath;
176 176
             }
177 177
         }
Please login to merge, or discard this patch.
libs/Helper/TGetter.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
      */
16 16
     public function __get($attribute)
17 17
     {
18
-        if (is_callable([static::class, $getter = 'get'.implode('', array_map('ucfirst', explode('_', $attribute)))])) {
18
+        if (is_callable([static::class, $getter = 'get'.implode('', array_map('ucfirst', explode('_', $attribute)))])){
19 19
             return static::$getter();
20
-        } else {
20
+        } else{
21 21
             throw new \Exception(static::class.' has no attribute named '.$attribute);
22 22
         }
23 23
     }
Please login to merge, or discard this patch.
libs/Helper/DefaultConfigs.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -360,8 +360,8 @@
 block discarded – undo
360 360
                     'option' => [
361 361
                         'in' => [
362 362
                             'select' => [
363
-                                'scope_function' => function ($scope) {
364
-                                    if ($scope['value'] === $this['value']) {
363
+                                'scope_function' => function ($scope){
364
+                                    if ($scope['value'] === $this['value']){
365 365
                                         $this['selected'] = 'selected';
366 366
                                     }
367 367
                                 },
Please login to merge, or discard this patch.