Test Failed
Pull Request — master (#3)
by Chris
02:30
created
php/hamle/Text/Func.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
    */
51 51
   public function __construct($s) {
52 52
     $m = array();
53
-    if (!preg_match('/^\$\((' . self::REGEX_FUNCSEL . '*)(.*)\)$/', $s, $m))
53
+    if (!preg_match('/^\$\(('.self::REGEX_FUNCSEL.'*)(.*)\)$/', $s, $m))
54 54
       throw new ParseError("Unable to read \$ func in '$s'");
55 55
     if (trim($m[2]))
56 56
       $this->sub = new FuncSub($m[2]);
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
     }
93 93
     $rand = false;
94 94
     if (preg_match_all('/\\^(-?)([a-zA-Z0-9_]*)/', $s, $m)) {
95
-      foreach($m[0] as $k=>$mv)
95
+      foreach ($m[0] as $k=>$mv)
96 96
         if ($m[2][$k]) {
97
-          $dir = $m[1][$k] == "-"?Hamle\Hamle::SORT_DESCENDING:Hamle\Hamle::SORT_ASCENDING;
97
+          $dir = $m[1][$k] == "-" ?Hamle\Hamle::SORT_DESCENDING : Hamle\Hamle::SORT_ASCENDING;
98 98
           $att['sort'][$m[2][$k]] = $dir;
99 99
         } else $rand = true;
100 100
     }
101
-    if($rand)
101
+    if ($rand)
102 102
       $att['sort'] = [""=>$att['dir'] = Hamle\Hamle::SORT_RANDOM];
103 103
     return $att;
104 104
   }
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
    * @return string PHP Code
117 117
    */
