Test Failed
Pull Request — master (#3)
by Chris
02:30
created
php/hamle/Text.php 1 patch
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -126,10 +126,13 @@  discard block
 block discarded – undo
126 126
     $args = join(',', array_map(function($v) {
127 127
       if(is_array($v) && $v['type'] ?? false === 'expr') {
128 128
         return self::renderExpr($v);
129
-      } else
130
-        return self::varToCode($v);
129
+      } else {
130
+              return self::varToCode($v);
131
+      }
131 132
     } , $filter['args']));
132
-    if(strlen($args)) $args = ','.$args;
133
+    if(strlen($args)) {
134
+      $args = ','.$args;
135
+    }
133 136
     $o = "$func($o" . $args . ")";
134 137
     if($filter['chain'] ?? false) {
135 138
       $o = self::addFilter($o, $filter['chain']);
@@ -202,8 +205,9 @@  discard block
 block discarded – undo
202 205
       self::varToCode($limit),
203 206
       self::varToCode($offset)
204 207
     ];
205
-    if ($addGroup)
206
-      $opt[] = self::varToCode($group);
208
+    if ($addGroup) {
209
+          $opt[] = self::varToCode($group);
210
+    }
207 211
     return join(',', $opt);
208 212
   }
209 213
 
@@ -239,10 +243,12 @@  discard block
 block discarded – undo
239 243
     $id = null;
240 244
     $type = [];
241 245
     foreach ($n['query'] ?? [] as $q) {
242
-      if ($q['q'] === 'id')
243
-        $id = $q['id'] ?? null;
244
-      if ($q['q'] === 'type')
245
-        $type = $q['id'];
246
+      if ($q['q'] === 'id') {
247
+              $id = $q['id'] ?? null;
248
+      }
249
+      if ($q['q'] === 'type') {
250
+              $type = $q['id'];
251
+      }
246 252
     }
247 253
     if ($n['query'] === null) {
248 254
       $o = 'Hamle\Scope::get(0)';
@@ -291,8 +297,9 @@  discard block
 block discarded – undo
291 297
     foreach ($this->tree as $node) {
292 298
       switch ($node['type']) {
293 299
         case 'string':
294
-          if ($node['body'] !== '')
295
-            $out .= $node['body'];
300
+          if ($node['body'] !== '') {
301
+                      $out .= $node['body'];
302
+          }
296 303
           break;
297 304
         case 'scopeName':
298 305
           $out .= '<?=' . self::renderScopeName($node) . '?>';
@@ -322,8 +329,9 @@  discard block
 block discarded – undo
322 329
     foreach ($this->tree as $node) {
323 330
       switch ($node['type']) {
324 331
         case 'string':
325
-          if ($node['body'] !== '')
326
-            $out[] = self::varToCode($node['body']);
332
+          if ($node['body'] !== '') {
333
+                      $out[] = self::varToCode($node['body']);
334
+          }
327 335
           break;
328 336
         case 'scopeThis':
329 337
           $out[] = self::renderScopeThis($node);
Please login to merge, or discard this patch.
php/hamle/Tag/Control.php 1 patch
Braces   +23 added lines, -15 removed lines patch added patch discarded remove patch
@@ -82,21 +82,23 @@  discard block
 block discarded – undo
82 82
         $scopeName = $m[1];
83 83
         $lookup = substr($this->var, 0, strlen($this->var) - strlen($m[0]));
84 84
         $hsv = new H\Text(trim($lookup), H\Text::TOKEN_CONTROL);
85
-      } else
86
-        $hsv = new H\Text($this->var, H\Text::TOKEN_CONTROL);
85
+      } else {
86
+              $hsv = new H\Text($this->var, H\Text::TOKEN_CONTROL);
87
+      }
87 88
     }
88 89
     switch ($this->type) {
89 90
       case "each":
90
-        if ($this->var)
91
-          $out .= "foreach(" . $hsv->toPHP() . " as {$this->o}) { \n";
92
-        else
93
-          $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n";
91
+        if ($this->var) {
92
+                  $out .= "foreach(" . $hsv->toPHP() . " as {$this->o}) { \n";
93
+        } else {
94
+                  $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n";
95
+        }
94 96
         $out .= "Hamle\\Scope::add({$this->o}); ";
95 97
         break;
96 98
       case "with":
97
-        if ($scopeName)
98
-          $out .= "Hamle\\Scope::add(" . $hsv->toPHP() . ", \"$scopeName\");\n;";
99
-        else {
99
+        if ($scopeName) {
100
+                  $out .= "Hamle\\Scope::add(" . $hsv->toPHP() . ", \"$scopeName\");\n;";
101
+        } else {
100 102
           $out .= "if(({$this->o} = " . $hsv->toPHP() . ") && " .
101 103
               "{$this->o}->valid()) {\n";
102 104
           $out .= "Hamle\\Scope::add({$this->o});\n;";
@@ -123,8 +125,9 @@  discard block
 block discarded – undo
123 125
       case "each";
124 126
         $out .= 'Hamle\\Scope::done(); ';
125 127
         $out .= '}';
126
-        if (!$this->var)
127
-          $out .= "Hamle\\Scope::get()->rewind();\n";
128
+        if (!$this->var) {
129
+                  $out .= "Hamle\\Scope::get()->rewind();\n";
130
+        }
128 131
         break;
129 132
       case "if":
130 133
       case "else":
@@ -140,7 +143,9 @@  discard block
 block discarded – undo
140 143
         return "";
141 144
         break;
142 145
     }
143
-    if ($this->else) $out .= "else{";
146
+    if ($this->else) {
147
+      $out .= "else{";
148
+    }
144 149
     return $out . "\n?>";
145 150
   }
146 151
 
@@ -148,9 +153,12 @@  discard block
 block discarded – undo
148 153
     $ind = $minify ? '' : str_pad('', $indent);
149 154
     $oneliner = (!(count($this->content) > 1 || $this->tags));
150 155
     $out = $this->renderStTag();
151
-    if ($this->content) $out .= $this->renderContent($ind, $oneliner || $minify);
152
-    foreach ($this->tags as $tag)
153
-      $out .= $tag->render($indent, $minify);
156
+    if ($this->content) {
157
+      $out .= $this->renderContent($ind, $oneliner || $minify);
158
+    }
159
+    foreach ($this->tags as $tag) {
160
+          $out .= $tag->render($indent, $minify);
161
+    }
154 162
     $out .= $this->renderEnTag();
155 163
     return $out;
156 164
   }
Please login to merge, or discard this patch.
php/hamle/Grammar/Parser.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -306,7 +306,9 @@
 block discarded – undo
306 306
     private function peg_f3($body) { return $body; }
307 307
     private function peg_f4($name) {
308 308
             return new \Seufert\Hamle\TextNode\ScopeId(null, null, new \Seufert\Hamle\TextNode\ModelParam($name)); }
309
-    private function peg_f5($expr, $chain) { if(!$chain) return $expr;
309
+    private function peg_f5($expr, $chain) { if(!$chain) {
310
+      return $expr;
311
+    }
310 312
                            $top = array_pop($chain);
311 313
                            while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); }
312 314
     private function peg_f6($sub) { return $sub; }
Please login to merge, or discard this patch.