Completed
Push — master ( 71a0d5...20ca54 )
by Chris
02:27
created
php/hamle/Parse.php 3 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
 
25 25
  */
26 26
 namespace Seufert\Hamle;
27
-use Seufert\Hamle\Exception\ParseError;
28
-use Seufert\Hamle\Parse\Filter as ParseFilter;
27
+use Seufert\Hamle\Exception\ParseError;
28
+use Seufert\Hamle\Parse\Filter as ParseFilter;
29 29
 use Seufert\Hamle\Text;
30 30
 
31 31
 /**
Please login to merge, or discard this patch.
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -92,6 +92,9 @@  discard block
 block discarded – undo
92 92
     }
93 93
   }
94 94
 
95
+  /**
96
+   * @param string $s
97
+   */
95 98
   function parseSnip($s) {
96 99
     //save root tags
97 100
     /** @var Tag[] $roots */
@@ -223,6 +226,9 @@  discard block
 block discarded – undo
223 226
     }
224 227
   }
225 228
 
229
+  /**
230
+   * @param string $qs
231
+   */
226 232
   function parseQueryString($qs) {
227 233
     $out = [];
228 234
     foreach(explode('&',$qs) as $s) {
@@ -240,6 +246,9 @@  discard block
 block discarded – undo
240 246
 
241 247
   }
242 248
 
249
+  /**
250
+   * @param integer $indent
251
+   */
243 252
   function consumeBlock($indent) {
244 253
     $out = array();
245 254
     $m = array();
@@ -254,6 +263,9 @@  discard block
 block discarded – undo
254 263
     return $out;
255 264
   }
256 265
 
266
+  /**
267
+   * @param integer $indent
268
+   */
257 269
   function indentLevel($indent) {
258 270
     if (!isset($this->indents)) $this->indents = array();
259 271
     if (!count($this->indents)) {
Please login to merge, or discard this 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.