@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | function toHTML(bool $escape = false): string |
| 50 | 50 | { |
| 51 | 51 | if ($escape) { |
| 52 | - return '<?=htmlspecialchars(' . $this->toPHP() . ')?>'; |
|
| 52 | + return '<?=htmlspecialchars('.$this->toPHP().')?>'; |
|
| 53 | 53 | } |
| 54 | - return '<?=' . $this->toPHP() . '?>'; |
|
| 54 | + return '<?='.$this->toPHP().'?>'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | function toPHP(): string |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | function toPHPVar(): string |
| 63 | 63 | { |
| 64 | - return '$scope->model()->hamleGet(' . Text::varToCode($this->var) . ')'; |
|
| 64 | + return '$scope->model()->hamleGet('.Text::varToCode($this->var).')'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | function getOrCreateModel( |
@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | function __construct(string $tag, H\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') { |
@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | function renderStTag(): string |
| 72 | 72 | { |
| 73 | - $out = '<' . '?php '; |
|
| 73 | + $out = '<'.'?php '; |
|
| 74 | 74 | $scopeName = ''; |
| 75 | 75 | if ($this->type === 'if') { |
| 76 | 76 | $hsvcomp = new H\Text\Comparison($this->var); |
| 77 | - $out .= 'if(' . $hsvcomp->toPHP() . ') {'; |
|
| 78 | - return $out . "\n?>"; |
|
| 77 | + $out .= 'if('.$hsvcomp->toPHP().') {'; |
|
| 78 | + return $out."\n?>"; |
|
| 79 | 79 | } elseif ($this->type === 'else') { |
| 80 | 80 | $out .= '/* else */'; |
| 81 | - return $out . "\n?>"; |
|
| 81 | + return $out."\n?>"; |
|
| 82 | 82 | } |
| 83 | 83 | /** @var H\Text|null $hsv */ |
| 84 | 84 | $hsv = null; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | switch ($this->type) { |
| 95 | 95 | case 'each': |
| 96 | 96 | if ($hsv) { |
| 97 | - $out .= 'foreach(' . $hsv->toPHP() . " as {$this->o}) { \n"; |
|
| 97 | + $out .= 'foreach('.$hsv->toPHP()." as {$this->o}) { \n"; |
|
| 98 | 98 | } else { |
| 99 | 99 | $out .= "foreach(\$scope->model() as {$this->o}) { \n"; |
| 100 | 100 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | $out .= "echo \$ctx->hamleInclude(\$scope, {$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(): string |
| 135 | 135 | { |
| 136 | - $out = '<' . '?php '; |
|
| 136 | + $out = '<'.'?php '; |
|
| 137 | 137 | switch ($this->type) { |
| 138 | 138 | case 'each': |
| 139 | 139 | $out .= '$scope = $scope->lastScope(); '; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if ($this->else) { |
| 157 | 157 | $out .= 'else{'; |
| 158 | 158 | } |
| 159 | - return $out . "\n?>"; |
|
| 159 | + return $out."\n?>"; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | function render(int $indent = 0, bool $minify = false): string |