@@ -36,8 +36,8 @@ |
||
36 | 36 | public function open():string |
37 | 37 | { |
38 | 38 | return $this->htmlComment ? |
39 | - '<!--'.str_replace('-->','--'.chr(0xC).'>',substr($this->line->getContent(),1)): |
|
40 | - '<?php /* '.substr($this->line->getContent(),2); |
|
39 | + '<!--'.str_replace('-->','--'.chr(0xC).'>',substr($this->line->getContent(),1)): |
|
40 | + '<?php /* '.substr($this->line->getContent(),2); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected function construct():parent |
26 | 26 | { |
27 | - $this->htmlComment= '!'!==$this->line->getChar(1); |
|
27 | + $this->htmlComment='!'!==$this->line->getChar(1); |
|
28 | 28 | return $this; |
29 | 29 | } |
30 | 30 | |
@@ -35,9 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function open():string |
37 | 37 | { |
38 | - return $this->htmlComment ? |
|
39 | - '<!--'.str_replace('-->','--'.chr(0xC).'>',substr($this->line->getContent(),1)): |
|
40 | - '<?php /* '.substr($this->line->getContent(),2); |
|
38 | + return $this->htmlComment? |
|
39 | + '<!--'.str_replace('-->', '--'.chr(0xC).'>', substr($this->line->getContent(), 1)) : '<?php /* '.substr($this->line->getContent(), 2); |
|
41 | 40 | } |
42 | 41 | |
43 | 42 | /** |
@@ -49,6 +48,6 @@ discard block |
||
49 | 48 | */ |
50 | 49 | public function close( Line$closerLine ):string |
51 | 50 | { |
52 | - return $this->htmlComment ? '-->' : ' */ ?>'; |
|
51 | + return $this->htmlComment? '-->' : ' */ ?>'; |
|
53 | 52 | } |
54 | 53 | } |
@@ -136,9 +136,9 @@ |
||
136 | 136 | } |
137 | 137 | return $config['out']; |
138 | 138 | })($config); |
139 | - }elseif( isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['only_in'])) ){ |
|
139 | + } elseif( isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['only_in'])) ){ |
|
140 | 140 | $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',$config['only_in'])); |
141 | - }elseif( isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['not_in'])) ){ |
|
141 | + } elseif( isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['not_in'])) ){ |
|
142 | 142 | $this->document->throw("The $this->nodeType node $name not use in scope ".implode(',',$config['not_in'])); |
143 | 143 | } |
144 | 144 |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | final public function __construct( Document$document, Line$line ) |
53 | 53 | { |
54 | - $this->htsl= $document->htsl; |
|
55 | - $this->document= $document; |
|
56 | - $this->line= $line; |
|
54 | + $this->htsl=$document->htsl; |
|
55 | + $this->document=$document; |
|
56 | + $this->line=$line; |
|
57 | 57 | |
58 | 58 | $this->construct(); |
59 | 59 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function getNodeType() |
100 | 100 | { |
101 | 101 | static $nodeType; |
102 | - return $nodeType??$nodeType= $this->nodeType??(static function($className){return strtolower(preg_replace('/(?<=\\w)([A-Z])/','_$1',preg_replace('/^(?:\\w+\\\\)*(\\w+)Node$/','$1',$className)));})(get_class($this)); |
|
102 | + return $nodeType??$nodeType=$this->nodeType??(static function( $className ){return strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_$1', preg_replace('/^(?:\\w+\\\\)*(\\w+)Node$/', '$1', $className))); })(get_class($this)); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -112,39 +112,39 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function loadConfig( string$name, IConfigProvider$configProvider ) |
114 | 114 | { |
115 | - $config= $configProvider->getConfig($this->nodeType.'_nodes',$name) ?: $configProvider->getConfig($this->nodeType.'_nodes','*'); |
|
115 | + $config=$configProvider->getConfig($this->nodeType.'_nodes', $name)?: $configProvider->getConfig($this->nodeType.'_nodes', '*'); |
|
116 | 116 | |
117 | - if( isset($config['multiple']) ){ |
|
118 | - foreach( $config['multiple'] as $value ){ |
|
119 | - if( $this->line->pregGet($value['pattern']) ){ |
|
120 | - $config= $value; |
|
117 | + if( isset($config[ 'multiple' ]) ){ |
|
118 | + foreach( $config[ 'multiple' ] as $value ){ |
|
119 | + if( $this->line->pregGet($value[ 'pattern' ]) ){ |
|
120 | + $config=$value; |
|
121 | 121 | break; |
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if( isset($config['in']) ){ |
|
126 | + if( isset($config[ 'in' ]) ){ |
|
127 | 127 | $config=(function( array$config )use($name){ |
128 | - foreach( $config['in'] as $key=>$value ){ |
|
128 | + foreach( $config[ 'in' ] as $key=>$value ){ |
|
129 | 129 | if( $this->document->scope && $this->document->scope->scope===$key ){ |
130 | - $value['in_scope']= $key; |
|
130 | + $value[ 'in_scope' ]=$key; |
|
131 | 131 | return $value; |
132 | 132 | } |
133 | 133 | } |
134 | - if( !isset($config['out']) ){ |
|
135 | - $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',array_keys($config['in']))); |
|
134 | + if( !isset($config[ 'out' ]) ){ |
|
135 | + $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',', array_keys($config[ 'in' ]))); |
|
136 | 136 | } |
137 | - return $config['out']; |
|
137 | + return $config[ 'out' ]; |
|
138 | 138 | })($config); |
139 | - }elseif( isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['only_in'])) ){ |
|
140 | - $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',$config['only_in'])); |
|
141 | - }elseif( isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['not_in'])) ){ |
|
142 | - $this->document->throw("The $this->nodeType node $name not use in scope ".implode(',',$config['not_in'])); |
|
139 | + }elseif( isset($config[ 'only_in' ]) && (!$this->document->scope || !in_array($this->document->scope->scope, $config[ 'only_in' ])) ){ |
|
140 | + $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',', $config[ 'only_in' ])); |
|
141 | + }elseif( isset($config[ 'not_in' ]) && (!$this->document->scope || !in_array($this->document->scope->scope, $config[ 'not_in' ])) ){ |
|
142 | + $this->document->throw("The $this->nodeType node $name not use in scope ".implode(',', $config[ 'not_in' ])); |
|
143 | 143 | } |
144 | 144 | |
145 | - if( !is_array($config) ){$this->document->throw("The $this->nodeType node $name is not supported.");} |
|
145 | + if( !is_array($config) ){$this->document->throw("The $this->nodeType node $name is not supported."); } |
|
146 | 146 | |
147 | - $this->config= $config; |
|
147 | + $this->config=$config; |
|
148 | 148 | |
149 | 149 | return $this; |
150 | 150 | } |
@@ -132,17 +132,17 @@ |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | if( !isset($config['out']) ){ |
135 | - $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',array_keys($config['in']))); |
|
135 | + $this->document->throw("the $this->nodeType node $name only use in scope ".implode(',',array_keys($config['in']))); |
|
136 | 136 | } |
137 | 137 | return $config['out']; |
138 | 138 | })($config); |
139 | 139 | }elseif( isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['only_in'])) ){ |
140 | - $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',$config['only_in'])); |
|
140 | + $this->document->throw("the $this->nodeType node $name only use in scope ".implode(',',$config['only_in'])); |
|
141 | 141 | }elseif( isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['not_in'])) ){ |
142 | - $this->document->throw("The $this->nodeType node $name not use in scope ".implode(',',$config['not_in'])); |
|
142 | + $this->document->throw("the $this->nodeType node $name not use in scope ".implode(',',$config['not_in'])); |
|
143 | 143 | } |
144 | 144 | |
145 | - if( !is_array($config) ){$this->document->throw("The $this->nodeType node $name is not supported.");} |
|
145 | + if( !is_array($config) ){$this->document->throw("the $this->nodeType node $name is not supported.");} |
|
146 | 146 | |
147 | 147 | $this->config= $config; |
148 | 148 |
@@ -167,66 +167,66 @@ discard block |
||
167 | 167 | ], |
168 | 168 | ], |
169 | 169 | 'tag_nodes'=>[ |
170 | - 'SVG1.1'=> $svgTags= [ |
|
170 | + 'SVG1.1'=> $svgTags=[ |
|
171 | 171 | 'svg'=> [ |
172 | 172 | 'out'=>[ |
173 | - 'default_attributes'=> ['xmlns'=>'http://www.w3.org/2000/svg','version'=>'1.1',], |
|
174 | - 'params'=> ['viewBox',], |
|
173 | + 'default_attributes'=> [ 'xmlns'=>'http://www.w3.org/2000/svg', 'version'=>'1.1', ], |
|
174 | + 'params'=> [ 'viewBox', ], |
|
175 | 175 | 'scope'=> 'svg', |
176 | 176 | ], |
177 | 177 | 'in'=>[ |
178 | 178 | 'svg'=>[ |
179 | - 'params'=> ['x','y','width','height',], |
|
179 | + 'params'=> [ 'x', 'y', 'width', 'height', ], |
|
180 | 180 | ], |
181 | 181 | ], |
182 | 182 | ], |
183 | - '*'=> [], |
|
183 | + '*'=> [ ], |
|
184 | 184 | 'polygon'=> [ |
185 | - 'params'=> ['points',], |
|
186 | - 'only_in'=> ['svg',], |
|
185 | + 'params'=> [ 'points', ], |
|
186 | + 'only_in'=> [ 'svg', ], |
|
187 | 187 | ], |
188 | 188 | 'polyline'=> [ |
189 | - 'params'=> ['points',], |
|
190 | - 'only_in'=> ['svg',], |
|
189 | + 'params'=> [ 'points', ], |
|
190 | + 'only_in'=> [ 'svg', ], |
|
191 | 191 | ], |
192 | 192 | 'path'=> [ |
193 | - 'params'=> ['d',], |
|
194 | - 'only_in'=> ['svg',], |
|
193 | + 'params'=> [ 'd', ], |
|
194 | + 'only_in'=> [ 'svg', ], |
|
195 | 195 | ], |
196 | 196 | 'line'=> [ |
197 | - 'params'=> ['x1','y1','x2','y2',], |
|
198 | - 'only_in'=> ['svg',], |
|
197 | + 'params'=> [ 'x1', 'y1', 'x2', 'y2', ], |
|
198 | + 'only_in'=> [ 'svg', ], |
|
199 | 199 | ], |
200 | 200 | 'rect'=> [ |
201 | - 'params'=> ['x','y','width','height',], |
|
202 | - 'only_in'=> ['svg',], |
|
201 | + 'params'=> [ 'x', 'y', 'width', 'height', ], |
|
202 | + 'only_in'=> [ 'svg', ], |
|
203 | 203 | ], |
204 | 204 | 'circle'=> [ |
205 | - 'params'=> ['cx','cy','r',], |
|
206 | - 'only_in'=> ['svg',], |
|
205 | + 'params'=> [ 'cx', 'cy', 'r', ], |
|
206 | + 'only_in'=> [ 'svg', ], |
|
207 | 207 | ], |
208 | 208 | 'ellipse'=> [ |
209 | - 'params'=> ['cx','cy','rx','ry',], |
|
210 | - 'only_in'=> ['svg',], |
|
209 | + 'params'=> [ 'cx', 'cy', 'rx', 'ry', ], |
|
210 | + 'only_in'=> [ 'svg', ], |
|
211 | 211 | ], |
212 | 212 | 'text'=> [ |
213 | - 'params'=> ['x','y',], |
|
214 | - 'only_in'=> ['svg',], |
|
213 | + 'params'=> [ 'x', 'y', ], |
|
214 | + 'only_in'=> [ 'svg', ], |
|
215 | 215 | ], |
216 | 216 | ], |
217 | 217 | 'HTML5'=> [ |
218 | - '*'=> [], |
|
218 | + '*'=> [ ], |
|
219 | 219 | 'charset'=> [ |
220 | 220 | 'name'=> 'meta', |
221 | - 'params'=> ['charset',], |
|
221 | + 'params'=> [ 'charset', ], |
|
222 | 222 | ], |
223 | 223 | 'equiv'=> [ |
224 | 224 | 'name'=> 'meta', |
225 | - 'name_value'=> ['http-equiv','content','scheme',], |
|
225 | + 'name_value'=> [ 'http-equiv', 'content', 'scheme', ], |
|
226 | 226 | ], |
227 | 227 | 'meta'=> [ |
228 | 228 | 'name'=> 'meta', |
229 | - 'name_value'=> ['name','content','scheme',], |
|
229 | + 'name_value'=> [ 'name', 'content', 'scheme', ], |
|
230 | 230 | ], |
231 | 231 | 'php'=> [ |
232 | 232 | 'opener'=> '<?php ', |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | 'multiple'=>[ |
239 | 239 | [ |
240 | 240 | 'pattern'=> '/\{>$/', |
241 | - 'params'=> ['type',], |
|
242 | - 'default_attributes'=> ['codeset'=>'codeset',], |
|
241 | + 'params'=> [ 'type', ], |
|
242 | + 'default_attributes'=> [ 'codeset'=>'codeset', ], |
|
243 | 243 | 'embedding'=> 'code', |
244 | 244 | ], |
245 | 245 | [ |
246 | 246 | 'pattern'=> '/.?/', |
247 | 247 | 'name'=> 'code', |
248 | - 'params'=> ['type',], |
|
248 | + 'params'=> [ 'type', ], |
|
249 | 249 | ], |
250 | 250 | ], |
251 | 251 | ], |
@@ -254,13 +254,13 @@ discard block |
||
254 | 254 | [ |
255 | 255 | 'pattern'=> '/^-js @/', |
256 | 256 | 'name'=> 'script', |
257 | - 'default_attributes'=> ['type'=>'text/javascript',], |
|
257 | + 'default_attributes'=> [ 'type'=>'text/javascript', ], |
|
258 | 258 | 'link'=> 'src', |
259 | 259 | ], |
260 | 260 | [ |
261 | 261 | 'pattern'=> '/^-js\{>/', |
262 | 262 | 'name'=> 'script', |
263 | - 'default_attributes'=> ['type'=>'text/javascript',], |
|
263 | + 'default_attributes'=> [ 'type'=>'text/javascript', ], |
|
264 | 264 | 'embedding'=> 'js', |
265 | 265 | ], |
266 | 266 | ], |
@@ -270,90 +270,90 @@ discard block |
||
270 | 270 | [ |
271 | 271 | 'pattern'=> '/^-css @/', |
272 | 272 | 'name'=> 'link', |
273 | - 'default_attributes'=> ['rel'=>'stylesheet','type'=>'text/css',], |
|
273 | + 'default_attributes'=> [ 'rel'=>'stylesheet', 'type'=>'text/css', ], |
|
274 | 274 | 'link'=> 'href', |
275 | 275 | ], |
276 | 276 | [ |
277 | 277 | 'pattern'=> '/^-css\{>/', |
278 | 278 | 'name'=> 'style', |
279 | - 'default_attributes'=> ['type'=>'text/css',], |
|
279 | + 'default_attributes'=> [ 'type'=>'text/css', ], |
|
280 | 280 | 'embedding'=> 'css', |
281 | 281 | ], |
282 | 282 | ], |
283 | 283 | ], |
284 | 284 | 'icon'=> [ |
285 | 285 | 'name'=> 'link', |
286 | - 'default_attributes'=> ['rel'=>'icon',], |
|
287 | - 'params'=> ['sizes',], |
|
286 | + 'default_attributes'=> [ 'rel'=>'icon', ], |
|
287 | + 'params'=> [ 'sizes', ], |
|
288 | 288 | 'link'=> 'href', |
289 | 289 | ], |
290 | 290 | 'shortcut'=> [ |
291 | 291 | 'name'=> 'link', |
292 | - 'default_attributes'=> ['rel'=>'shortcut icon','type'=>'image/x-icon',], |
|
292 | + 'default_attributes'=> [ 'rel'=>'shortcut icon', 'type'=>'image/x-icon', ], |
|
293 | 293 | 'link'=> 'href', |
294 | 294 | ], |
295 | 295 | 'link'=> [ |
296 | 296 | 'name'=> 'link', |
297 | - 'params'=> ['rel',], |
|
297 | + 'params'=> [ 'rel', ], |
|
298 | 298 | 'link'=>'href', |
299 | 299 | ], |
300 | 300 | 'a'=> [ |
301 | 301 | 'link'=> 'href', |
302 | - 'name_value'=> ['name',], |
|
302 | + 'name_value'=> [ 'name', ], |
|
303 | 303 | 'target'=> 'target', |
304 | 304 | ], |
305 | 305 | 'iframe'=>[ |
306 | 306 | 'link'=> 'src', |
307 | - 'default_attributes'=> ['frameborder'=>'0',], |
|
308 | - 'name_value'=> ['name',], |
|
307 | + 'default_attributes'=> [ 'frameborder'=>'0', ], |
|
308 | + 'name_value'=> [ 'name', ], |
|
309 | 309 | ], |
310 | 310 | 'img'=>[ |
311 | 311 | 'link'=> 'src', |
312 | 312 | 'alt'=> 'alt', |
313 | 313 | ], |
314 | - 'form'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'post',],], |
|
315 | - 'post'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'post',],], |
|
316 | - 'upload'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'post','enctype'=>'multipart/form-data',],], |
|
317 | - 'get'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'get',],], |
|
314 | + 'form'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>[ 'name', ], 'default_attributes'=> [ 'method'=>'post', ], ], |
|
315 | + 'post'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>[ 'name', ], 'default_attributes'=> [ 'method'=>'post', ], ], |
|
316 | + 'upload'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>[ 'name', ], 'default_attributes'=> [ 'method'=>'post', 'enctype'=>'multipart/form-data', ], ], |
|
317 | + 'get'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>[ 'name', ], 'default_attributes'=> [ 'method'=>'get', ], ], |
|
318 | 318 | |
319 | - 'input'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'hidden',], 'name_value'=> ['name', 'value', 'form',],], |
|
320 | - 'text'=> ['out'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'text',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], 'in'=>['svg'=>['params'=>['x','y',],],]], |
|
321 | - 'search'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'search',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
322 | - 'password'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'password',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
323 | - 'email'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'email',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
324 | - 'url'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'url',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
325 | - 'tel'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'tel',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
326 | - 'number'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'number',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder', 'params'=>['min', 'step', 'max',],], |
|
327 | - 'range'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'range',], 'name_value'=> ['name', 'value', 'form',], 'params'=>['min', 'step', 'max',],], |
|
328 | - 'radio'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'radio',], 'name_value'=> ['name', 'value', 'form',],], |
|
329 | - 'checkbox'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'checkbox',], 'name_value'=> ['name', 'value', 'form',],], |
|
330 | - 'date'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'date',], 'name_value'=> ['name', 'value', 'form',],], |
|
331 | - 'month'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'month',], 'name_value'=> ['name', 'value', 'form',],], |
|
332 | - 'week'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'week',], 'name_value'=> ['name', 'value', 'form',],], |
|
333 | - 'time'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'time',], 'name_value'=> ['name', 'value', 'form',],], |
|
334 | - 'datetime'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'datetime',], 'name_value'=> ['name', 'value', 'form',],], |
|
335 | - 'datetime-local'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'datetime-local',], 'name_value'=> ['name', 'value', 'form',],], |
|
336 | - 'color'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'color',], 'name_value'=> ['name', 'value', 'form',],], |
|
337 | - 'file'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'file',], 'name_value'=> ['name', 'form',], 'params'=>['accept',],], |
|
319 | + 'input'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'hidden', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
320 | + 'text'=> [ 'out'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'text', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], 'in'=>[ 'svg'=>[ 'params'=>[ 'x', 'y', ], ], ] ], |
|
321 | + 'search'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'search', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
322 | + 'password'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'password', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
323 | + 'email'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'email', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
324 | + 'url'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'url', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
325 | + 'tel'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'tel', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
326 | + 'number'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'number', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', 'params'=>[ 'min', 'step', 'max', ], ], |
|
327 | + 'range'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'range', ], 'name_value'=> [ 'name', 'value', 'form', ], 'params'=>[ 'min', 'step', 'max', ], ], |
|
328 | + 'radio'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'radio', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
329 | + 'checkbox'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'checkbox', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
330 | + 'date'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'date', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
331 | + 'month'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'month', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
332 | + 'week'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'week', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
333 | + 'time'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'time', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
334 | + 'datetime'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'datetime', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
335 | + 'datetime-local'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'datetime-local', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
336 | + 'color'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'color', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
337 | + 'file'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=>'file', ], 'name_value'=> [ 'name', 'form', ], 'params'=>[ 'accept', ], ], |
|
338 | 338 | |
339 | - 'submit'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'submit',], 'name_value'=> ['name', 'value','form'], 'link'=> ' formaction', 'target'=> 'formtarget',], |
|
340 | - 'reset'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'reset',], 'name_value'=> ['form',]], |
|
341 | - 'button'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'button',],], |
|
339 | + 'submit'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=>'submit', ], 'name_value'=> [ 'name', 'value', 'form' ], 'link'=> ' formaction', 'target'=> 'formtarget', ], |
|
340 | + 'reset'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=>'reset', ], 'name_value'=> [ 'form', ] ], |
|
341 | + 'button'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=>'button', ], ], |
|
342 | 342 | |
343 | - 'textarea'=> ['name'=> 'textarea', 'name_value'=>['name','value','form',],'alt'=>'placeholder',], |
|
343 | + 'textarea'=> [ 'name'=> 'textarea', 'name_value'=>[ 'name', 'value', 'form', ], 'alt'=>'placeholder', ], |
|
344 | 344 | //* |
345 | 345 | 'select'=> [ |
346 | - 'name_value'=> ['name', 'value','form',], |
|
346 | + 'name_value'=> [ 'name', 'value', 'form', ], |
|
347 | 347 | 'scope'=>'select', |
348 | 348 | ], |
349 | 349 | 'datalist'=>[ |
350 | - 'params'=>['id',], |
|
350 | + 'params'=>[ 'id', ], |
|
351 | 351 | 'scope'=>'datalist', |
352 | 352 | ], |
353 | 353 | 'optgroup'=> [ |
354 | 354 | 'in'=> [ |
355 | 355 | 'select'=>[ |
356 | - 'name_value'=> ['label',], |
|
356 | + 'name_value'=> [ 'label', ], |
|
357 | 357 | ], |
358 | 358 | ], |
359 | 359 | ], |
@@ -361,20 +361,20 @@ discard block |
||
361 | 361 | 'in'=> [ |
362 | 362 | 'select'=> [ |
363 | 363 | 'scope_function'=>function( $scope ){ |
364 | - if( $scope['value']===$this['value'] ){ |
|
365 | - $this['selected']= 'selected'; |
|
364 | + if( $scope[ 'value' ]===$this[ 'value' ] ){ |
|
365 | + $this[ 'selected' ]='selected'; |
|
366 | 366 | }; |
367 | 367 | }, |
368 | - 'name_value'=> ['value', 'label',], |
|
368 | + 'name_value'=> [ 'value', 'label', ], |
|
369 | 369 | ], |
370 | 370 | 'datalist'=> [ |
371 | - 'name_value'=> ['value',], |
|
371 | + 'name_value'=> [ 'value', ], |
|
372 | 372 | ], |
373 | 373 | ], |
374 | 374 | ], |
375 | 375 | //*/ |
376 | 376 | 'param'=> [ |
377 | - 'name_value'=> ['name','value',], |
|
377 | + 'name_value'=> [ 'name', 'value', ], |
|
378 | 378 | ], |
379 | 379 | ]+$svgTags, |
380 | 380 | ], |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function __get( $attribute ) |
17 | 17 | { |
18 | - if( is_callable([static::class, $getter= 'get'.implode('',array_map('ucfirst',explode('_',$attribute))),]) ){ |
|
18 | + if( is_callable([ static::class, $getter='get'.implode('', array_map('ucfirst', explode('_', $attribute))), ]) ){ |
|
19 | 19 | return static::$getter(); |
20 | 20 | }else{ |
21 | 21 | throw new \Exception(static::class.' has no attribute named '.$attribute); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | if( is_callable([static::class, $setter= 'set'.implode('',array_map('ucfirst',explode('_',$attribute))),]) ){ |
18 | 18 | return static::$setter($value); |
19 | - }else{ |
|
19 | + } else{ |
|
20 | 20 | throw new \Exception(static::class.' has no attribute named '.$attribute); |
21 | 21 | } |
22 | 22 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function __construct( string$name=null ) |
33 | 33 | { |
34 | - $this->name = $name; |
|
34 | + $this->name=$name; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | protected function construct():parent |
27 | 27 | { |
28 | - $this->name= null; |
|
28 | + $this->name=null; |
|
29 | 29 | |
30 | 30 | return $this; |
31 | 31 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | protected function construct():parent |
27 | 27 | { |
28 | - $this->name= $this->line->pregGet('/(?<=\( ).*(?= \))/'); |
|
28 | + $this->name=$this->line->pregGet('/(?<=\( ).*(?= \))/'); |
|
29 | 29 | |
30 | 30 | return $this; |
31 | 31 | } |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | */ |
39 | 39 | protected function construct():parent |
40 | 40 | { |
41 | - $name= $this->line->pregGet('/(?<=^~)[\w-]*/'); |
|
41 | + $name=$this->line->pregGet('/(?<=^~)[\w-]*/'); |
|
42 | 42 | $this->name=$name; |
43 | 43 | |
44 | - $this->loadConfig($name,$this->htsl); |
|
44 | + $this->loadConfig($name, $this->htsl); |
|
45 | 45 | |
46 | - $this->param= $this->line->pregGet('/^~[\w-]*\( (.*) \)/',1); |
|
46 | + $this->param=$this->line->pregGet('/^~[\w-]*\( (.*) \)/', 1); |
|
47 | 47 | |
48 | - $this->structureName=$this->config['name']??$name; |
|
48 | + $this->structureName=$this->config[ 'name' ]??$name; |
|
49 | 49 | |
50 | 50 | $this->id=strtoupper(uniqid()); |
51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function open():string |
61 | 61 | { |
62 | - return $this->withParam($this->config['opener']); |
|
62 | + return $this->withParam($this->config[ 'opener' ]); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function getScope() |
71 | 71 | { |
72 | - return $this->config['scope']??null; |
|
72 | + return $this->config[ 'scope' ]??null; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function close( Line$closerLine ):string |
84 | 84 | { |
85 | - if( isset($this->config['close_by']) && $closerLine->indentLevel==$this->line->indentLevel ){ |
|
86 | - foreach( $this->config['close_by'] as $key=>$value ){ |
|
85 | + if( isset($this->config[ 'close_by' ]) && $closerLine->indentLevel==$this->line->indentLevel ){ |
|
86 | + foreach( $this->config[ 'close_by' ] as $key=>$value ){ |
|
87 | 87 | if( $closerLine->pregMatch($key) ){ |
88 | 88 | return $this->withParam($value); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - if( isset($this->config['closer']) ) |
|
94 | - { return $this->withParam($this->config['closer']); } |
|
93 | + if( isset($this->config[ 'closer' ]) ) |
|
94 | + { return $this->withParam($this->config[ 'closer' ]); } |
|
95 | 95 | |
96 | 96 | return ''; |
97 | 97 | } |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | */ |
106 | 106 | private function withParam( string$input ) |
107 | 107 | { |
108 | - return str_replace('$_FLAG_$',"__HTSL_CTRL_FLAG_{$this->id}__",preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/',function( array$matches ){ |
|
109 | - $param= $this->param; |
|
108 | + return str_replace('$_FLAG_$', "__HTSL_CTRL_FLAG_{$this->id}__", preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/', function( array$matches ){ |
|
109 | + $param=$this->param; |
|
110 | 110 | |
111 | - if( isset($matches[1]) ){ |
|
111 | + if( isset($matches[ 1 ]) ){ |
|
112 | 112 | array_map(...[ |
113 | - function($replacer)use(&$param){ |
|
114 | - list($pattern,$replacement,)= preg_split('/(?<!\\\\)\\//',$replacer); |
|
115 | - $param= preg_replace(...[ |
|
113 | + function( $replacer )use(&$param){ |
|
114 | + list($pattern, $replacement,)=preg_split('/(?<!\\\\)\\//', $replacer); |
|
115 | + $param=preg_replace(...[ |
|
116 | 116 | "/$pattern/", |
117 | - preg_replace('/^\\\\_$/','',$replacement), |
|
117 | + preg_replace('/^\\\\_$/', '', $replacement), |
|
118 | 118 | $param, |
119 | 119 | ]); |
120 | 120 | }, |
121 | 121 | preg_split( |
122 | 122 | '/(?<!\\\\)\\/\\//' |
123 | 123 | , |
124 | - trim($matches[1],'/') |
|
124 | + trim($matches[ 1 ], '/') |
|
125 | 125 | ), |
126 | 126 | ]); |
127 | 127 | } |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct( Htsl$htsl, string$filePath ) |
25 | 25 | { |
26 | - substr($filePath,-5)==='.htsl' or $filePath.= '.htsl'; |
|
26 | + substr($filePath, -5)==='.htsl' or $filePath.='.htsl'; |
|
27 | 27 | |
28 | 28 | if( !file_exists($filePath) || !is_file($filePath) ){ |
29 | 29 | throw new \Exception("File $filePath not exists.", 1); |
30 | 30 | } |
31 | 31 | |
32 | - $this->filePath= $filePath; |
|
32 | + $this->filePath=$filePath; |
|
33 | 33 | |
34 | - $this->handle= fopen($filePath,'r'); |
|
34 | + $this->handle=fopen($filePath, 'r'); |
|
35 | 35 | |
36 | 36 | parent::__construct($htsl); |
37 | 37 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function getLine():Line |
53 | 53 | { |
54 | - while( "\n"===$content= fgets($this->handle) ); |
|
54 | + while( "\n"===$content=fgets($this->handle) ); |
|
55 | 55 | |
56 | 56 | return new Line($content); |
57 | 57 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function goSide( $filePath ):parent |
67 | 67 | { |
68 | - $filePath= $this->htsl->getFilePath($filePath,dirname($this->filePath)); |
|
68 | + $filePath=$this->htsl->getFilePath($filePath, dirname($this->filePath)); |
|
69 | 69 | |
70 | - return new static($this->htsl,$filePath); |
|
70 | + return new static($this->htsl, $filePath); |
|
71 | 71 | } |
72 | 72 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | substr($filePath,-5)==='.htsl' or $filePath.= '.htsl'; |
27 | 27 | |
28 | 28 | if( !file_exists($filePath) || !is_file($filePath) ){ |
29 | - throw new \Exception("File $filePath not exists.", 1); |
|
29 | + throw new \Exception("file $filePath not exists.", 1); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $this->filePath= $filePath; |