@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | function toHTML(bool $escape = false): string |
| 66 | 66 | { |
| 67 | 67 | if ($escape) { |
| 68 | - return '<?=htmlspecialchars(' . $this->toPHP() . ')?>'; |
|
| 68 | + return '<?=htmlspecialchars('.$this->toPHP().')?>'; |
|
| 69 | 69 | } |
| 70 | - return '<?=' . $this->toPHP() . '?>'; |
|
| 70 | + return '<?='.$this->toPHP().'?>'; |
|
| 71 | 71 | } |
| 72 | 72 | function toPHP(): string |
| 73 | 73 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | foreach ($this->sel as $s) { |
| 82 | 82 | $sel[] = "hamleGet('$s')"; |
| 83 | 83 | } |
| 84 | - return $this->func->toPHP() . '->' . implode('->', $sel); |
|
| 84 | + return $this->func->toPHP().'->'.implode('->', $sel); |
|
| 85 | 85 | } else { |
| 86 | 86 | return $this->func->toPHP(); |
| 87 | 87 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $this->func->getOrCreateModel($scope, $ctx, $parent); |
| 97 | 97 | } |
| 98 | 98 | throw new RuntimeException( |
| 99 | - 'Unsupported func type encountered:' . |
|
| 99 | + 'Unsupported func type encountered:'. |
|
| 100 | 100 | ($this->func ? get_class($this->func) : 'Unknown'), |
| 101 | 101 | ); |
| 102 | 102 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $model = $this->getOrCreateModel($scope, $ctx); |
| 119 | 119 | if (!$model instanceof WriteModel) { |
| 120 | 120 | throw new RuntimeException( |
| 121 | - 'Can only set values on WriteModel, got ' . get_class($model), |
|
| 121 | + 'Can only set values on WriteModel, got '.get_class($model), |
|
| 122 | 122 | ); |
| 123 | 123 | } |
| 124 | 124 | $model->hamleSet($this->sel[0], $value); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public function __construct($s) |
| 52 | 52 | { |
| 53 | 53 | $m = []; |
| 54 | - if (!preg_match('/^\$\((' . self::REGEX_FUNCSEL . '*)(.*)\)$/', $s, $m)) { |
|
| 54 | + if (!preg_match('/^\$\(('.self::REGEX_FUNCSEL.'*)(.*)\)$/', $s, $m)) { |
|
| 55 | 55 | throw new ParseError("Unable to read \$ func in '$s'"); |
| 56 | 56 | } |
| 57 | 57 | if (trim($m[2])) { |
@@ -138,31 +138,31 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function toPHP(): string |
| 140 | 140 | { |
| 141 | - $sub = $this->sub ? '->' . $this->sub->toPHP() : ''; |
|
| 141 | + $sub = $this->sub ? '->'.$this->sub->toPHP() : ''; |
|
| 142 | 142 | if ($this->scope instanceof Scope) { |
| 143 | - return $this->scope->toPHP() . $sub; |
|
| 143 | + return $this->scope->toPHP().$sub; |
|
| 144 | 144 | } elseif ($this->scope === true) { |
| 145 | 145 | return "Hamle\\Scope::get(0)$sub"; |
| 146 | 146 | } |
| 147 | 147 | $limit = |
| 148 | - Text::varToCode($this->sortlimit['sort']) . |
|
| 149 | - ',' . |
|
| 150 | - $this->sortlimit['limit'] . |
|
| 151 | - ',' . |
|
| 148 | + Text::varToCode($this->sortlimit['sort']). |
|
| 149 | + ','. |
|
| 150 | + $this->sortlimit['limit']. |
|
| 151 | + ','. |
|
| 152 | 152 | $this->sortlimit['offset']; |
| 153 | 153 | if (count($this->filt['tag'])) { |
| 154 | - return '$ctx->hamleFindTypeTags($scope,' . |
|
| 155 | - Text::varToCode($this->filt['tag']) . |
|
| 154 | + return '$ctx->hamleFindTypeTags($scope,'. |
|
| 155 | + Text::varToCode($this->filt['tag']). |
|
| 156 | 156 | ",$limit)$sub"; |
| 157 | 157 | } |
| 158 | 158 | if (count($this->filt['id'])) { |
| 159 | 159 | if (isset($this->filt['id']['*']) && count($this->filt['id']['*']) == 1) { |
| 160 | - return '$ctx->hamleFindId($scope,' . |
|
| 161 | - Text::varToCode(current($this->filt['id']['*'])) . |
|
| 160 | + return '$ctx->hamleFindId($scope,'. |
|
| 161 | + Text::varToCode(current($this->filt['id']['*'])). |
|
| 162 | 162 | ",$limit)$sub"; |
| 163 | 163 | } else { |
| 164 | - return '$ctx->hamleFindTypeId($scope,' . |
|
| 165 | - Text::varToCode($this->filt['id']) . |
|
| 164 | + return '$ctx->hamleFindTypeId($scope,'. |
|
| 165 | + Text::varToCode($this->filt['id']). |
|
| 166 | 166 | ",$limit)$sub"; |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | function toPHP(): string |
| 52 | 52 | { |
| 53 | 53 | if (is_numeric($this->scope)) { |
| 54 | - return '$scope->modelNum(' . Text::varToCode($this->scope) . ')'; |
|
| 54 | + return '$scope->modelNum('.Text::varToCode($this->scope).')'; |
|
| 55 | 55 | } else { |
| 56 | - return '$scope->namedModel(' . Text::varToCode($this->scope) . ')'; |
|
| 56 | + return '$scope->namedModel('.Text::varToCode($this->scope).')'; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |