Completed
Push — master ( dbcc75...cf39b6 )
by Chris
06:21 queued 01:31
created
php/hamle/Tag/Form.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     foreach ($labelTags as $tag)
62 62
       if ($tag instanceOf Html)
63 63
         foreach ($tag->source as $source) {
64
-          if(isset($fields[$source]))
64
+          if (isset($fields[$source]))
65 65
             $fields[$source]->getLabelAttStatic($tag->opt, $tag->type, $tag->content);
66 66
           else
67 67
             $tag->opt['style'] = "display:none;";
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     foreach ($inputTags as $tag)
71 71
       if ($tag instanceOf Html)
72 72
         foreach ($tag->source as $source) {
73
-          if(isset($fields[$source]))
73
+          if (isset($fields[$source]))
74 74
             $fields[$source]->getHintAttStatic($tag->opt, $tag->type, $tag->content);
75 75
           else
76 76
             $tag->opt['style'] = "display:none;";
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     foreach ($inputTags as $tag)
80 80
       if ($tag instanceOf Html)
81 81
         foreach ($tag->source as $source) {
82
-          if(isset($fields[$source])) {
82
+          if (isset($fields[$source])) {
83 83
             $fields[$source]->getInputAttStatic($tag->opt, $tag->type, $tag->content);
84 84
             unset($fields[$source]);
85 85
           } else
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
         }
88 88
     foreach ($fields as $n => $f) {
89 89
       if (!$f instanceOf Button) {
90
-        $this->addChild($label = new DynHtml("label", [],[],"",$n));
90
+        $this->addChild($label = new DynHtml("label", [], [], "", $n));
91 91
         $f->getLabelAttStatic($label->opt, $label->type, $label->content);
92 92
       }
93
-      $this->addChild($input = new DynHtml("input", [],[],"",$n));
93
+      $this->addChild($input = new DynHtml("input", [], [], "", $n));
94 94
       $f->getInputAttStatic($input->opt, $input->type, $input->content);
95 95
     }
96
-    return "<form " . implode(" ", $out) . "><?php \$form = " . $this->var->toPHP() . "; \$form->process(); ?>";
96
+    return "<form ".implode(" ", $out)."><?php \$form = ".$this->var->toPHP()."; \$form->process(); ?>";
97 97
   }
98 98
 
99 99
   function renderEnTag() {
Please login to merge, or discard this patch.
php/hamle/Text/Comparison.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 
36 36
   function __construct($s, $mode = self::TOKEN_CONTROL) {
37 37
     $m = array();
38
-    if(preg_match('/^(.*) '.self::REGEX_COMP_OPER.' (.*)$/', $s, $m)) {
39
-      $this->param1 = new Text($m[1],Text::TOKEN_HTML);
40
-      $this->param2 = new Text($m[3],Text::TOKEN_HTML);
38
+    if (preg_match('/^(.*) '.self::REGEX_COMP_OPER.' (.*)$/', $s, $m)) {
39
+      $this->param1 = new Text($m[1], Text::TOKEN_HTML);
40
+      $this->param2 = new Text($m[3], Text::TOKEN_HTML);
41 41
       $this->operator = $m[2];
42 42
     } else
43
-      $this->param1 = new Text($s,Text::TOKEN_HTML);
43
+      $this->param1 = new Text($s, Text::TOKEN_HTML);
44 44
   }
45 45
 
46 46
 //  function __construct(String $p1, String $p2, $operator) {
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 //    $this->operator = $operator;
50 50
 //  }
51 51
   function toPHP() {
52
-    if(!$this->param2) return $this->param1->toPHP();
52
+    if (!$this->param2) return $this->param1->toPHP();
53 53
     $p1 = $this->param1->toPHP();
54 54
     $p2 = $this->param2->toPHP();
55
-    switch($this->operator) {
55
+    switch ($this->operator) {
56 56
       case "equals":
57 57
       case "equal":
58 58
         return $p1." == ".$p2;
Please login to merge, or discard this patch.
php/hamle/Text/FormField.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@
 block discarded – undo
35 35
   }
36 36
 
37 37
   function toPHP() {
38
-    return '$form->getField(' . Text::varToCode($this->var) . ')->getValue()';
38
+    return '$form->getField('.Text::varToCode($this->var).')->getValue()';
39 39
   }
40 40
 
41 41
   function toHTML($escape = false) {
42
-    return '<?=' . $this->toPHP() . '?>';
42
+    return '<?='.$this->toPHP().'?>';
43 43
   }
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Scope.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
       self::$namedScopes[$name]->rewind();
68 68
       return self::$namedScopes[$name];
69 69
     } else
70
-      if(self::$returnZeroOnNoScope)
70
+      if (self::$returnZeroOnNoScope)
71 71
         return new Model\Zero();
72 72
       throw new RunTime("Unable to find scope ($name)");
73 73
   }
Please login to merge, or discard this patch.
php/hamle/Field/Button.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,6 +42,6 @@
 block discarded – undo
42 42
   }
43 43
 
44 44
   function isClicked() {
45
-    return isset($_REQUEST[$this->form . "_" . $this->name]);
45
+    return isset($_REQUEST[$this->form."_".$this->name]);
46 46
   }
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Parse.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $i = self::indentLevel($indent);
158 158
         unset($m[0]);
159 159
         switch (strlen($code) ? $code[0] : ($textcode ? $textcode : "")) {
160
-          case "|": //Control Tag
160
+          case "|" : //Control Tag
161 161
             if ($code == "|snippet")
162 162
               $hTag = new Tag\Snippet($text);
163 163
             elseif ($code == "|form")
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
             break;
193 193
           default:
194 194
             $attr = array();
195
-            if(isset($params[0]) && $params[0] == "[") {
195
+            if (isset($params[0]) && $params[0] == "[") {
196 196
               $param = substr($params, 1, strlen($params) - 2);
197
-              $param = str_replace('+','%2B', $param);
198
-              $param = str_replace('\\&','%26', $param);
197
+              $param = str_replace('+', '%2B', $param);
198
+              $param = str_replace('\\&', '%26', $param);
199 199
 //              parse_str($param, $attr);
200 200
               $attr = $this->parseQueryString($param);
201 201
             }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
               if ($s[0] == ".") $class[] = substr($s, 1);
207 207
               if ($s[0] == "!") $ref = substr($s, 1);
208 208
             }
209
-            if($ref)
209
+            if ($ref)
210 210
               $hTag = new Tag\DynHtml($tag, $class, $attr, $id, $ref);
211 211
             else
212 212
               $hTag = new Tag\Html($tag, $class, $attr, $id);
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
         else
220 220
           $this->root[] = $hTag;
221 221
       } else
222
-        throw new ParseError("Unable to parse line {$this->lineNo}\n\"$line\"/" . preg_last_error());
222
+        throw new ParseError("Unable to parse line {$this->lineNo}\n\"$line\"/".preg_last_error());
223 223
       $this->lineNo++;
224 224
     }
225 225
   }
226 226
 
227 227
   function parseQueryString($qs) {
228 228
     $out = [];
229
-    foreach(explode('&',$qs) as $s) {
230
-      $kv = explode('=',$s,2);
231
-      $out[urldecode($kv[0])] = isset($kv[1])?urldecode($kv[1]):null;
229
+    foreach (explode('&', $qs) as $s) {
230
+      $kv = explode('=', $s, 2);
231
+      $out[urldecode($kv[0])] = isset($kv[1]) ?urldecode($kv[1]) : null;
232 232
     }
233 233
     return $out;
234 234
   }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     $m = array();
247 247
     while ($this->lineNo + 1 < $this->lineCount &&
248 248
         (!trim($this->lines[$this->lineNo + 1]) ||
249
-            preg_match('/^(\s){' . $indent . '}((\s)+[^\s].*)$/',
249
+            preg_match('/^(\s){'.$indent.'}((\s)+[^\s].*)$/',
250 250
                 $this->lines[$this->lineNo + 1], $m))) {
251 251
       if (trim($this->lines[$this->lineNo + 1]))
252 252
         $out[] = $m[2];
Please login to merge, or discard this patch.
php/hamle/Form.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     $this->setup();
55 55
     $fields = $this->_fields;
56 56
     $this->_fields = array();
57
-    foreach($fields as $v) {
57
+    foreach ($fields as $v) {
58 58
       $this->_fields[$v->name] = $v;
59 59
       $v->form($this->_name);
60 60
     }
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
   
65 65
   function process() {
66 66
     $clicked = "";
67
-    foreach($this->_fields as $f)
68
-      if($f instanceOf Field\Button)
69
-        if($f->isClicked())
67
+    foreach ($this->_fields as $f)
68
+      if ($f instanceOf Field\Button)
69
+        if ($f->isClicked())
70 70
           $clicked = $f;
71
-    foreach($this->_fields as $f)
72
-      $f->doProcess($clicked?true:false);
73
-    if($clicked)
71
+    foreach ($this->_fields as $f)
72
+      $f->doProcess($clicked ?true:false);
73
+    if ($clicked)
74 74
       try {
75 75
         $this->onSubmit($clicked);
76
-      } catch(Exception\FormInvalid $e) {
76
+      } catch (Exception\FormInvalid $e) {
77 77
         $this->hint = $e->getMessage();
78 78
       }
79 79
   }
80 80
   
81 81
   function isValid() {
82 82
     $valid = true;
83
-    foreach($this->_fields as $f)
83
+    foreach ($this->_fields as $f)
84 84
       $valid = $f->valid && $valid;
85 85
     return $valid;
86 86
   }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     return $this->_fields;
96 96
   }
97 97
   function getField($n) {
98
-    if(!isset($this->_fields[$n]))
98
+    if (!isset($this->_fields[$n]))
99 99
       throw new Exception\NoKey("unable to find form field ($n)");
100 100
     return $this->_fields[$n];
101 101
   }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
   }
105 105
   
106 106
   function getHTMLProp() {
107
-    return array('action'=>'','method'=>'post','name'=>$this->_name,
107
+    return array('action'=>'', 'method'=>'post', 'name'=>$this->_name,
108 108
                                         'enctype'=>'multipart/form-data');
109 109
   }
110 110
 
Please login to merge, or discard this patch.
php/hamle/Tag/Html.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
   function __construct($tag, $class = array(), $attr = array(), $id = "") {
43 43
     parent::__construct();
44 44
     $this->opt = $attr;
45
-    if(isset($attr['class']) && !is_array($attr['class']))
46
-      $this->opt['class'] = $attr['class']?explode(" ",$attr['class']):array();
45
+    if (isset($attr['class']) && !is_array($attr['class']))
46
+      $this->opt['class'] = $attr['class'] ?explode(" ", $attr['class']) : array();
47 47
     $this->source = array();
48 48
     $this->type = $tag ? $tag : "div";
49
-    if($class) {
49
+    if ($class) {
50 50
       if (isset($this->opt['class']))
51 51
         $this->opt['class'] = array_merge($this->opt['class'], $class);
52 52
       else
53 53
         $this->opt['class'] = $class;
54 54
     }
55
-    if($id) $this->opt['id'] = $id;
55
+    if ($id) $this->opt['id'] = $id;
56 56
   }
57 57
 
58 58
   function renderStTag() {
59 59
     $close = in_array($this->type, self::$selfCloseTags) ? " />" : ">";
60
-    return "<{$this->type}" . $this->optToTags() . $close;
60
+    return "<{$this->type}".$this->optToTags().$close;
61 61
   }
62 62
 
63 63
   function renderEnTag() {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
       if (!$v instanceof H\Text)
80 80
         $v = new H\Text($v);
81 81
       $k = new H\Text($k);
82
-      $out[] = " " . $k->toHTML() . "=\"" . $v->toHTMLAtt() . "\"";
82
+      $out[] = " ".$k->toHTML()."=\"".$v->toHTMLAtt()."\"";
83 83
     }
84 84
     return implode("", $out);
85 85
   }
Please login to merge, or discard this patch.
php/hamle/Text/Scope.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
   function __construct($s) {
37 37
     $m = [];
38 38
     //var_dump($s);
39
-    if(!preg_match('/\$\[(-?[0-9]+|[a-zA-Z][a-zA-Z0-9]+)\]/', $s, $m)) {
39
+    if (!preg_match('/\$\[(-?[0-9]+|[a-zA-Z][a-zA-Z0-9]+)\]/', $s, $m)) {
40 40
       throw new ParseError("Unable to match scope ($s)");
41 41
     }
42 42
     $this->scope = $m[1];
43 43
   }
44 44
 
45 45
   function toPHP() {
46
-    if(is_numeric($this->scope)) {
47
-      return "Hamle\\Scope::get(" . Text::varToCode($this->scope) . ")";
46
+    if (is_numeric($this->scope)) {
47
+      return "Hamle\\Scope::get(".Text::varToCode($this->scope).")";
48 48
     } else {
49
-      return "Hamle\\Scope::getName(" . Text::varToCode($this->scope) . ")";
49
+      return "Hamle\\Scope::getName(".Text::varToCode($this->scope).")";
50 50
     }
51 51
   }
52 52
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 
62 62
   function getOrCreateModel(Model $parent = null) {
63
-    if(is_numeric($this->scope)) {
63
+    if (is_numeric($this->scope)) {
64 64
       return \Seufert\Hamle\Scope::get($this->scope);
65 65
     }
66 66
     return \Seufert\Hamle\Scope::getName($this->scope);
Please login to merge, or discard this patch.