Passed
Push — master ( 190c48...bc57b3 )
by Chris
03:45 queued 10s
created
php/hamle/Tag/Text.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@
 block discarded – undo
45 45
       if ($this->escape) {
46 46
         $parse = new H\Text($s, $strtype);
47 47
         $this->content[] = $parse->toHTML($this->escapeVars);
48
-      } else
49
-        $this->content[] = $s;
48
+      } else {
49
+              $this->content[] = $s;
50
+      }
50 51
     }
51 52
   }
52 53
 
Please login to merge, or discard this patch.
php/hamle/Scope.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
       self::$namedScopes[$name] = $model;
28 28
     else
29 29
       self::$scopes[] = $model;
30
-    if(self::$scopeHook) {
30
+    if (self::$scopeHook) {
31 31
         (self::$scopeHook)($model);
32 32
     }
33 33
   }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
       self::$namedScopes[$name]->rewind();
74 74
       return self::$namedScopes[$name];
75 75
     } else
76
-      if(self::$returnZeroOnNoScope)
76
+      if (self::$returnZeroOnNoScope)
77 77
         return new Model\Zero();
78 78
       throw new RunTime("Unable to find scope ($name)");
79 79
   }
Please login to merge, or discard this patch.
Braces   +23 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,12 +21,14 @@  discard block
 block discarded – undo
21 21
   static $scopeHook;
22 22
 
23 23
   static function add($model, $name = null) {
24
-    if (!$model instanceOf Model)
25
-      throw new Unsupported("Unsupported Model (".get_class($model)."), Needs to implement hamleModel Interface");
26
-    if ($name)
27
-      self::$namedScopes[$name] = $model;
28
-    else
29
-      self::$scopes[] = $model;
24
+    if (!$model instanceOf Model) {
25
+          throw new Unsupported("Unsupported Model (".get_class($model)."), Needs to implement hamleModel Interface");
26
+    }
27
+    if ($name) {
28
+          self::$namedScopes[$name] = $model;
29
+    } else {
30
+          self::$scopes[] = $model;
31
+    }
30 32
     if(self::$scopeHook) {
31 33
         (self::$scopeHook)($model);
32 34
     }
@@ -47,15 +49,21 @@  discard block
 block discarded – undo
47 49
    */
48 50
   static function get($id = 0) {
49 51
     if (0 == $id) {
50
-      if ($scope = end(self::$scopes))
51
-        return $scope;
52
+      if ($scope = end(self::$scopes)) {
53
+              return $scope;
54
+      }
52 55
       throw new OutOfScope("Unable to find Scope ($id)");
53 56
     }
54 57
     $key = $id - 1;
55
-    if ($id < 0) $key = count(self::$scopes) + $id - 1;
56
-    if ($id == 0) $key = count(self::$scopes) - 1;
57
-    if (!isset(self::$scopes[$key]))
58
-      throw new OutOfScope("Unable to find Scope ($id) or $key");
58
+    if ($id < 0) {
59
+      $key = count(self::$scopes) + $id - 1;
60
+    }
61
+    if ($id == 0) {
62
+      $key = count(self::$scopes) - 1;
63
+    }
64
+    if (!isset(self::$scopes[$key])) {
65
+          throw new OutOfScope("Unable to find Scope ($id) or $key");
66
+    }
59 67
     return self::$scopes[$key];
60 68
   }
61 69
 
@@ -73,8 +81,9 @@  discard block
 block discarded – undo
73 81
       self::$namedScopes[$name]->rewind();
74 82
       return self::$namedScopes[$name];
75 83
     } else
76
-      if(self::$returnZeroOnNoScope)
77
-        return new Model\Zero();
84
+      if(self::$returnZeroOnNoScope) {
85
+              return new Model\Zero();
86
+      }
78 87
       throw new RunTime("Unable to find scope ($name)");
79 88
   }
80 89
 
Please login to merge, or discard this patch.
php/hamle/Parse.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         $i = self::indentLevel($indent);
157 157
         unset($m[0]);
158 158
         switch (strlen($code) ? $code[0] : ($textcode ? $textcode : "")) {
159
-          case "|": //Control Tag
159
+          case "|" : //Control Tag
160 160
             if ($code == "|snippet")
161 161
               $hTag = new Tag\Snippet($text);
162 162
             elseif ($code == "|form")
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             break;
197 197
           default:
198 198
             $attr = array();
199
-            if(isset($params[0]) && $params[0] == "[") {
199
+            if (isset($params[0]) && $params[0] == "[") {
200 200
               $param = substr($params, 1, -1);
201 201
               $param = str_replace(['+', '\\&'], ['%2B', '%26'], $param);
202 202
 //              parse_str($param, $attr);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
               if ($s[0] == ".") $class[] = substr($s, 1);
210 210
               if ($s[0] == "!") $ref = substr($s, 1);
211 211
             }
212
-            if($ref)
212
+            if ($ref)
213 213
               $hTag = new Tag\DynHtml($tag, $class, $attr, $id, $ref);
214 214
             else
215 215
               $hTag = new Tag\Html($tag, $class, $attr, $id);
@@ -222,16 +222,16 @@  discard block
 block discarded – undo
222 222
         else
223 223
           $this->root[] = $hTag;
224 224
       } else
225
-        throw new ParseError("Unable to parse line {$this->lineNo}\n\"$line\"/" . preg_last_error());
225
+        throw new ParseError("Unable to parse line {$this->lineNo}\n\"$line\"/".preg_last_error());
226 226
       $this->lineNo++;
227 227
     }
228 228
   }
229 229
 