118 118
   public function toPHP() {
119
-    $sub = $this->sub ? "->" . $this->sub->toPHP() : "";
120
-    if($this->scope instanceof Scope) {
121
-      return $this->scope->toPHP() . $sub;
122
-    } elseif($this->scope === true) {
119
+    $sub = $this->sub ? "->".$this->sub->toPHP() : "";
120
+    if ($this->scope instanceof Scope) {
121
+      return $this->scope->toPHP().$sub;
122
+    } elseif ($this->scope === true) {
123 123
       return "Hamle\\Scope::get(0)$sub";
124 124
     }
125
-    $limit = Text::varToCode($this->sortlimit['sort']) . "," .
126
-        $this->sortlimit['limit'] . "," . $this->sortlimit['offset'];
125
+    $limit = Text::varToCode($this->sortlimit['sort']).",".
126
+        $this->sortlimit['limit'].",".$this->sortlimit['offset'];
127 127
     if (count($this->filt['tag']))
128
-      return "Hamle\\Run::modelTypeTags(" .
129
-      Text::varToCode($this->filt['tag']) . ",$limit)$sub";
128
+      return "Hamle\\Run::modelTypeTags(".
129
+      Text::varToCode($this->filt['tag']).",$limit)$sub";
130 130
     if (count($this->filt['id']))
131 131
       if (isset($this->filt['id']['*']) && count($this->filt['id']['*']) == 1)
132
-        return "Hamle\\Run::modelId(" .
133
-        Text::varToCode(current($this->filt['id']['*'])) .
132
+        return "Hamle\\Run::modelId(".
133
+        Text::varToCode(current($this->filt['id']['*'])).
134 134
         ",$limit)$sub";
135 135
       else
136
-        return "Hamle\\Run::modelTypeId(" .
137
-        Text::varToCode($this->filt['id']) . ",$limit)$sub";
136
+        return "Hamle\\Run::modelTypeId(".
137
+        Text::varToCode($this->filt['id']).",$limit)$sub";
138 138
     return "";
139 139
   }
140 140
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
    * @return Model
144 144
    */
145 145
   public function getOrCreateModel(Model $parent = null) {
146
-    if($this->scope instanceof Scope) {
146
+    if ($this->scope instanceof Scope) {
147 147
       $parent = $this->scope->getOrCreateModel();
148 148
     } elseif ($this->scope === true)
149 149
       $parent = \Seufert\Hamle\Scope::get(0);
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
           $this->sortlimit['limit'],
170 170
           $this->sortlimit['offset']
171 171
         );
172
-    if($this->sub)
172
+    if ($this->sub)
173 173
       return $this->sub->getOrCreateModel($parent)->current();
174
-    if(!$parent)
174
+    if (!$parent)
175 175
       throw new \RuntimeException('Unable to create model with no relation');
176 176
     return $parent->current();
177 177
   }
Please login to merge, or discard this patch.
php/hamle/Text/Complex.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
   protected $filter;
38 38
 
39 39
   function __construct($s) {
40
-    if(FALSE !== $pos = strpos($s,'|')) {
41
-      $this->filter = new Filter(substr($s, $pos+1), $this);
42
-      $s = substr($s,0,$pos);
40
+    if (FALSE !== $pos = strpos($s, '|')) {
41
+      $this->filter = new Filter(substr($s, $pos + 1), $this);
42
+      $s = substr($s, 0, $pos);
43 43
     }
44 44
     $s = preg_split("/-[>!]/", $s);
45 45
     // if(count($s) == 1) $s = explode("-!",$s[0]);
@@ -55,27 +55,27 @@  discard block
 block discarded – undo
55 55
   }
56 56
 
57 57
   function toHTML($escape = false) {
58
-    if($escape)
59
-      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
60
-    return "<?=" . $this->toPHP() . "?>";
58
+    if ($escape)
59
+      return "<?=htmlspecialchars(".$this->toPHP().")?>";
60
+    return "<?=".$this->toPHP()."?>";
61 61
   }
62 62
   function toPHP() {
63
-    return $this->filter?$this->filter->toPHP():$this->toPHPVar();
63
+    return $this->filter ? $this->filter->toPHP() : $this->toPHPVar();
64 64
   }
65 65
   function toPHPVar() {
66 66
     if ($this->sel) {
67 67
       $sel = array();
68 68
       foreach ($this->sel as $s)
69 69
         $sel[] = "hamleGet('$s')";
70
-      return $this->func->toPHP() . "->" . implode('->', $sel);
70
+      return $this->func->toPHP()."->".implode('->', $sel);
71 71
     } else
72 72
       return $this->func->toPHP();
73 73
   }
74 74
 
75 75
   function getOrCreateModel(Model $parent = null) {
76
-    if($this->func instanceof Text\Scope)
76
+    if ($this->func instanceof Text\Scope)
77 77
       return $this->func->getOrCreateModel($parent);
78
-    if($this->func instanceof Text\Func)
78
+    if ($this->func instanceof Text\Func)
79 79
       return $this->func->getOrCreateModel($parent);
80 80
     throw new RuntimeException('Unsupported func type encountered:'.get_class($this->func));
81 81
   }
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
    * @return WriteModel
86 86
    */
87 87
   function setValue($value) {
88
-    if(!$this->sel || count($this->sel) != 1)
88
+    if (!$this->sel || count($this->sel) != 1)
89 89
       throw new RuntimeException('Can only set values, when one var name is present');
90 90
     $model = $this->getOrCreateModel();
91
-    if(!$model instanceof WriteModel)
91
+    if (!$model instanceof WriteModel)
92 92
       throw new RuntimeException('Can only set values on WriteModel, got '.get_class($model));
93 93
     $model->hamleSet($this->sel[0], $value);
94 94
     return $model;
Please login to merge, or discard this patch.
php/hamle/Scope.php 1 patch
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.
php/hamle/Parse.php 1 patch
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.
php/hamle/Field.php 1 patch
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.
php/hamle/Text.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   const FIND_DOLLARVAR = 0x02;
52 52
   const FIND_BARDOLLAR = 0x04;
53 53
 
54
-  const START_RULE_MAP = [self::TOKEN_HTML => 'HtmlInput', self::TOKEN_CODE => 'CodeInput',self::TOKEN_CONTROL => 'ControlInput'];
54
+  const START_RULE_MAP = [self::TOKEN_HTML => 'HtmlInput', self::TOKEN_CODE => 'CodeInput', self::TOKEN_CONTROL => 'ControlInput'];
55 55
 
56 56
   protected $mode;
57 57
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
   {
62 62
 //    var_dump($s);
63 63
     $this->mode = $mode;
64
-    $this->tree = (new Parser())->parse($s,['startRule' => self::START_RULE_MAP[$mode]]);
64
+    $this->tree = (new Parser())->parse($s, ['startRule' => self::START_RULE_MAP[$mode]]);
65 65
 //    var_dump($this->tree);
66
-    if(!$this->tree instanceof Doc) {
66
+    if (!$this->tree instanceof Doc) {
67 67
       $this->tree = new Doc(is_array($this->tree) ? $this->tree : [$this->tree]);
68 68
     }
69 69
 //    $m = [];
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
   {
115 115
     $func = $filter['func'];
116 116
     if (method_exists(Filter::class, $func)) {
117
-      $func = Filter::class . '::' . $func;
117
+      $func = Filter::class.'::'.$func;
118 118
     } elseif (in_array($func, ['round', 'strtoupper', 'strtolower', 'ucfirst'])) {
119 119
     } elseif ($func === 'json') {
120 120
       $func = 'json_encode';
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
       throw new ParseError("Unknown Filter Type \"{$func}\"");
125 125
     }
126 126
     $args = join(',', array_map(function($v) {
127
-      if(is_array($v) && $v['type'] ?? false === 'expr') {
127
+      if (is_array($v) && $v['type'] ?? false === 'expr') {
128 128
         return self::renderExpr($v);
129 129
       } else
130 130
         return self::varToCode($v);
131 131
     } , $filter['args']));
132
-    if(strlen($args)) $args = ','.$args;
133
-    $o = "$func($o" . $args . ")";
134
-    if($filter['chain'] ?? false) {
132
+    if (strlen($args)) $args = ','.$args;
133
+    $o = "$func($o".$args.")";
134
+    if ($filter['chain'] ?? false) {
135 135
       $o = self::addFilter($o, $filter['chain']);
136 136
     }
137 137
     return $o;
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
 
140 140
   static function renderScopeThis($n)
141 141
   {
142
-    $o = 'Hamle\Scope::get()->hamleGet(' . self::varToCode($n['name']) . ')';
142
+    $o = 'Hamle\Scope::get()->hamleGet('.self::varToCode($n['name']).')';
143 143
     $o = self::addParams($o, $n['param'] ?? []);
144 144
     return $o;
145 145
   }
146 146
 
147 147
   static function renderScopeId($n)
148 148
   {
149
-    $o = 'Hamle\Scope::get(' . $n['id'] . ')';
149
+    $o = 'Hamle\Scope::get('.$n['id'].')';
150 150
     $o = self::addParams($o, $n['param'] ?? []);
151 151
     return $o;
152 152
   }
153 153
 
154 154
   static function renderScopeName($n)
155 155
   {
156
-    $o = 'Hamle\Scope::getName(' . self::varToCode($n['name']) . ')';
156
+    $o = 'Hamle\Scope::getName('.self::varToCode($n['name']).')';
157 157
     $o = self::addParams($o, $n['param'] ?? []);
158 158
     return $o;
159 159
   }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
   static function addParams(string $o, array $params)
162 162
   {
163 163
     while ($params['type'] ?? null === 'sub') {
164
-      $o .= '->hamleGet(' . self::varToCode($params['name']) . ')';
164
+      $o .= '->hamleGet('.self::varToCode($params['name']).')';
165 165
       $params = $params['params'] ?? [];
166 166
     }
167 167
     return $o;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
   static function addRel(string $o, array $query, string $rel): string
171 171
   {
172 172
     $r = $rel === 'child' ? Hamle::REL_CHILD : Hamle::REL_PARENT;
173
-    $o = $o . "->hamleRel(" . self::varToCode($r) . ',' . self::queryParams($query, true) . ')';
173
+    $o = $o."->hamleRel(".self::varToCode($r).','.self::queryParams($query, true).')';
174 174
     return $o;
175 175
   }
176 176
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
       self::varToCode($limit),
231 231
       self::varToCode($offset)
232 232
     ];
233
-    return 'Hamle\Run::modelTypeId(' . join(',', $opt) . ')';
233
+    return 'Hamle\Run::modelTypeId('.join(',', $opt).')';
234 234
   }
235 235
 
236 236
   static function renderQuery($n)
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     } elseif ($id !== null) {
250 250
       $o = self::queryId($n['query']);
251 251
     } else {
252
-      $o = 'Hamle\Run::modelTypeTags(' . self::queryParams($n['query']) . ')';
252
+      $o = 'Hamle\Run::modelTypeTags('.self::queryParams($n['query']).')';
253 253
     }
254 254
     if ($n['sub'] ?? []) {
255 255
       $o = self::addRel($o, $n['sub'], $n['rel']);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $o = self::renderQuery($expr['body']);
277 277
         break;
278 278
       default:
279
-        throw new \RuntimeException('Invalid Node: ' . $expr['body']['type']);
279
+        throw new \RuntimeException('Invalid Node: '.$expr['body']['type']);
280 280
     }
281 281
     if ($expr['body']['filter'] ?? false) {
282 282
       $o = self::addFilter($o, $expr['body']['filter']);
@@ -295,16 +295,16 @@  discard block
 block discarded – undo
295 295
             $out .= $node['body'];
296 296
           break;
297 297
         case 'scopeName':
298
-          $out .= '<?=' . self::renderScopeName($node) . '?>';
298
+          $out .= '<?='.self::renderScopeName($node).'?>';
299 299
           break;
300 300
         case 'scopeThis':
301
-          $out .= '<?=' . self::renderScopeThis($node) . '?>';
301
+          $out .= '<?='.self::renderScopeThis($node).'?>';
302 302
           break;
303 303
         case 'expr':
304
-          $out .= '<?=' . self::renderExpr($node) . "?>";
304
+          $out .= '<?='.self::renderExpr($node)."?>";
305 305
           break;
306 306
         default:
307
-          throw new \RuntimeException('Invalid Node:' . $node['type']);
307
+          throw new \RuntimeException('Invalid Node:'.$node['type']);
308 308
       }
309 309
     }
310 310
     return $out;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
           $out [] = self::renderExpr($node);
333 333
           break;
334 334
         default:
335
-          throw new \RuntimeException('Invalid Node:' . $node['type']);
335
+          throw new \RuntimeException('Invalid Node:'.$node['type']);
336 336
       }
337 337
     }
338 338
     return join('.', $out);
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
   function doEval()
342 342
   {
343
-    return eval('use Seufert\Hamle; return ' . $this->toPHP() . ';');
343
+    return eval('use Seufert\Hamle; return '.$this->toPHP().';');
344 344
   }
345 345
 
346 346
   static function varToCode($var)
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
     if (is_array($var)) {
349 349
       $code = [];
350 350
       foreach ($var as $key => $value) {
351
-        $code[] = self::varToCode($key) . '=>' . self::varToCode($value);
351
+        $code[] = self::varToCode($key).'=>'.self::varToCode($value);
352 352
       }
353
-      return 'array(' . implode(',', $code) . ')'; //remove unnecessary coma
353
+      return 'array('.implode(',', $code).')'; //remove unnecessary coma
354 354
     }
355 355
     if (is_bool($var)) {
356 356
       return ($var ? 'TRUE' : 'FALSE');
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     if ($var instanceof Text) {
362 362
       return $var->toPHP();
363 363
     }
364
-    return "'" . str_replace(['$', "'"], ['$', "\\'"], $var) . "'";
364
+    return "'".str_replace(['$', "'"], ['$', "\\'"], $var)."'";
365 365
   }
366 366
 
367 367
   /**
Please login to merge, or discard this patch.
php/hamle/Tag/Control.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
    */
48 48
   function __construct($tag, $parentTag = null) {
49 49
     parent::__construct();
50
-    $this->o = "\$o" . self::$instCount++;
50
+    $this->o = "\$o".self::$instCount++;
51 51
     $this->type = strtolower($tag);
52 52
     $this->var = "";
53 53
     if ($parentTag && $this->type == "else") {
54
-      if($parentTag instanceof H\Tag) {
54
+      if ($parentTag instanceof H\Tag) {
55 55
         $elseTag = $parentTag->tags[count($parentTag->tags) - 1];
56
-        if($elseTag instanceof H\Tag\Control &&
56
+        if ($elseTag instanceof H\Tag\Control &&
57 57
             in_array($elseTag->type, array('with', 'if'))
58 58
         ) {
59 59
           $elseTag->else = true;
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
   }
68 68
 
69 69
   function renderStTag() {
70
-    $out = "<" . "?php ";
70
+    $out = "<"."?php ";
71 71
     $scopeName = "";
72
-    if($this->type === 'if') {
72
+    if ($this->type === 'if') {
73 73
       $hsvcomp = new H\Text\Comparison($this->var);
74
-      $out .= "if(" . $hsvcomp->toPHP() . ") {";
74
+      $out .= "if(".$hsvcomp->toPHP().") {";
75 75
       return $out."\n?>";
76
-    } elseif($this->type === 'else') {
76
+    } elseif ($this->type === 'else') {
77 77
       $out .= "/* else */";
78 78
       return $out."\n?>";
79 79
     }
80
-    if($this->var) {
80
+    if ($this->var) {
81 81
       if (preg_match('/ as ([a-zA-Z]+)$/', $this->var, $m)) {
82 82
         $scopeName = $m[1];
83 83
         $lookup = substr($this->var, 0, strlen($this->var) - strlen($m[0]));
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
     switch ($this->type) {
89 89
       case "each":
90 90
         if ($this->var)
91
-          $out .= "foreach(" . $hsv->toPHP() . " as {$this->o}) { \n";
91
+          $out .= "foreach(".$hsv->toPHP()." as {$this->o}) { \n";
92 92
         else
93 93
           $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n";
94 94
         $out .= "Hamle\\Scope::add({$this->o}); ";
95 95
         break;
96 96
       case "with":
97 97
         if ($scopeName)
98
-          $out .= "Hamle\\Scope::add(" . $hsv->toPHP() . ", \"$scopeName\");\n;";
98
+          $out .= "Hamle\\Scope::add(".$hsv->toPHP().", \"$scopeName\");\n;";
99 99
         else {
100
-          $out .= "if(({$this->o} = " . $hsv->toPHP() . ") && " .
100
+          $out .= "if(({$this->o} = ".$hsv->toPHP().") && ".
101 101
               "{$this->o}->valid()) {\n";
102 102
           $out .= "Hamle\\Scope::add({$this->o});\n;";
103 103
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $fn = $file[0] === '#' ? 'includeFragment' : 'includeFile';
108 108
         $out .= "echo Hamle\\Run::$fn({$hsv->toPHP()});";
109 109
     }
110
-    return $out . "\n?>";
110
+    return $out."\n?>";
111 111
   }
112 112
 
113 113
   /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   }
119 119
 
120 120
   function renderEnTag() {
121
-    $out = '<' . '?php ';
121
+    $out = '<'.'?php ';
122 122
     switch ($this->type) {
123 123
       case "each";
124 124
         $out .= 'Hamle\\Scope::done(); ';
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         break;
142 142
     }
143 143
     if ($this->else) $out .= "else{";
144
-    return $out . "\n?>";
144
+    return $out."\n?>";
145 145
   }
146 146
 
147 147
   function render($indent = 0, $minify = false) {
Please login to merge, or discard this patch.
php/hamle/Grammar/Parser.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     private $peg_currPos          = 0;
68 68
     private $peg_reportedPos      = 0;
69 69
     private $peg_cachedPos        = 0;
70
-    private $peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false );
70
+    private $peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false);
71 71
     private $peg_maxFailPos       = 0;
72 72
     private $peg_maxFailExpected  = array();
73 73
     private $peg_silentFails      = 0;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
       $this->peg_currPos          = 0;
79 79
       $this->peg_reportedPos      = 0;
80 80
       $this->peg_cachedPos        = 0;
81
-      $this->peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false );
81
+      $this->peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false);
82 82
       $this->peg_maxFailPos       = 0;
83 83
       $this->peg_maxFailExpected  = array();
84 84
       $this->peg_silentFails      = 0;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     private function expected($description) {
122 122
       throw $this->peg_buildException(
123 123
         null,
124
-        array(array("type" => "other", "description" => $description )),
124
+        array(array("type" => "other", "description" => $description)),
125 125
         $this->peg_reportedPos
126 126
       );
127 127
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
       if ($this->peg_cachedPos !== $pos) {
153 153
         if ($this->peg_cachedPos > $pos) {
154 154
           $this->peg_cachedPos = 0;
155
-          $this->peg_cachedPosDetails = array( "line" => 1, "column" => 1, "seenCR" => false );
155
+          $this->peg_cachedPosDetails = array("line" => 1, "column" => 1, "seenCR" => false);
156 156
         }
157 157
         $this->peg_advancePos($this->peg_cachedPosDetails, $this->peg_cachedPos, $pos);
158 158
         $this->peg_cachedPos = $pos;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
         $foundDesc = $found ? json_encode($found) : "end of input";
215 215
 
216
-        $message = "Expected " . $expectedDesc . " but " . $foundDesc . " found.";
216
+        $message = "Expected ".$expectedDesc." but ".$foundDesc." found.";
217 217
       }
218 218
 
219 219
       return new SyntaxError(
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
                                                   array_walk_recursive($i, function($a) use (&$return) { $return[] = $a; });
303 303
                                                   return $return;
304 304
                                          }
305
-    private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('',$text)); }
305
+    private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('', $text)); }
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) return $expr;
310 310
                            $top = array_pop($chain);
311
-                           while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); }
311
+                           while ($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); }
312 312
     private function peg_f6($sub) { return $sub; }
313 313
     private function peg_f7($filter) { return $filter; }
314 314
     private function peg_f8($name) { return new \Seufert\Hamle\TextNode\ModelParam($name, null); }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     private function peg_f15($query) { return new \Seufert\Hamle\TextNode\Query($query); }
322 322
     private function peg_f16($id, $query) { return array_merge([['q'=>'type', 'id'=> $id]], $query); }
323 323
     private function peg_f17($query) { return array_merge([['q'=>'type', 'id'=> '*']], $query); }
324
-    private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for($rel, $sub); }
324
+    private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for ($rel, $sub); }
325 325
     private function peg_f19($id) { return ['q'=>'id', 'id'=> $id]; }
326 326
     private function peg_f20($id) { return ['q'=>'type', 'id'=> $id]; }
327 327
     private function peg_f21($id) { return ['q'=>'tag', 'id'=> $id]; }
@@ -335,19 +335,19 @@  discard block
 block discarded – undo
335 335
     private function peg_f29($func, $args) { return new \Seufert\Hamle\TextNode\FilterFunc($func, null, $args); }
336 336
     private function peg_f30($func) { return new \Seufert\Hamle\TextNode\FilterFunc($func); }
337 337
     private function peg_f31($arg) { return $arg; }
338
-    private function peg_f32($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float)"$s$n.$d"); }
338
+    private function peg_f32($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float) "$s$n.$d"); }
339 339
     private function peg_f33($parts) { return new \Seufert\Hamle\TextNode\StringLit($parts[1]); }
340 340
     private function peg_f34($chars) { return join('', $chars); }
341 341
     private function peg_f35($char_) { return $char_; }
342 342
     private function peg_f36($sequence) { return $sequence; }
343 343
     private function peg_f37($char) { return $char; }
344
-    private function peg_f38($n) { return (int)join('', $n); }
345
-    private function peg_f39($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int)($sign.join('', $n))); }
346
-    private function peg_f40($name) { return join('',$name); }
344
+    private function peg_f38($n) { return (int) join('', $n); }
345
+    private function peg_f39($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int) ($sign.join('', $n))); }
346
+    private function peg_f40($name) { return join('', $name); }
347 347
     private function peg_f41($p, $s) { return $p.join('', $s); }
