Completed
Pull Request — master (#3)
by Chris
02:51
created
php/hamle/Tag/Comment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
   {
48 48
     if ($this->commentstyle == 'HTML') {
49 49
       if (count($this->content) > 1) {
50
-        return $pad . '  ' . implode("\n$pad", $this->content) . "\n";
50
+        return $pad.'  '.implode("\n$pad", $this->content)."\n";
51 51
       } else {
52 52
         return current($this->content);
53 53
       }
Please login to merge, or discard this patch.
php/hamle/Tag/Control.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
   function __construct($tag, $parentTag = null)
51 51
   {
52 52
     parent::__construct();
53
-    $this->o = "\$o" . self::$instCount++;
53
+    $this->o = "\$o".self::$instCount++;
54 54
     $this->type = strtolower($tag);
55 55
     $this->var = '';
56 56
     if ($parentTag && $this->type == 'else') {
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 
75 75
   function renderStTag()
76 76
   {
77
-    $out = '<' . '?php ';
77
+    $out = '<'.'?php ';
78 78
     $scopeName = '';
79 79
     if ($this->type === 'if') {
80 80
       $hsvcomp = new H\Text\Comparison($this->var);
81
-      $out .= 'if(' . $hsvcomp->toPHP() . ') {';
82
-      return $out . "\n?>";
81
+      $out .= 'if('.$hsvcomp->toPHP().') {';
82
+      return $out."\n?>";
83 83
     } elseif ($this->type === 'else') {
84 84
       $out .= '/* else */';
85
-      return $out . "\n?>";
85
+      return $out."\n?>";
86 86
     }
87 87
     if ($this->var) {
88 88
       if (preg_match('/ as ([a-zA-Z]+)$/', $this->var, $m)) {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     switch ($this->type) {
97 97
       case 'each':
98 98
         if ($this->var) {
99
-          $out .= 'foreach(' . $hsv->toPHP() . " as {$this->o}) { \n";
99
+          $out .= 'foreach('.$hsv->toPHP()." as {$this->o}) { \n";
100 100
         } else {
101 101
           $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n";
102 102
         }
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
       case 'with':
106 106
         if ($scopeName) {
107 107
           $out .=
108
-            'Hamle\\Scope::add(' . $hsv->toPHP() . ", \"$scopeName\");\n;";
108
+            'Hamle\\Scope::add('.$hsv->toPHP().", \"$scopeName\");\n;";
109 109
         } else {
110 110
           $out .=
111
-            "if(({$this->o} = " .
112
-            $hsv->toPHP() .
113
-            ') && ' .
111
+            "if(({$this->o} = ".
112
+            $hsv->toPHP().
113
+            ') && '.
114 114
             "{$this->o}->valid()) {\n";
115 115
           $out .= "Hamle\\Scope::add({$this->o});\n;";
116 116
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $fn = $file[0] === '#' ? 'includeFragment' : 'includeFile';
121 121
         $out .= "echo Hamle\\Run::$fn({$hsv->toPHP()});";
122 122
     }
123
-    return $out . "\n?>";
123
+    return $out."\n?>";
124 124
   }
125 125
 
126 126
   /**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
   function renderEnTag()
135 135
   {
136
-    $out = '<' . '?php ';
136
+    $out = '<'.'?php ';
137 137
     switch ($this->type) {
138 138
       case 'each':
139 139
         $out .= 'Hamle\\Scope::done(); ';
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     if ($this->else) {
160 160
       $out .= 'else{';
161 161
     }
162
-    return $out . "\n?>";
162
+    return $out."\n?>";
163 163
   }
164 164
 
165 165
   function render($indent = 0, $minify = false)
Please login to merge, or discard this patch.
php/hamle/Text/Complex.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
   function toHTML($escape = false)
63 63
   {
64 64
     if ($escape) {
65
-      return '<?=htmlspecialchars(' . $this->toPHP() . ')?>';
65
+      return '<?=htmlspecialchars('.$this->toPHP().')?>';
66 66
     }
67
-    return '<?=' . $this->toPHP() . '?>';
67
+    return '<?='.$this->toPHP().'?>';
68 68
   }
69 69
   function toPHP()
70 70
   {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
       foreach ($this->sel as $s) {
78 78
         $sel[] = "hamleGet('$s')";
79 79
       }
80
-      return $this->func->toPHP() . '->' . implode('->', $sel);
80
+      return $this->func->toPHP().'->'.implode('->', $sel);
81 81
     } else {
82 82
       return $this->func->toPHP();
83 83
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
       return $this->func->getOrCreateModel($parent);
93 93
     }
94 94
     throw new RuntimeException(
95
-      'Unsupported func type encountered:' . get_class($this->func),
95
+      'Unsupported func type encountered:'.get_class($this->func),
96 96
     );
97 97
   }
98 98
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     $model = $this->getOrCreateModel();
111 111
     if (!$model instanceof WriteModel) {
112 112
       throw new RuntimeException(
113
-        'Can only set values on WriteModel, got ' . get_class($model),
113
+        'Can only set values on WriteModel, got '.get_class($model),
114 114
       );
115 115
     }
116 116
     $model->hamleSet($this->sel[0], $value);
Please login to merge, or discard this patch.
php/hamle/Text/Func.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
   public function __construct($s)
51 51
   {
52 52
     $m = [];
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
     }
56 56
     if (trim($m[2])) {
@@ -137,31 +137,31 @@  discard block
 block discarded – undo
137 137
    */
138 138
   public function toPHP()
139 139
   {
140
-    $sub = $this->sub ? '->' . $this->sub->toPHP() : '';
140
+    $sub = $this->sub ? '->'.$this->sub->toPHP() : '';
141 141
     if ($this->scope instanceof Scope) {
142
-      return $this->scope->toPHP() . $sub;
142
+      return $this->scope->toPHP().$sub;
143 143
     } elseif ($this->scope === true) {
144 144
       return "Hamle\\Scope::get(0)$sub";
145 145
     }
146 146
     $limit =
147
-      Text::varToCode($this->sortlimit['sort']) .
148
-      ',' .
149
-      $this->sortlimit['limit'] .
150
-      ',' .
147
+      Text::varToCode($this->sortlimit['sort']).
148
+      ','.
149
+      $this->sortlimit['limit'].
150
+      ','.
151 151
       $this->sortlimit['offset'];
152 152
     if (count($this->filt['tag'])) {
153
-      return 'Hamle\\Run::modelTypeTags(' .
154
-        Text::varToCode($this->filt['tag']) .
153
+      return 'Hamle\\Run::modelTypeTags('.
154
+        Text::varToCode($this->filt['tag']).
155 155
         ",$limit)$sub";
156 156
     }
157 157
     if (count($this->filt['id'])) {
158 158
       if (isset($this->filt['id']['*']) && count($this->filt['id']['*']) == 1) {
159
-        return 'Hamle\\Run::modelId(' .
160
-          Text::varToCode(current($this->filt['id']['*'])) .
159
+        return 'Hamle\\Run::modelId('.
160
+          Text::varToCode(current($this->filt['id']['*'])).
161 161
           ",$limit)$sub";
162 162
       } else {
163
-        return 'Hamle\\Run::modelTypeId(' .
164
-          Text::varToCode($this->filt['id']) .
163
+        return 'Hamle\\Run::modelTypeId('.
164
+          Text::varToCode($this->filt['id']).
165 165
           ",$limit)$sub";
166 166
       }
167 167
     }
Please login to merge, or discard this patch.
php/hamle/Text/SimpleVar.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
   function toHTML($escape = false)
49 49
   {
50 50
     if ($escape) {
51
-      return '<?=htmlspecialchars(' . $this->toPHP() . ')?>';
51
+      return '<?=htmlspecialchars('.$this->toPHP().')?>';
52 52
     }
53
-    return '<?=' . $this->toPHP() . '?>';
53
+    return '<?='.$this->toPHP().'?>';
54 54
   }
55 55
 
56 56
   function toPHP()
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
   function toPHPVar()
62 62
   {
63
-    return 'Hamle\\Scope::get()->hamleGet(' . Text::varToCode($this->var) . ')';
63
+    return 'Hamle\\Scope::get()->hamleGet('.Text::varToCode($this->var).')';
64 64
   }
65 65
 
66 66
   function getOrCreateModel(Model $parent = null)
Please login to merge, or discard this patch.
php/hamle/Text/Comparison.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
   function __construct($s, $mode = self::TOKEN_CONTROL)
36 36
   {
37 37
     $m = [];
38
-    if (preg_match('/^(.*) ' . self::REGEX_COMP_OPER . ' (.*)$/', $s, $m)) {
38
+    if (preg_match('/^(.*) '.self::REGEX_COMP_OPER.' (.*)$/', $s, $m)) {
39 39
       $this->param1 = new Text($m[1], Text::TOKEN_HTML);
40 40
       $this->param2 = new Text($m[3], Text::TOKEN_HTML);
41 41
       $this->operator = $m[2];
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
     switch ($this->operator) {
60 60
       case 'equals':
61 61
       case 'equal':
62
-        return $p1 . ' == ' . $p2;
62
+        return $p1.' == '.$p2;
63 63
       case 'notequals':
64 64
       case 'notequal':
65
-        return $p1 . ' != ' . $p2;
65
+        return $p1.' != '.$p2;
66 66
       case 'less':
67
-        return $p1 . ' < ' . $p2;
67
+        return $p1.' < '.$p2;
68 68
       case 'greater':
69
-        return $p1 . ' > ' . $p2;
69
+        return $p1.' > '.$p2;
70 70
       case 'has':
71 71
         return "in_array($p2, $p1)";
72 72
       case 'starts':
Please login to merge, or discard this patch.
php/hamle/Text/Scope.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@
 block discarded – undo
47 47
   function toPHP()
48 48
   {
49 49
     if (is_numeric($this->scope)) {
50
-      return 'Hamle\\Scope::get(' . Text::varToCode($this->scope) . ')';
50
+      return 'Hamle\\Scope::get('.Text::varToCode($this->scope).')';
51 51
     } else {
52
-      return 'Hamle\\Scope::getName(' . Text::varToCode($this->scope) . ')';
52
+      return 'Hamle\\Scope::getName('.Text::varToCode($this->scope).')';
53 53
     }
54 54
   }
55 55
 
Please login to merge, or discard this patch.
php/hamle/Text/Filter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
       throw new ParseError("Unable to parse filter expression \"$s\"");
68 68
     }
69 69
     if (method_exists(Filter::class, $this->filter)) {
70
-      $this->filter = Filter::class . '::' . $this->filter;
70
+      $this->filter = Filter::class.'::'.$this->filter;
71 71
     } elseif (
72 72
       in_array($this->filter, ['round', 'strtoupper', 'strtolower', 'ucfirst'])
73 73
     ) {
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
   function toHTML($escape = false)
88 88
   {
89 89
     if ($escape) {
90
-      return '<?=htmlspecialchars(' . $this->toPHP() . ')?>';
90
+      return '<?=htmlspecialchars('.$this->toPHP().')?>';
91 91
     }
92
-    return '<?=' . $this->toPHP() . '?>';
92
+    return '<?='.$this->toPHP().'?>';
93 93
   }
94 94
 
95 95
   function toPHPpre()
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
     }
110 110
     $o = '';
111 111
     foreach ($this->vars as $v) {
112
-      $o .= ',' . $this->varToCode($v);
112
+      $o .= ','.$this->varToCode($v);
113 113
     }
114 114
     return "$o)$post";
115 115
   }
116 116
 
117 117
   function toPHP()
118 118
   {
119
-    return $this->toPHPpre() . $this->what->toPHPVar() . $this->toPHPpost();
119
+    return $this->toPHPpre().$this->what->toPHPVar().$this->toPHPpost();
120 120
     // $o = [$this->what->toPHPVar()] ;
121 121
     // foreach($this->vars as $v)
122 122
     //   $o[] = $this->varToCode($v);
Please login to merge, or discard this patch.
php/hamle/Text/FuncSub.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
   {
43 43
     $m = [];
44 44
     if (
45
-      !preg_match('/^ +([><]) +(' . self::REGEX_FUNCSEL . '+)(.*)$/', $s, $m)
45
+      !preg_match('/^ +([><]) +('.self::REGEX_FUNCSEL.'+)(.*)$/', $s, $m)
46 46
     ) {
47 47
       throw new ParseError("Unable to read \$ sub func in '$s'");
48 48
     }
@@ -71,18 +71,18 @@  discard block
 block discarded – undo
71 71
   public function toPHP()
72 72
   {
73 73
     $limit =
74
-      Hamle\Text::varToCode($this->sortlimit['sort']) .
75
-      ',' .
76
-      $this->sortlimit['limit'] .
77
-      ',' .
78
-      $this->sortlimit['offset'] .
79
-      ',' .
74
+      Hamle\Text::varToCode($this->sortlimit['sort']).
75
+      ','.
76
+      $this->sortlimit['limit'].
77
+      ','.
78
+      $this->sortlimit['offset'].
79
+      ','.
80 80
       $this->grouptype['grouptype'];
81
-    $sub = $this->sub ? '->' . $this->sub->toPHP() : '';
82
-    return 'hamleRel(' .
83
-      $this->dir .
84
-      ',' .
85
-      Hamle\Text::varToCode($this->filt['tag']) .
81
+    $sub = $this->sub ? '->'.$this->sub->toPHP() : '';
82
+    return 'hamleRel('.
83
+      $this->dir.
84
+      ','.
85
+      Hamle\Text::varToCode($this->filt['tag']).
86 86
       ",$limit)$sub";
87 87
   }
88 88
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
     if (!$model->valid()) {
99 99
       if (!$parent instanceof Hamle\WriteModel) {
100 100
         throw new \Exception(
101
-          'Cant create model, ' .
102
-            get_class($parent) .
101
+          'Cant create model, '.
102
+            get_class($parent).
103 103
             ' must implement Hamle\\WriteModel.',
104 104
         );
105 105
       }
Please login to merge, or discard this patch.