230 230
   function parseQueryString($qs) {
231 231
     $out = [];
232
-    foreach(explode('&',$qs) as $s) {
233
-      $kv = explode('=',$s,2);
234
-      $out[urldecode($kv[0])] = isset($kv[1])?urldecode($kv[1]):null;
232
+    foreach (explode('&', $qs) as $s) {
233
+      $kv = explode('=', $s, 2);
234
+      $out[urldecode($kv[0])] = isset($kv[1]) ?urldecode($kv[1]) : null;
235 235
     }
236 236
     return $out;
237 237
   }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     $m = array();
250 250
     while ($this->lineNo + 1 < $this->lineCount &&
251 251
         (!trim($this->lines[$this->lineNo + 1]) ||
252
-            preg_match('/^(\s){' . $indent . '}((\s)+[^\s].*)$/',
252
+            preg_match('/^(\s){'.$indent.'}((\s)+[^\s].*)$/',
253 253
                 $this->lines[$this->lineNo + 1], $m))) {
254 254
       if (trim($this->lines[$this->lineNo + 1]))
255 255
         $out[] = $m[2];
Please login to merge, or discard this patch.
Braces   +56 added lines, -36 removed lines patch added patch discarded remove patch
@@ -109,22 +109,25 @@  discard block
 block discarded – undo
109 109
     $revSnip = array();
110 110
     /** @var Tag[] $roots */
111 111
     $roots = array();
112
-    foreach ($this->root as $snip)
113
-      if ($snip instanceOf Tag\Snippet) {
112
+    foreach ($this->root as $snip) {
113
+          if ($snip instanceOf Tag\Snippet) {
114 114
         if ($snip->getType() == "append") {
115 115
           array_unshift($revSnip, $snip);
116
+    }
116 117
         } else {
117 118
           $fwdSnip[] = $snip;
118 119
         }
119 120
       } else {
120 121
         $roots[] = $snip;
121 122
       }
122
-    foreach ($fwdSnip as $snip)
123
-      foreach ($roots as $root)
123
+    foreach ($fwdSnip as $snip) {
124
+          foreach ($roots as $root)
124 125
         $snip->apply($root);
125
-    foreach ($revSnip as $snip)
126
-      foreach ($roots as $root)
126
+    }
127
+    foreach ($revSnip as $snip) {
128
+          foreach ($roots as $root)
127 129
         $snip->apply($root);
130
+    }
128 131
     $this->root = $roots;
129 132
   }
130 133
 
@@ -143,9 +146,11 @@  discard block
 block discarded – undo
143 146
     $heir = array();
144 147
     while ($this->lineNo < $this->lineCount) {
145 148
       $line = $this->lines[$this->lineNo];
146
-      if (trim($line)) if (preg_match(self::REGEX_PARSE_LINE, $line, $m)) {
149
+      if (trim($line)) {
150
+        if (preg_match(self::REGEX_PARSE_LINE, $line, $m)) {
147 151
         if (FALSE !== strpos($m[1], "\t"))
148 152
           throw new ParseError("Tabs are not supported in templates at this time");
153
+      }
149 154
         $indent = strlen($m[1]);
150 155
         $tag = isset($m[2]) ? $tag = $m[2] : "";
151 156
         $classid = isset($m[3]) ? $m[3] : "";
@@ -157,13 +162,13 @@  discard block
 block discarded – undo
157 162
         unset($m[0]);
158 163
         switch (strlen($code) ? $code[0] : ($textcode ? $textcode : "")) {
159 164
           case "|": //Control Tag
160
-            if ($code == "|snippet")
161
-              $hTag = new Tag\Snippet($text);
162
-            elseif ($code == "|form")
163
-              $hTag = new Tag\Form($text);
164
-            elseif ($code == "|formhint")
165
-              $hTag = new Tag\FormHint();
166
-            elseif ($code == "|else") {
165
+            if ($code == "|snippet") {
166
+                          $hTag = new Tag\Snippet($text);
167
+            } elseif ($code == "|form") {
168
+                          $hTag = new Tag\Form($text);
169
+            } elseif ($code == "|formhint") {
170
+                          $hTag = new Tag\FormHint();
171
+            } elseif ($code == "|else") {
167 172
               $hTag = new Tag\Control(substr($code, 1), $heir[$i - 1]);
168 173
               $hTag->setVar($text);
169 174
             } else {
@@ -174,8 +179,9 @@  discard block
 block discarded – undo
174 179
           case ":": //Filter Tag
175 180
             $hTag = new Tag\Filter(substr($code, 1));
176 181
             $hTag->addContent($text, Text::TOKEN_CODE);
177
-            foreach ($this->consumeBlock($indent) as $l)
178
-              $hTag->addContent($l, Text::TOKEN_CODE);
182
+            foreach ($this->consumeBlock($indent) as $l) {
183
+                          $hTag->addContent($l, Text::TOKEN_CODE);
184
+            }
179 185
             break;
180 186
           case "_": //String Tag
181 187
           case "__": //Unescape String Tag
@@ -191,8 +197,9 @@  discard block
 block discarded – undo
191 197
           case "//": // Non Printed Comment
192 198
             $hTag = new Tag\Comment($textcode);
193 199
             $hTag->addContent($text);
194
-            foreach ($this->consumeBlock($indent) as $l)
195
-              $hTag->addContent($l, Text::TOKEN_CODE);
200
+            foreach ($this->consumeBlock($indent) as $l) {
201
+                          $hTag->addContent($l, Text::TOKEN_CODE);
202
+            }
196 203
             break;
197 204
           default:
198 205
             $attr = array();
@@ -204,25 +211,34 @@  discard block
 block discarded – undo
204 211
             }
205 212
             $class = array(); $id = ""; $ref = "";
206 213
             preg_match_all('/[#\.!][a-zA-Z0-9\-\_]+/m', $classid, $cid);
207
-            if (isset($cid[0])) foreach ($cid[0] as $s) {
214
+            if (isset($cid[0])) {
215
+              foreach ($cid[0] as $s) {
208 216
               if ($s[0] == "#") $id = substr($s, 1);
209
-              if ($s[0] == ".") $class[] = substr($s, 1);
210
-              if ($s[0] == "!") $ref = substr($s, 1);
211 217
             }
212
-            if($ref)
213
-              $hTag = new Tag\DynHtml($tag, $class, $attr, $id, $ref);
214
-            else
215
-              $hTag = new Tag\Html($tag, $class, $attr, $id);
218
+              if ($s[0] == ".") {
219
+                $class[] = substr($s, 1);
220
+              }
221
+              if ($s[0] == "!") {
222
+                $ref = substr($s, 1);
223
+              }
224
+            }
225
+            if($ref) {
226
+                          $hTag = new Tag\DynHtml($tag, $class, $attr, $id, $ref);
227
+            } else {
228
+                          $hTag = new Tag\Html($tag, $class, $attr, $id);
229
+            }
216 230
             $hTag->addContent($text);
217 231
             break;
218 232
         }
219 233
         $heir[$i] = $hTag;
220
-        if ($i > 0)
221
-          $heir[$i - 1]->addChild($hTag);
222
-        else
223
-          $this->root[] = $hTag;
224
-      } else
225
-        throw new ParseError("Unable to parse line {$this->lineNo}\n\"$line\"/" . preg_last_error());
234
+        if ($i > 0) {
235
+                  $heir[$i - 1]->addChild($hTag);
236
+        } else {
237
+                  $this->root[] = $hTag;
238
+        }
239
+      } else {
240
+              throw new ParseError("Unable to parse line {$this->lineNo}\n\"$line\"/" . preg_last_error());
241
+      }
226 242
       $this->lineNo++;
227 243
     }
228 244
   }
@@ -238,8 +254,9 @@  discard block
 block discarded – undo
238 254
 
239 255
   function output($minify = false) {
240 256
     $out = "<?php\nuse Seufert\\Hamle;\n?>";
241
-    foreach ($this->root as $tag)
242
-      $out .= $tag->render(0, $minify);
257
+    foreach ($this->root as $tag) {
258
+          $out .= $tag->render(0, $minify);
259
+    }
243 260
     return $out;
244 261
 
245 262
   }
@@ -251,15 +268,18 @@  discard block
 block discarded – undo
251 268
         (!trim($this->lines[$this->lineNo + 1]) ||
252 269
             preg_match('/^(\s){' . $indent . '}((\s)+[^\s].*)$/',
253 270
                 $this->lines[$this->lineNo + 1], $m))) {
254
-      if (trim($this->lines[$this->lineNo + 1]))
255
-        $out[] = $m[2];
271
+      if (trim($this->lines[$this->lineNo + 1])) {
272
+              $out[] = $m[2];
273
+      }
256 274
       $this->lineNo++;
257 275
     }
258 276
     return $out;
259 277
   }
260 278
 
261 279
   function indentLevel($indent) {
262
-    if (!isset($this->indents)) $this->indents = array();
280
+    if (!isset($this->indents)) {
281
+      $this->indents = array();
282
+    }
263 283
     if (!count($this->indents)) {
264 284
       $this->indents = array(0 => $indent);
265 285
       // Key = indent level, Value = Depth in spaces
Please login to merge, or discard this patch.
php/hamle/Text/Filter.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -46,23 +46,23 @@  discard block
 block discarded – undo
46 46
   static $filterResolver = null;
47 47
 
48 48
   function __construct($s, Text $what) {
49
-    if(preg_match("/^([a-z_]+)(?:\\((?P<vars>.*)\\))?(?:\\|(?P<chained>.+?))?$/", $s, $m)) {
49
+    if (preg_match("/^([a-z_]+)(?:\\((?P<vars>.*)\\))?(?:\\|(?P<chained>.+?))?$/", $s, $m)) {
50 50
       $this->filter = $m[1];
51 51
       $this->vars = isset($m['vars']) && strlen($m['vars']) ? explode(',', $m['vars']) : [];
52
-      foreach($this->vars as $k=>$v)
53
-        $this->vars[$k] = str_replace("&comma;",',',$v);
54
-      if(isset($m['chained']) && strlen($m['chained'])) {
55
-        $this->chained = new Filter($m['chained'],$what);
52
+      foreach ($this->vars as $k=>$v)
53
+        $this->vars[$k] = str_replace("&comma;", ',', $v);
54
+      if (isset($m['chained']) && strlen($m['chained'])) {
55
+        $this->chained = new Filter($m['chained'], $what);
56 56
       }
57 57
     } else {
58 58
       throw new ParseError("Unable to parse filter expression \"$s\"");
59 59
     }
60
-    if(method_exists(Filter::class, $this->filter)) {
60
+    if (method_exists(Filter::class, $this->filter)) {
61 61
       $this->filter = Filter::class.'::'.$this->filter;
62
-    } elseif(in_array($this->filter, ['round', 'strtoupper', 'strtolower', 'ucfirst'])) {
63
-    } elseif($this->filter === 'json') {
62
+    } elseif (in_array($this->filter, ['round', 'strtoupper', 'strtolower', 'ucfirst'])) {
63
+    } elseif ($this->filter === 'json') {
64 64
       $this->filter = 'json_encode';
65
-    } elseif(self::$filterResolver && $filter = (self::$filterResolver)($this->filter)) {
65
+    } elseif (self::$filterResolver && $filter = (self::$filterResolver)($this->filter)) {
66 66
       $this->filter = $filter;
67 67
     } else {
68 68
       throw new ParseError("Unknown Filter Type \"{$this->filter}\"");
@@ -71,24 +71,24 @@  discard block
 block discarded – undo
71 71
   }
72 72
 
73 73
   function toHTML($escape = false) {
74
-    if($escape)
75
-      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
76
-    return "<?=" . $this->toPHP() . "?>";
74
+    if ($escape)
75
+      return "<?=htmlspecialchars(".$this->toPHP().")?>";
76
+    return "<?=".$this->toPHP()."?>";
77 77
   }
78 78
 
79 79
   function toPHPpre() {
80 80
     $pre = '';
81
-    if($this->chained)
81
+    if ($this->chained)
82 82
       $pre = $this->chained->toPHPpre();
83 83
     return "$pre{$this->filter}(";
84 84
   }
85 85
 
86 86
   function toPHPpost() {
87 87
     $post = '';
88
-    if($this->chained)
88
+    if ($this->chained)
89 89
       $post = $this->chained->toPHPpost();
90 90
     $o = '';
91
-    foreach($this->vars as $v)
91
+    foreach ($this->vars as $v)
92 92
       $o .= ','.$this->varToCode($v);
93 93
     return "$o)$post";
94 94
   }
@@ -103,24 +103,24 @@  discard block
 block discarded – undo
103 103
 
104 104
   static function itersplit($v, $sep = ",") {
105 105
     $o = [];
106
-    foreach(explode($sep, $v) as $k=>$i) {
107
-      if($i)
108
-        $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k,'key'=>$k];
106
+    foreach (explode($sep, $v) as $k=>$i) {
107
+      if ($i)
108
+        $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k, 'key'=>$k];
109 109
     }
110 110
     return new WrapArray($o);
111 111
   }
112 112
 
113 113
   static function newlinebr($v) {
114
-    return str_replace("\n","<br />\n",$v);
114
+    return str_replace("\n", "<br />\n", $v);
115 115
   }
116 116
 
117 117
   static function replace($v, $src, $dst) {
118
-    return str_replace($src,$dst,$v);
118
+    return str_replace($src, $dst, $v);
119 119
   }
120 120
 
121 121
   static function ascents($v) {
122
-    $v = str_replace(['$',' ',','],'', $v);
123
-    return (int) round($v * 100,0);
122
+    $v = str_replace(['$', ' ', ','], '', $v);
123
+    return (int) round($v * 100, 0);
124 124
   }
125 125
 
126 126
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,8 +49,9 @@  discard block
 block discarded – undo
49 49
     if(preg_match("/^([a-z_]+)(?:\\((?P<vars>.*)\\))?(?:\\|(?P<chained>.+?))?$/", $s, $m)) {
50 50
       $this->filter = $m[1];
51 51
       $this->vars = isset($m['vars']) && strlen($m['vars']) ? explode(',', $m['vars']) : [];
52
-      foreach($this->vars as $k=>$v)
53
-        $this->vars[$k] = str_replace("&comma;",',',$v);
52
+      foreach($this->vars as $k=>$v) {
53
+              $this->vars[$k] = str_replace("&comma;",',',$v);
54
+      }
54 55
       if(isset($m['chained']) && strlen($m['chained'])) {
55 56
         $this->chained = new Filter($m['chained'],$what);
56 57
       }
@@ -71,25 +72,29 @@  discard block
 block discarded – undo
71 72
   }
72 73
 
73 74
   function toHTML($escape = false) {
74
-    if($escape)
75
-      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
75
+    if($escape) {
76
+          return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
77
+    }
76 78
     return "<?=" . $this->toPHP() . "?>";
77 79
   }
78 80
 
79 81
   function toPHPpre() {
80 82
     $pre = '';
81
-    if($this->chained)
82
-      $pre = $this->chained->toPHPpre();
83
+    if($this->chained) {
84
+          $pre = $this->chained->toPHPpre();
85
+    }
83 86
     return "$pre{$this->filter}(";
84 87
   }
85 88
 
86 89
   function toPHPpost() {
87 90
     $post = '';
88
-    if($this->chained)
89
-      $post = $this->chained->toPHPpost();
91
+    if($this->chained) {
92
+          $post = $this->chained->toPHPpost();
93
+    }
90 94
     $o = '';
91
-    foreach($this->vars as $v)
92
-      $o .= ','.$this->varToCode($v);
95
+    foreach($this->vars as $v) {
96
+          $o .= ','.$this->varToCode($v);
97
+    }
93 98
     return "$o)$post";
94 99
   }
95 100
 
@@ -104,8 +109,9 @@  discard block
 block discarded – undo
104 109
   static function itersplit($v, $sep = ",") {
105 110
     $o = [];
106 111
     foreach(explode($sep, $v) as $k=>$i) {
107
-      if($i)
108
-        $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k,'key'=>$k];
112
+      if($i) {
113
+              $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k,'key'=>$k];
114
+      }
109 115
     }
110 116
     return new WrapArray($o);
111 117
   }
Please login to merge, or discard this patch.
php/hamle/Field.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 
113 113
   function getValue() {
114 114
     if (!is_null($this->setValue)) return $this->setValue;
115
-    if (isset($_REQUEST[$this->form . "_" . $this->name])) {
116
-      return $_REQUEST[$this->form . "_" . $this->name];
115
+    if (isset($_REQUEST[$this->form."_".$this->name])) {
116
+      return $_REQUEST[$this->form."_".$this->name];
117 117
     }
118 118
     return $this->opt['default'];
119 119
   }
120 120
 
121 121
   function getInputAttStatic(&$atts, &$type, &$content) {
122
-    $atts['id'] = $atts['name'] = $this->form . "_" . $this->name;
122
+    $atts['id'] = $atts['name'] = $this->form."_".$this->name;
123 123
     $atts['type'] = "text";
124
-    $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this));
124
+    $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this));
125 125
   }
126 126
 
127 127
   function getInputAttDynamic(&$atts, &$type, &$content) {
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
   }
140 140
 
141 141
   function getLabelAttStatic(&$atts, &$type, &$content) {
142
-    $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this));
143
-    $atts["for"] = $this->form . "_" . $this->name;
142
+    $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this));
143
+    $atts["for"] = $this->form."_".$this->name;
144 144
     $content = array($this->opt['label']);
