@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | function renderStTag() |
81 | 81 | { |
82 | 82 | $close = in_array($this->type, self::$selfCloseTags) ? ' />' : '>'; |
83 | - return "<{$this->type}" . $this->optToTags() . $close; |
|
83 | + return "<{$this->type}".$this->optToTags().$close; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | function renderEnTag() |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $v = new H\Text($v); |
111 | 111 | } |
112 | 112 | $k = new H\Text($k); |
113 | - $out[] = ' ' . $k->toHTML() . "=\"" . $v->toHTMLAtt() . "\""; |
|
113 | + $out[] = ' '.$k->toHTML()."=\"".$v->toHTMLAtt()."\""; |
|
114 | 114 | } |
115 | 115 | return implode('', $out); |
116 | 116 | } |
@@ -122,10 +122,10 @@ |
||
122 | 122 | $this->addChild($input = new DynHtml('input', [], [], '', $n)); |
123 | 123 | $f->getInputAttStatic($input->opt, $input->type, $input->content); |
124 | 124 | } |
125 | - return '<form ' . |
|
126 | - implode(' ', $out) . |
|
127 | - "><?php \$form = " . |
|
128 | - $this->var->toPHP() . |
|
125 | + return '<form '. |
|
126 | + implode(' ', $out). |
|
127 | + "><?php \$form = ". |
|
128 | + $this->var->toPHP(). |
|
129 | 129 | "; \$form->process(); ?>"; |
130 | 130 | } |
131 | 131 |
@@ -47,7 +47,7 @@ |
||
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 | } |
@@ -50,7 +50,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) |
@@ -62,9 +62,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -50,7 +50,7 @@ discard block |
||
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 |
||
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 | } |
@@ -48,9 +48,9 @@ discard block |
||
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 |
||
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) |
@@ -35,7 +35,7 @@ discard block |
||
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 |
||
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': |
@@ -47,9 +47,9 @@ |
||
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 |