@@ -34,11 +34,11 @@ |
||
34 | 34 | * @param string $class Class name to be autoloaded |
35 | 35 | */ |
36 | 36 | spl_autoload_register( |
37 | - function ($class) { |
|
37 | + function($class) { |
|
38 | 38 | if (strpos($class, 'Seufert\\Hamle\\') === 0) { |
39 | 39 | $s = DIRECTORY_SEPARATOR; |
40 | 40 | $class = str_replace('\\', $s, substr($class, 14)); |
41 | - $path = __DIR__ . $s . 'hamle' . $s . "$class.php"; |
|
41 | + $path = __DIR__.$s.'hamle'.$s."$class.php"; |
|
42 | 42 | if (is_file($path)) { |
43 | 43 | include_once $path; |
44 | 44 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | Throwable $previous = null |
38 | 38 | ) { |
39 | 39 | ///@todo Include Line number & file name within parse error exceptions |
40 | - $message .= ', on line ' . Hamle\Hamle::getLineNo() . ' in file ?.hamle'; |
|
40 | + $message .= ', on line '.Hamle\Hamle::getLineNo().' in file ?.hamle'; |
|
41 | 41 | parent::__construct($message, $code, $previous); |
42 | 42 | } |
43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $this->source[] = $ref; |
46 | 46 | $this->baseType = $tag; |
47 | 47 | self::$var++; |
48 | - $this->varname = "\$dynhtml" . self::$var; |
|
48 | + $this->varname = "\$dynhtml".self::$var; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | function render(int $indent = 0, bool $minify = false): string |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | 'content' => $this->content, |
59 | 59 | ]); |
60 | 60 | $out = |
61 | - '<?php ' . |
|
62 | - $this->varname . |
|
63 | - "=$data; echo Hamle\\Tag\\DynHtml::toStTag(" . |
|
64 | - $this->varname . |
|
61 | + '<?php '. |
|
62 | + $this->varname. |
|
63 | + "=$data; echo Hamle\\Tag\\DynHtml::toStTag(". |
|
64 | + $this->varname. |
|
65 | 65 | ",\$form)."; |
66 | - $out .= "implode(\"\\n\"," . $this->varname . "['content'])."; |
|
66 | + $out .= "implode(\"\\n\",".$this->varname."['content'])."; |
|
67 | 67 | $out .= |
68 | - 'Hamle\\Tag\\DynHtml::toEnTag(' . |
|
69 | - $this->varname . |
|
70 | - ",\$form)?>" . |
|
68 | + 'Hamle\\Tag\\DynHtml::toEnTag('. |
|
69 | + $this->varname. |
|
70 | + ",\$form)?>". |
|
71 | 71 | ($minify ? '' : "\n"); |
72 | 72 | return $out; |
73 | 73 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->getField($source) |
85 | 85 | ->getDynamicAtt($d['base'], $d['opt'], $d['type'], $d['content']); |
86 | 86 | } |
87 | - $out = '<' . $d['type'] . ' '; |
|
87 | + $out = '<'.$d['type'].' '; |
|
88 | 88 | foreach ($d['opt'] as $k => $v) { |
89 | 89 | if (is_array($v)) { |
90 | 90 | foreach ($v as $k2 => $v2) { |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * @psalm-suppress UndefinedMethod |
94 | 94 | */ |
95 | - $v[$k2] = eval('return ' . $v[$k2]->toPHP() . ';'); |
|
95 | + $v[$k2] = eval('return '.$v[$k2]->toPHP().';'); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | $v = implode(' ', $v); |
99 | 99 | } |
100 | 100 | if ($v instanceof H\Text) { |
101 | - $v = eval('return ' . $v->toPHP() . ';'); |
|
101 | + $v = eval('return '.$v->toPHP().';'); |
|
102 | 102 | } |
103 | - $out .= $k . "=\"" . htmlspecialchars($v) . "\" "; |
|
103 | + $out .= $k."=\"".htmlspecialchars($v)."\" "; |
|
104 | 104 | } |
105 | 105 | $out .= in_array($d['type'], self::$selfCloseTags) ? '/>' : '>'; |
106 | 106 | return $out; |
@@ -110,6 +110,6 @@ discard block |
||
110 | 110 | { |
111 | 111 | return in_array($d['type'], self::$selfCloseTags) |
112 | 112 | ? '' |
113 | - : '</' . $d['type'] . '>'; |
|
113 | + : '</'.$d['type'].'>'; |
|
114 | 114 | } |
115 | 115 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | function renderStTag(): string |
85 | 85 | { |
86 | 86 | $close = in_array($this->type, self::$selfCloseTags) ? ' />' : '>'; |
87 | - return "<{$this->type}" . $this->optToTags() . $close; |
|
87 | + return "<{$this->type}".$this->optToTags().$close; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | function renderEnTag(): string |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $v = new H\Text($v ?? ''); |
115 | 115 | } |
116 | 116 | $k = new H\Text($k); |
117 | - $out[] = ' ' . $k->toHTML() . "=\"" . $v->toHTMLAtt() . "\""; |
|
117 | + $out[] = ' '.$k->toHTML()."=\"".$v->toHTMLAtt()."\""; |
|
118 | 118 | } |
119 | 119 | return implode('', $out); |
120 | 120 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | static function fromParser( |
33 | 33 | array $chars, |
34 | 34 | ?Evaluated $expr = null, |
35 | - string|StringLit|StringConcat $rhs = null |
|
35 | + string | StringLit | StringConcat $rhs = null |
|
36 | 36 | ): self { |
37 | 37 | $o = []; |
38 | 38 | if ($chars) { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->filters = $filters; |
20 | 20 | } |
21 | 21 | |
22 | - static function for(string $rel, array $filters): self |
|
22 | + static function for (string $rel, array $filters): self |
|
23 | 23 | { |
24 | 24 | return new self( |
25 | 25 | $rel === '>' ? Hamle::REL_CHILD : Hamle::REL_PARENT, |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | public function apply(string $out): string |
31 | 31 | { |
32 | 32 | $out = |
33 | - $out . |
|
34 | - "->hamleRel({$this->rel}," . |
|
35 | - Query::queryParams($this->filters, true) . |
|
33 | + $out. |
|
34 | + "->hamleRel({$this->rel},". |
|
35 | + Query::queryParams($this->filters, true). |
|
36 | 36 | ')'; |
37 | 37 | if ($this->chain) { |
38 | 38 | $out = $this->chain->apply($out); |
@@ -42,7 +42,7 @@ discard block |
||
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 |
||
71 | 71 | public function toPHP(): string |
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 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | if (!$model->valid()) { |
102 | 102 | if (!$parent instanceof Hamle\WriteModel) { |
103 | 103 | throw new \RuntimeException( |
104 | - 'Cant create model, ' . |
|
105 | - get_class($parent) . |
|
104 | + 'Cant create model, '. |
|
105 | + get_class($parent). |
|
106 | 106 | ' must implement Hamle\\WriteModel.', |
107 | 107 | ); |
108 | 108 | } |
@@ -38,11 +38,11 @@ |
||
38 | 38 | |
39 | 39 | function toPHP(): string |
40 | 40 | { |
41 | - return '$form->getField(' . Text::varToCode($this->var) . ')->getValue()'; |
|
41 | + return '$form->getField('.Text::varToCode($this->var).')->getValue()'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | function toHTML(bool $escape = false): string |
45 | 45 | { |
46 | - return '<?=' . $this->toPHP() . '?>'; |
|
46 | + return '<?='.$this->toPHP().'?>'; |
|
47 | 47 | } |
48 | 48 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | throw new ParseError("Unable to parse filter expression \"$s\""); |
73 | 73 | } |
74 | 74 | if (method_exists(Filter::class, $this->filter)) { |
75 | - $this->filter = Filter::class . '::' . $this->filter; |
|
75 | + $this->filter = Filter::class.'::'.$this->filter; |
|
76 | 76 | } elseif ( |
77 | 77 | in_array($this->filter, ['round', 'strtoupper', 'strtolower', 'ucfirst']) |
78 | 78 | ) { |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | function toHTML(bool $escape = false): string |
93 | 93 | { |
94 | 94 | if ($escape) { |
95 | - return '<?=htmlspecialchars(' . $this->toPHP() . ')?>'; |
|
95 | + return '<?=htmlspecialchars('.$this->toPHP().')?>'; |
|
96 | 96 | } |
97 | - return '<?=' . $this->toPHP() . '?>'; |
|
97 | + return '<?='.$this->toPHP().'?>'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | function toPHPpre(): string |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | } |
115 | 115 | $o = ''; |
116 | 116 | foreach ($this->vars as $v) { |
117 | - $o .= ',' . $this->varToCode($v); |
|
117 | + $o .= ','.$this->varToCode($v); |
|
118 | 118 | } |
119 | 119 | return "$o)$post"; |
120 | 120 | } |
121 | 121 | |
122 | 122 | function toPHP(): string |
123 | 123 | { |
124 | - return $this->toPHPpre() . $this->what->toPHPVar() . $this->toPHPpost(); |
|
124 | + return $this->toPHPpre().$this->what->toPHPVar().$this->toPHPpost(); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | static function itersplit(mixed $v, string $sep = ','): Model |