145 145
   }
146 146
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
   }
149 149
 
150 150
   function getHintAttStatic(&$atts, &$type, &$content) {
151
-    $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this));
151
+    $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this));
152 152
     $atts['class'][] = "hamleFormHint";
153 153
   }
154 154
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
   }
67 67
 
68 68
   function __call($name, $valarray) {
69
-    if (count($valarray) < 1) return $this->__get($name);
69
+    if (count($valarray) < 1) {
70
+      return $this->__get($name);
71
+    }
70 72
     $val = count($valarray) == 1 ? current($valarray) : $valarray;
71 73
     switch ($name) {
72 74
       case "name":
@@ -111,7 +113,9 @@  discard block
 block discarded – undo
111 113
   }
112 114
 
113 115
   function getValue() {
114
-    if (!is_null($this->setValue)) return $this->setValue;
116
+    if (!is_null($this->setValue)) {
117
+      return $this->setValue;
118
+    }
115 119
     if (isset($_REQUEST[$this->form . "_" . $this->name])) {
116 120
       return $_REQUEST[$this->form . "_" . $this->name];
117 121
     }
@@ -130,12 +134,15 @@  discard block
 block discarded – undo
130 134
     if (!$this->valid) {
131 135
       $atts['class'][] = "hamleFormError";
132 136
     }
133
-    if ($this->opt["disabled"])
134
-      $atts['disabled'] = "disabled";
135
-    if ($this->opt['required'])
136
-      $atts['required'] = "required";
137
-    if ($this->opt['help'])
138
-      $atts['title'] = $this->opt['help'];
137
+    if ($this->opt["disabled"]) {
138
+          $atts['disabled'] = "disabled";
139
+    }
140
+    if ($this->opt['required']) {
141
+          $atts['required'] = "required";
142
+    }
143
+    if ($this->opt['help']) {
144
+          $atts['title'] = $this->opt['help'];
145
+    }
139 146
   }
140 147
 
141 148
   function getLabelAttStatic(&$atts, &$type, &$content) {
@@ -173,10 +180,12 @@  discard block
 block discarded – undo
173 180
   function doProcess($submit) {
174 181
     if ($submit) {
175 182
       $value = $this->getValue();
176
-      if ($this->opt['required'])
177
-        $this->valid = $this->valid && strlen($value);
178
-      if ($this->opt['regex'])
179
-        $this->valid = $this->valid && preg_match($this->opt['regex'], $value);
183
+      if ($this->opt['required']) {
184
+              $this->valid = $this->valid && strlen($value);
185
+      }
186
+      if ($this->opt['regex']) {
187
+              $this->valid = $this->valid && preg_match($this->opt['regex'], $value);
188
+      }
180 189
     }
181 190
   }
182 191
 
Please login to merge, or discard this patch.