348 348
     private function peg_f42($s) { return join('', $s); }
349 349
     private function peg_f43($c) { return $c; }
350
-    private function peg_f44($char_) { return str_replace(['n', 'r', 't'], ['\\n','\\r','\\t'], $char_); }
350
+    private function peg_f44($char_) { return str_replace(['n', 'r', 't'], ['\\n', '\\r', '\\t'], $char_); }
351 351
 
352 352
     private function peg_parseHtmlInput() {
353 353
 
@@ -2715,77 +2715,77 @@  discard block
 block discarded – undo
2715 2715
 
2716 2716
     $this->peg_FAILED = new \stdClass;
2717 2717
     $this->peg_c0 = "{";
2718
-    $this->peg_c1 = array( "type" => "literal", "value" => "{", "description" => "\"{\"" );
2718
+    $this->peg_c1 = array("type" => "literal", "value" => "{", "description" => "\"{\"");
2719 2719
     $this->peg_c2 = "}";
2720
-    $this->peg_c3 = array( "type" => "literal", "value" => "}", "description" => "\"}\"" );
2720
+    $this->peg_c3 = array("type" => "literal", "value" => "}", "description" => "\"}\"");
2721 2721
     $this->peg_c4 = "$";
2722
-    $this->peg_c5 = array( "type" => "literal", "value" => "$", "description" => "\"$\"" );
2722
+    $this->peg_c5 = array("type" => "literal", "value" => "$", "description" => "\"$\"");
2723 2723
     $this->peg_c6 = "|";
2724
-    $this->peg_c7 = array( "type" => "literal", "value" => "|", "description" => "\"|\"" );
2724
+    $this->peg_c7 = array("type" => "literal", "value" => "|", "description" => "\"|\"");
2725 2725
     $this->peg_c8 = "(";
2726
-    $this->peg_c9 = array( "type" => "literal", "value" => "(", "description" => "\"(\"" );
2726
+    $this->peg_c9 = array("type" => "literal", "value" => "(", "description" => "\"(\"");
2727 2727
     $this->peg_c10 = ")";
2728
-    $this->peg_c11 = array( "type" => "literal", "value" => ")", "description" => "\")\"" );
2728
+    $this->peg_c11 = array("type" => "literal", "value" => ")", "description" => "\")\"");
2729 2729
     $this->peg_c12 = "[";
2730
-    $this->peg_c13 = array( "type" => "literal", "value" => "[", "description" => "\"[\"" );
2730
+    $this->peg_c13 = array("type" => "literal", "value" => "[", "description" => "\"[\"");
2731 2731
     $this->peg_c14 = "]";
2732
-    $this->peg_c15 = array( "type" => "literal", "value" => "]", "description" => "\"]\"" );
2732
+    $this->peg_c15 = array("type" => "literal", "value" => "]", "description" => "\"]\"");
2733 2733
     $this->peg_c16 = "*";
2734
-    $this->peg_c17 = array( "type" => "literal", "value" => "*", "description" => "\"*\"" );
2734
+    $this->peg_c17 = array("type" => "literal", "value" => "*", "description" => "\"*\"");
2735 2735
     $this->peg_c18 = " ";
2736
-    $this->peg_c19 = array( "type" => "literal", "value" => " ", "description" => "\" \"" );
2736
+    $this->peg_c19 = array("type" => "literal", "value" => " ", "description" => "\" \"");
2737 2737
     $this->peg_c20 = "/^[><]/";
2738
-    $this->peg_c21 = array( "type" => "class", "value" => "[><]", "description" => "[><]" );
2738
+    $this->peg_c21 = array("type" => "class", "value" => "[><]", "description" => "[><]");
2739 2739
     $this->peg_c22 = "#";
2740
-    $this->peg_c23 = array( "type" => "literal", "value" => "#", "description" => "\"#\"" );
2740
+    $this->peg_c23 = array("type" => "literal", "value" => "#", "description" => "\"#\"");
2741 2741
     $this->peg_c24 = ",";
2742
-    $this->peg_c25 = array( "type" => "literal", "value" => ",", "description" => "\",\"" );
2742
+    $this->peg_c25 = array("type" => "literal", "value" => ",", "description" => "\",\"");
2743 2743
     $this->peg_c26 = ".";
2744
-    $this->peg_c27 = array( "type" => "literal", "value" => ".", "description" => "\".\"" );
2744
+    $this->peg_c27 = array("type" => "literal", "value" => ".", "description" => "\".\"");
2745 2745
     $this->peg_c28 = "^";
2746
-    $this->peg_c29 = array( "type" => "literal", "value" => "^", "description" => "\"^\"" );
2746
+    $this->peg_c29 = array("type" => "literal", "value" => "^", "description" => "\"^\"");
2747 2747
     $this->peg_c30 = "@";
2748
-    $this->peg_c31 = array( "type" => "literal", "value" => "@", "description" => "\"@\"" );
2748
+    $this->peg_c31 = array("type" => "literal", "value" => "@", "description" => "\"@\"");
2749 2749
     $this->peg_c32 = ":";
2750
-    $this->peg_c33 = array( "type" => "literal", "value" => ":", "description" => "\":\"" );
2750
+    $this->peg_c33 = array("type" => "literal", "value" => ":", "description" => "\":\"");
2751 2751
     $this->peg_c34 = "-";
2752
-    $this->peg_c35 = array( "type" => "literal", "value" => "-", "description" => "\"-\"" );
2752
+    $this->peg_c35 = array("type" => "literal", "value" => "-", "description" => "\"-\"");
2753 2753
     $this->peg_c36 = ">";
2754
-    $this->peg_c37 = array( "type" => "literal", "value" => ">", "description" => "\">\"" );
2754
+    $this->peg_c37 = array("type" => "literal", "value" => ">", "description" => "\">\"");
2755 2755
     $this->peg_c38 = "!";
2756
-    $this->peg_c39 = array( "type" => "literal", "value" => "!", "description" => "\"!\"" );
2756
+    $this->peg_c39 = array("type" => "literal", "value" => "!", "description" => "\"!\"");
2757 2757
     $this->peg_c40 = "/^[0-9]/";
2758
-    $this->peg_c41 = array( "type" => "class", "value" => "[0-9]", "description" => "[0-9]" );
2759
-    $this->peg_c42 = array("type" => "other", "description" => "string" );
2758
+    $this->peg_c41 = array("type" => "class", "value" => "[0-9]", "description" => "[0-9]");
2759
+    $this->peg_c42 = array("type" => "other", "description" => "string");
2760 2760
     $this->peg_c43 = "\"";
2761
-    $this->peg_c44 = array( "type" => "literal", "value" => "\"", "description" => "\"\\\"\"" );
2761
+    $this->peg_c44 = array("type" => "literal", "value" => "\"", "description" => "\"\\\"\"");
2762 2762
     $this->peg_c45 = "'";
2763
-    $this->peg_c46 = array( "type" => "literal", "value" => "'", "description" => "\"'\"" );
2763
+    $this->peg_c46 = array("type" => "literal", "value" => "'", "description" => "\"'\"");
2764 2764
     $this->peg_c47 = "\\";
2765
-    $this->peg_c48 = array( "type" => "literal", "value" => "\\", "description" => "\"\\\\\"" );
2766
-    $this->peg_c49 = array("type" => "any", "description" => "any character" );
2765
+    $this->peg_c48 = array("type" => "literal", "value" => "\\", "description" => "\"\\\\\"");
2766
+    $this->peg_c49 = array("type" => "any", "description" => "any character");
2767 2767
     $this->peg_c50 = "/^[a-zA-Z_]/";
2768
-    $this->peg_c51 = array( "type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]" );
2768
+    $this->peg_c51 = array("type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]");
2769 2769
     $this->peg_c52 = "/^[a-zA-Z_-]/";
2770
-    $this->peg_c53 = array( "type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]" );
2770
+    $this->peg_c53 = array("type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]");
2771 2771
     $this->peg_c54 = "/^[0-9a-zA-Z_-]/";
2772
-    $this->peg_c55 = array( "type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]" );
2772
+    $this->peg_c55 = array("type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]");
2773 2773
     $this->peg_c56 = "/^[^{\\\$]/";
2774
-    $this->peg_c57 = array( "type" => "class", "value" => "[{\$]", "description" => "[{\$]" );
2774
+    $this->peg_c57 = array("type" => "class", "value" => "[{\$]", "description" => "[{\$]");
2775 2775
     $this->peg_c58 = "/^[a-z]/";
2776
-    $this->peg_c59 = array( "type" => "class", "value" => "[a-z]", "description" => "[a-z]" );
2776
+    $this->peg_c59 = array("type" => "class", "value" => "[a-z]", "description" => "[a-z]");
2777 2777
     $this->peg_c60 = "/^[^{]/";
2778
-    $this->peg_c61 = array( "type" => "class", "value" => "[{]", "description" => "[{]" );
2778
+    $this->peg_c61 = array("type" => "class", "value" => "[{]", "description" => "[{]");
2779 2779
     $this->peg_c62 = "/^[\\n\\r\\x{2028}\\x{2029}]/";
2780
-    $this->peg_c63 = array( "type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]" );
2780
+    $this->peg_c63 = array("type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]");
2781 2781
     $this->peg_c64 = "/^['\"\\\\bfnrtv]/";
2782
-    $this->peg_c65 = array( "type" => "class", "value" => "['\"\\bfnrtv]", "description" => "['\"\\bfnrtv]" );
2782
+    $this->peg_c65 = array("type" => "class", "value" => "['\"\\bfnrtv]", "description" => "['\"\\bfnrtv]");
2783 2783
 
2784
-    $peg_startRuleFunctions = array( 'HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput") );
2784
+    $peg_startRuleFunctions = array('HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput"));
2785 2785
     $peg_startRuleFunction  = array($this, "peg_parseHtmlInput");
2786 2786
     if (isset($options["startRule"])) {
2787 2787
       if (!(isset($peg_startRuleFunctions[$options["startRule"]]))) {
2788
-        throw new \Exception("Can't start parsing from rule \"" + $options["startRule"] + "\".");
2788
+        throw new \Exception("Can't start parsing from rule \"" +$options["startRule"] + "\".");
2789 2789
       }
2790 2790
 
2791 2791
       $peg_startRuleFunction = $peg_startRuleFunctions[$options["startRule"]];
@@ -2799,7 +2799,7 @@  discard block
 block discarded – undo
2799 2799
       return $peg_result;
2800 2800
     } else {
2801 2801
       if ($peg_result !== $this->peg_FAILED && $this->peg_currPos < $this->input_length) {
2802
-        $this->peg_fail(array("type" => "end", "description" => "end of input" ));
2802
+        $this->peg_fail(array("type" => "end", "description" => "end of input"));
2803 2803
       }
2804 2804
 
2805 2805
       $exception = $this->peg_buildException(null, $this->peg_maxFailExpected, $this->peg_maxFailPos);
Please login to merge, or discard this patch.
php/hamle/Text/Filter.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -47,23 +47,23 @@  discard block
 block discarded – undo
47 47
 
48 48
   function __construct($s, Text $what) {
49 49
     var_dump($s, $what);
50
-    if(preg_match("/^([a-z_]+)(?:\\((?P<vars>.*)\\))?(?:\\|(?P<chained>.+?))?$/", $s, $m)) {
50
+    if (preg_match("/^([a-z_]+)(?:\\((?P<vars>.*)\\))?(?:\\|(?P<chained>.+?))?$/", $s, $m)) {
51 51
       $this->filter = $m[1];
52 52
       $this->vars = isset($m['vars']) && strlen($m['vars']) ? explode(',', $m['vars']) : [];
53
-      foreach($this->vars as $k=>$v)
54
-        $this->vars[$k] = str_replace("&comma;",',',$v);
55
-      if(isset($m['chained']) && strlen($m['chained'])) {
56
-        $this->chained = new Filter($m['chained'],$what);
53
+      foreach ($this->vars as $k=>$v)
54
+        $this->vars[$k] = str_replace("&comma;", ',', $v);
55
+      if (isset($m['chained']) && strlen($m['chained'])) {
56
+        $this->chained = new Filter($m['chained'], $what);
57 57
       }
58 58
     } else {
59 59
       throw new ParseError("Unable to parse filter expression \"$s\"");
60 60
     }
61
-    if(method_exists(Filter::class, $this->filter)) {
61
+    if (method_exists(Filter::class, $this->filter)) {
62 62
       $this->filter = Filter::class.'::'.$this->filter;
63
-    } elseif(in_array($this->filter, ['round', 'strtoupper', 'strtolower', 'ucfirst'])) {
64
-    } elseif($this->filter === 'json') {
63
+    } elseif (in_array($this->filter, ['round', 'strtoupper', 'strtolower', 'ucfirst'])) {
64
+    } elseif ($this->filter === 'json') {
65 65
       $this->filter = 'json_encode';
66
-    } elseif(self::$filterResolver && $filter = (self::$filterResolver)($this->filter)) {
66
+    } elseif (self::$filterResolver && $filter = (self::$filterResolver)($this->filter)) {
67 67
       $this->filter = $filter;
68 68
     } else {
69 69
       throw new ParseError("Unknown Filter Type \"{$this->filter}\"");
@@ -72,24 +72,24 @@  discard block
 block discarded – undo
72 72
   }
73 73
 
74 74
   function toHTML($escape = false) {
75
-    if($escape)
76
-      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
77
-    return "<?=" . $this->toPHP() . "?>";
75
+    if ($escape)
76
+      return "<?=htmlspecialchars(".$this->toPHP().")?>";
77
+    return "<?=".$this->toPHP()."?>";
78 78
   }
79 79
 
80 80
   function toPHPpre() {
81 81
     $pre = '';
82
-    if($this->chained)
82
+    if ($this->chained)
83 83
       $pre = $this->chained->toPHPpre();
84 84
     return "$pre{$this->filter}(";
85 85
   }
86 86
 
87 87
   function toPHPpost() {
88 88
     $post = '';
89
-    if($this->chained)
89
+    if ($this->chained)
90 90
       $post = $this->chained->toPHPpost();
91 91
     $o = '';
92
-    foreach($this->vars as $v)
92
+    foreach ($this->vars as $v)
93 93
       $o .= ','.$this->varToCode($v);
94 94
     return "$o)$post";
95 95
   }
@@ -104,24 +104,24 @@  discard block
 block discarded – undo
104 104
 
105 105
   static function itersplit($v, $sep = ",") {
106 106
     $o = [];
107
-    foreach(explode($sep, $v) as $k=>$i) {
108
-      if($i)
109
-        $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k,'key'=>$k];
107
+    foreach (explode($sep, $v) as $k=>$i) {
108
+      if ($i)
109
+        $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k, 'key'=>$k];
110 110
     }
111 111
     return new WrapArray($o);
112 112
   }
113 113
 
114 114
   static function newlinebr($v) {
115
-    return str_replace("\n","<br />\n",$v);
115
+    return str_replace("\n", "<br />\n", $v);
116 116
   }
117 117
 
118 118
   static function replace($v, $src, $dst) {
119
-    return str_replace($src,$dst,$v);
119
+    return str_replace($src, $dst, $v);
120 120
   }
121 121
 
122 122
   static function ascents($v) {
123
-    $v = str_replace(['$',' ',','],'', $v);
124
-    return (int) round($v * 100,0);
123
+    $v = str_replace(['$', ' ', ','], '', $v);
124
+    return (int) round($v * 100, 0);
125 125
   }
126 126
 
127 127
 }
Please login to merge, or discard this patch.