@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function parseLine( Line$line ):parent |
20 | 20 | { |
21 | - $this->content.= $line->fullContent."\n"; |
|
21 | + $this->content.=$line->fullContent."\n"; |
|
22 | 22 | return $this; |
23 | 23 | } |
24 | 24 | } |
@@ -18,13 +18,13 @@ |
||
18 | 18 | */ |
19 | 19 | public function parseLine( Line$line ):parent |
20 | 20 | { |
21 | - $content= '<code>'.htmlentities($line->fullContent).'</code>'; |
|
21 | + $content='<code>'.htmlentities($line->fullContent).'</code>'; |
|
22 | 22 | |
23 | - $indentation= $this->document->indentation; |
|
23 | + $indentation=$this->document->indentation; |
|
24 | 24 | |
25 | - false!==$indentation and $content= str_repeat($indentation,$this->document->indentLevel).$content."\n"; |
|
25 | + false!==$indentation and $content=str_repeat($indentation, $this->document->indentLevel).$content."\n"; |
|
26 | 26 | |
27 | - $this->content.= $content; |
|
27 | + $this->content.=$content; |
|
28 | 28 | |
29 | 29 | return $this; |
30 | 30 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @var string |
33 | 33 | */ |
34 | - protected $filePath= ''; |
|
34 | + protected $filePath=''; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Constructing a buffer reading HTSL content from somewhere. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function __construct( Htsl$htsl ) |
44 | 44 | { |
45 | - $this->htsl= $htsl; |
|
45 | + $this->htsl=$htsl; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct( Htsl$htsl, string$filePath ) |
29 | 29 | { |
30 | - substr($filePath,-5)==='.htsl' or $filePath.= '.htsl'; |
|
30 | + substr($filePath, -5)==='.htsl' or $filePath.='.htsl'; |
|
31 | 31 | |
32 | 32 | if( !file_exists($filePath) || !is_file($filePath) ){ |
33 | 33 | throw new \Exception("File $filePath not exists.", 1); |
34 | 34 | } |
35 | 35 | |
36 | - $this->filePath= $filePath; |
|
36 | + $this->filePath=$filePath; |
|
37 | 37 | |
38 | - $this->handle= fopen($filePath,'r'); |
|
38 | + $this->handle=fopen($filePath, 'r'); |
|
39 | 39 | |
40 | 40 | parent::__construct($htsl); |
41 | 41 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getLine():Line |
61 | 61 | { |
62 | - while( "\n"===$content= fgets($this->handle) ); |
|
62 | + while( "\n"===$content=fgets($this->handle) ); |
|
63 | 63 | |
64 | 64 | return new Line($content); |
65 | 65 | } |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function goSide( $fileName ):parent |
77 | 77 | { |
78 | - $filePath= $this->htsl->getFilePath($fileName,dirname($this->filePath)); |
|
78 | + $filePath=$this->htsl->getFilePath($fileName, dirname($this->filePath)); |
|
79 | 79 | |
80 | - return new static($this->htsl,$filePath); |
|
80 | + return new static($this->htsl, $filePath); |
|
81 | 81 | } |
82 | 82 | } |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( Htsl$htsl, string$content, string$filePath='' ) |
30 | 30 | { |
31 | - if( false!==strpos($content,"\r") ){ |
|
31 | + if( false!==strpos($content, "\r") ){ |
|
32 | 32 | throw new \Exception("Line ending must be LF.", 1); |
33 | 33 | } |
34 | 34 | |
35 | - $this->filePath= $filePath; |
|
35 | + $this->filePath=$filePath; |
|
36 | 36 | |
37 | - $this->lines= array_filter(explode("\n",$content),'strlen'); |
|
38 | - array_unshift($this->lines,null); |
|
37 | + $this->lines=array_filter(explode("\n", $content), 'strlen'); |
|
38 | + array_unshift($this->lines, null); |
|
39 | 39 | |
40 | 40 | parent::__construct($htsl); |
41 | 41 | } |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function goSide( $fileName ):parent |
65 | 65 | { |
66 | - $filePath= $this->htsl->getFilePath($fileName,dirname($this->filePath)); |
|
67 | - $content= $this->htsl->getFileContent($filePath); |
|
66 | + $filePath=$this->htsl->getFilePath($fileName, dirname($this->filePath)); |
|
67 | + $content=$this->htsl->getFileContent($filePath); |
|
68 | 68 | |
69 | - return new static($this->htsl,$content,$filePath); |
|
69 | + return new static($this->htsl, $content, $filePath); |
|
70 | 70 | } |
71 | 71 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function studly_case( string$input ):string |
25 | 25 | { |
26 | - return str_replace(' ','',ucwords(str_replace(['-', '_'], ' ', $input))); |
|
26 | + return str_replace(' ', '', ucwords(str_replace([ '-', '_' ], ' ', $input))); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,5 +35,5 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function snake_case( string$input ):string |
37 | 37 | { |
38 | - return strtolower(preg_replace('/(?<=[^A-Z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][^A-Z])/','_',$input)); |
|
38 | + return strtolower(preg_replace('/(?<=[^A-Z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][^A-Z])/', '_', $input)); |
|
39 | 39 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @var int |
92 | 92 | */ |
93 | - private $level= 0; |
|
93 | + private $level=0; |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Section indent level. |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @var int |
101 | 101 | */ |
102 | - private $sectionLevel= 0; |
|
102 | + private $sectionLevel=0; |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Opened nodes. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @var [ Htsl\Parser\Node\Contracts\ANode, ] |
110 | 110 | */ |
111 | - private $openedNodes= []; |
|
111 | + private $openedNodes=[ ]; |
|
112 | 112 | |
113 | 113 | /** |
114 | 114 | * Current scopes. |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @var [ Htsl\Parser\Node\Contracts\ANode, ] |
119 | 119 | */ |
120 | - private $scopes= []; |
|
120 | + private $scopes=[ ]; |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Current line number. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @var int |
128 | 128 | */ |
129 | - private $lineNumber= 0; |
|
129 | + private $lineNumber=0; |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Current line. |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @var [ Htsl\Parser\Section, ] |
146 | 146 | */ |
147 | - private $sections=[]; |
|
147 | + private $sections=[ ]; |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Whether the document is executed. |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function __construct( Htsl$htsl, Buffer$buffer, self$parent=null ) |
186 | 186 | { |
187 | - $this->htsl= $htsl; |
|
188 | - $this->buffer= $buffer; |
|
187 | + $this->htsl=$htsl; |
|
188 | + $this->buffer=$buffer; |
|
189 | 189 | |
190 | 190 | if( $parent ){ |
191 | - $this->parent= $parent; |
|
192 | - $this->docType= $parent->docType; |
|
193 | - $this->indentation= $parent->indentation; |
|
191 | + $this->parent=$parent; |
|
192 | + $this->docType=$parent->docType; |
|
193 | + $this->indentation=$parent->indentation; |
|
194 | 194 | }else{ |
195 | 195 | $this->parseFirstLine(); |
196 | 196 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | protected function getLine():Line |
252 | 252 | { |
253 | 253 | do{ |
254 | - $line= $this->buffer->getLine(); |
|
254 | + $line=$this->buffer->getLine(); |
|
255 | 255 | }while( $line->isEmpty() && $line->hasMore() ); |
256 | 256 | |
257 | 257 | return $line; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function getConfig( string...$keys ) |
270 | 270 | { |
271 | - return $this->htsl->getConfig(array_shift($keys),$this->docType,...$keys); |
|
271 | + return $this->htsl->getConfig(array_shift($keys), $this->docType, ...$keys); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -316,16 +316,16 @@ discard block |
||
316 | 316 | */ |
317 | 317 | protected function parseFirstLine():self |
318 | 318 | { |
319 | - $line= $this->getLine(); |
|
319 | + $line=$this->getLine(); |
|
320 | 320 | |
321 | 321 | if( '@'===$line->getChar(0) ){ |
322 | 322 | return $this->setExtending($line); |
323 | 323 | } |
324 | 324 | |
325 | - $this->docType= $line->content; |
|
326 | - $docTypeContent= $this->getConfig('doc_types') or $this->throw("DocType $this->docType is not supported"); |
|
325 | + $this->docType=$line->content; |
|
326 | + $docTypeContent=$this->getConfig('doc_types') or $this->throw("DocType $this->docType is not supported"); |
|
327 | 327 | |
328 | - $this->indentation= $this->htsl->getConfig('indentation',$this->docType) ?? ( function( $scalarOrFalse ){ return is_scalar($scalarOrFalse)?$scalarOrFalse:false; } )($this->htsl->getConfig('indentation')); |
|
328 | + $this->indentation=$this->htsl->getConfig('indentation', $this->docType) ?? (function( $scalarOrFalse ){ return is_scalar($scalarOrFalse)? $scalarOrFalse : false; } )($this->htsl->getConfig('indentation')); |
|
329 | 329 | |
330 | 330 | return $this->appendLine($docTypeContent); |
331 | 331 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | protected function setExtending( Line$firstLine ):self |
343 | 343 | { |
344 | - switch( $name= $firstLine->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
344 | + switch( $name=$firstLine->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
345 | 345 | default:{ |
346 | 346 | $this->throw("The @$name is not supported."); |
347 | 347 | }break; |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function lineByLine():self |
369 | 369 | { |
370 | - while( ($line= $this->getLine())->hasMore() ){ |
|
371 | - $this->lineNumber+= 1; |
|
370 | + while( ($line=$this->getLine())->hasMore() ){ |
|
371 | + $this->lineNumber+=1; |
|
372 | 372 | |
373 | 373 | if( $this->embedment ){ |
374 | 374 | $this->embeddingParse($line); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | |
382 | 382 | $this->closeNodes($this->level); |
383 | 383 | |
384 | - $this->isExecuted= true; |
|
384 | + $this->isExecuted=true; |
|
385 | 385 | |
386 | 386 | return $this; |
387 | 387 | } |
@@ -417,10 +417,10 @@ discard block |
||
417 | 417 | */ |
418 | 418 | protected function startEmbedding( string$embedType ):self |
419 | 419 | { |
420 | - $embedmentClass= '\\Htsl\\Embedment\\'.ucfirst($embedType).'Embedment'; |
|
420 | + $embedmentClass='\\Htsl\\Embedment\\'.ucfirst($embedType).'Embedment'; |
|
421 | 421 | class_exists($embedmentClass) or $this->throw("Embed type $embedType not exists."); |
422 | 422 | |
423 | - $this->embedment= new $embedmentClass($this); |
|
423 | + $this->embedment=new $embedmentClass($this); |
|
424 | 424 | |
425 | 425 | return $this; |
426 | 426 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | public function breakEmbedding():self |
436 | 436 | { |
437 | 437 | $this->append($this->embedment->getContent()); |
438 | - $this->embedment= null; |
|
438 | + $this->embedment=null; |
|
439 | 439 | |
440 | 440 | return $this; |
441 | 441 | } |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | */ |
452 | 452 | protected function parseLine( Line$line ):self |
453 | 453 | { |
454 | - $this->currentLine= $line; |
|
454 | + $this->currentLine=$line; |
|
455 | 455 | $this->setLevel($line->getIndentLevel()); |
456 | 456 | |
457 | 457 | $this->{'parse'.ucfirst($this->getLineType($line))}($line); |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | */ |
471 | 471 | protected function getLineType( Line$line ):string |
472 | 472 | { |
473 | - $possibleType= self::POSSIBLE_LINE_TYPES; |
|
473 | + $possibleType=self::POSSIBLE_LINE_TYPES; |
|
474 | 474 | |
475 | 475 | for( $i=0; is_array($possibleType); ++$i ){ |
476 | - $possibleType= $possibleType[$line->getChar($i)]??$possibleType[' ']; |
|
476 | + $possibleType=$possibleType[ $line->getChar($i) ]??$possibleType[ ' ' ]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | return $possibleType; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @todo Make this const private when php 7.1 |
490 | 490 | */ |
491 | - const POSSIBLE_LINE_TYPES= [ |
|
491 | + const POSSIBLE_LINE_TYPES=[ |
|
492 | 492 | '`'=> [ |
493 | 493 | '='=> 'expressionHtmlLine', |
494 | 494 | ' '=> 'htmlLine', |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | */ |
513 | 513 | protected function parseHtmlLine( Line$line ):self |
514 | 514 | { |
515 | - return $this->openNode(new StringNode($this,$line))->appendLine($line->slice(1)); |
|
515 | + return $this->openNode(new StringNode($this, $line))->appendLine($line->slice(1)); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | /** |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | */ |
527 | 527 | protected function parseStringLine( Line$line ):self |
528 | 528 | { |
529 | - return $this->openNode(new StringNode($this,$line))->appendLine($this->htmlEntities(trim($line->getContent()))); |
|
529 | + return $this->openNode(new StringNode($this, $line))->appendLine($this->htmlEntities(trim($line->getContent()))); |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | /** |
@@ -540,11 +540,11 @@ discard block |
||
540 | 540 | */ |
541 | 541 | protected function parseExpressionLine( Line$line ):self |
542 | 542 | { |
543 | - $content= $line->slice(1); |
|
544 | - $ent_flag= var_export($this->htsl->getConfig('ENT_flags',$this->docType),true); |
|
545 | - $charset= var_export($this->htsl->getConfig('charset'),true); |
|
543 | + $content=$line->slice(1); |
|
544 | + $ent_flag=var_export($this->htsl->getConfig('ENT_flags', $this->docType), true); |
|
545 | + $charset=var_export($this->htsl->getConfig('charset'), true); |
|
546 | 546 | |
547 | - return $this->openNode(new StringNode($this,$line))->appendLine("<?=htmlentities($content,$ent_flag,$charset,false)?>"); |
|
547 | + return $this->openNode(new StringNode($this, $line))->appendLine("<?=htmlentities($content,$ent_flag,$charset,false)?>"); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | /** |
@@ -558,9 +558,9 @@ discard block |
||
558 | 558 | */ |
559 | 559 | protected function parseExpressionHtmlLine( Line$line ):self |
560 | 560 | { |
561 | - $content= $line->slice(1); |
|
561 | + $content=$line->slice(1); |
|
562 | 562 | |
563 | - return $this->openNode(new StringNode($this,$line))->appendLine("<?$content?>"); |
|
563 | + return $this->openNode(new StringNode($this, $line))->appendLine("<?$content?>"); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | */ |
575 | 575 | protected function parseCommentLine( Line$line ):self |
576 | 576 | { |
577 | - $node= new CommentNode($this,$line); |
|
577 | + $node=new CommentNode($this, $line); |
|
578 | 578 | |
579 | 579 | return $this->openNode($node)->appendLine($node->open()); |
580 | 580 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | protected function parseTagLine( Line$line ):self |
592 | 592 | { |
593 | - $node= new TagNode($this,$line); |
|
593 | + $node=new TagNode($this, $line); |
|
594 | 594 | |
595 | 595 | $this->appendLine($node->open()); |
596 | 596 | |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | */ |
611 | 611 | protected function parseControlLine( Line$line ):self |
612 | 612 | { |
613 | - $node= new ControlNode($this,$line); |
|
613 | + $node=new ControlNode($this, $line); |
|
614 | 614 | |
615 | 615 | return $this->appendLine($node->open())->openNode($node); |
616 | 616 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | */ |
627 | 627 | protected function parseDocControlLine( Line$line ):self |
628 | 628 | { |
629 | - switch( $name= $line->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
629 | + switch( $name=$line->pregGet('/(?<=^@)[\w-:]+/') ){ |
|
630 | 630 | default:{ |
631 | 631 | $this->throw("The @$name is not supported."); |
632 | 632 | }break; |
@@ -658,10 +658,10 @@ discard block |
||
658 | 658 | */ |
659 | 659 | protected function extend( string$fileName ):self |
660 | 660 | { |
661 | - $this->parent= new static($this->htsl,$this->buffer->goSide($fileName)); |
|
661 | + $this->parent=new static($this->htsl, $this->buffer->goSide($fileName)); |
|
662 | 662 | |
663 | - $this->docType= $this->parent->docType; |
|
664 | - $this->indentation= $this->parent->indentation; |
|
663 | + $this->docType=$this->parent->docType; |
|
664 | + $this->indentation=$this->parent->indentation; |
|
665 | 665 | |
666 | 666 | return $this; |
667 | 667 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | */ |
678 | 678 | protected function insertIndentations( string$input ):string |
679 | 679 | { |
680 | - return preg_replace('/(?<=^|\\n)(?!$)/',str_repeat($this->indentation,$this->level-$this->sectionLevel),$input); |
|
680 | + return preg_replace('/(?<=^|\\n)(?!$)/', str_repeat($this->indentation, $this->level-$this->sectionLevel), $input); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** |
@@ -689,13 +689,13 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @return \Htsl\Parser\Document |
691 | 691 | */ |
692 | - protected function include( Line$line ):self |
|
692 | + protected function include(Line$line):self |
|
693 | 693 | { |
694 | - $inclued= (new static($this->htsl,$this->buffer->goSide($line->pregGet('/(?<=\( ).*(?= \))/')),$this))->execute()->content; |
|
694 | + $inclued=(new static($this->htsl, $this->buffer->goSide($line->pregGet('/(?<=\( ).*(?= \))/')), $this))->execute()->content; |
|
695 | 695 | |
696 | - false===$this->indentation or $inclued= $this->insertIndentations($inclued); |
|
696 | + false===$this->indentation or $inclued=$this->insertIndentations($inclued); |
|
697 | 697 | |
698 | - return $this->openNode(new StringNode($this,$line))->append($inclued); |
|
698 | + return $this->openNode(new StringNode($this, $line))->append($inclued); |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | /** |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | protected function defineSection( Line$line ):self |
711 | 711 | { |
712 | - $node= new SectionNode($this,$line); |
|
712 | + $node=new SectionNode($this, $line); |
|
713 | 713 | |
714 | 714 | $node->open(); |
715 | 715 | |
@@ -727,18 +727,18 @@ discard block |
||
727 | 727 | */ |
728 | 728 | protected function showSection( Line$line ):self |
729 | 729 | { |
730 | - $sectionName= $line->pregGet('/(?<=\( ).*(?= \))/'); |
|
730 | + $sectionName=$line->pregGet('/(?<=\( ).*(?= \))/'); |
|
731 | 731 | |
732 | - if( !isset($this->sections[$sectionName]) ){ |
|
733 | - return $this->openNode(new StringNode($this,$line)); |
|
732 | + if( !isset($this->sections[ $sectionName ]) ){ |
|
733 | + return $this->openNode(new StringNode($this, $line)); |
|
734 | 734 | } |
735 | - $content= $this->sections[$sectionName]->content; |
|
735 | + $content=$this->sections[ $sectionName ]->content; |
|
736 | 736 | |
737 | - false===$this->indentation or $content= $this->insertIndentations($content); |
|
737 | + false===$this->indentation or $content=$this->insertIndentations($content); |
|
738 | 738 | |
739 | 739 | $this->append($content); |
740 | 740 | |
741 | - $node= new NamelessSectionNode($this,$line); |
|
741 | + $node=new NamelessSectionNode($this, $line); |
|
742 | 742 | |
743 | 743 | $node->open(); |
744 | 744 | |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | public function setSection( Section$section=null ):self |
756 | 756 | { |
757 | 757 | if( !$section ){ |
758 | - $this->sectionLevel= 0; |
|
759 | - $this->currentSection= null; |
|
758 | + $this->sectionLevel=0; |
|
759 | + $this->currentSection=null; |
|
760 | 760 | |
761 | 761 | return $this; |
762 | 762 | } |
@@ -765,17 +765,17 @@ discard block |
||
765 | 765 | $this->throw('Nesting definition of section is forbidden.'); |
766 | 766 | } |
767 | 767 | |
768 | - if( isset($this->parent->sections[$section->name]) ){ |
|
768 | + if( isset($this->parent->sections[ $section->name ]) ){ |
|
769 | 769 | $this->throw("Section {$section->name} already defined."); |
770 | 770 | } |
771 | 771 | |
772 | - $this->currentSection= $section; |
|
772 | + $this->currentSection=$section; |
|
773 | 773 | |
774 | 774 | if( $section->name ){ |
775 | - $this->parent->sections[$section->name]=$section; |
|
775 | + $this->parent->sections[ $section->name ]=$section; |
|
776 | 776 | } |
777 | 777 | |
778 | - $this->sectionLevel= $this->level+1; |
|
778 | + $this->sectionLevel=$this->level+1; |
|
779 | 779 | |
780 | 780 | return $this; |
781 | 781 | } |
@@ -791,8 +791,8 @@ discard block |
||
791 | 791 | { |
792 | 792 | if( $this->parent ){ |
793 | 793 | foreach( $this->sections as $name=>$section ){ |
794 | - if( !isset($this->parent->sections[$name]) ){ |
|
795 | - $this->parent->sections[$name]=$section; |
|
794 | + if( !isset($this->parent->sections[ $name ]) ){ |
|
795 | + $this->parent->sections[ $name ]=$section; |
|
796 | 796 | }; |
797 | 797 | } |
798 | 798 | } |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | */ |
812 | 812 | public function htmlEntities( string$input ):string |
813 | 813 | { |
814 | - return htmlentities($input,$this->htsl->getConfig('ENT_flags',$this->docType),$this->htsl->getConfig('charset'),false); |
|
814 | + return htmlentities($input, $this->htsl->getConfig('ENT_flags', $this->docType), $this->htsl->getConfig('charset'), false); |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | /** |
@@ -823,12 +823,12 @@ discard block |
||
823 | 823 | */ |
824 | 824 | protected function setLevel( int$level ):self |
825 | 825 | { |
826 | - $level-= $this->level; |
|
826 | + $level-=$this->level; |
|
827 | 827 | |
828 | 828 | if( $level<=0 ){ |
829 | 829 | $this->closeNodes(-$level); |
830 | 830 | }elseif( $level==1 ){ |
831 | - $this->level+= 1; |
|
831 | + $this->level+=1; |
|
832 | 832 | }else{ |
833 | 833 | $this->throw('Indent error.'); |
834 | 834 | } |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | */ |
848 | 848 | protected function openNode( Node$node ):self |
849 | 849 | { |
850 | - array_push($this->openedNodes,$node); |
|
850 | + array_push($this->openedNodes, $node); |
|
851 | 851 | |
852 | 852 | $node->scope and $this->setScope($node); |
853 | 853 | |
@@ -868,13 +868,13 @@ discard block |
||
868 | 868 | if( empty($this->openedNodes) ) return $this; |
869 | 869 | |
870 | 870 | while( $level-->=0 ){ |
871 | - $node= array_pop($this->openedNodes); |
|
871 | + $node=array_pop($this->openedNodes); |
|
872 | 872 | |
873 | 873 | $node->scope and $this->removeScope($node); |
874 | 874 | |
875 | 875 | $closer=$node->close($this->currentLine) and $this->appendLine($closer); |
876 | 876 | |
877 | - $this->level-= $level>=0 ?1:0; |
|
877 | + $this->level-=$level>=0? 1 : 0; |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | return $this; |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | */ |
890 | 890 | protected function setScope( Node$scope ):int |
891 | 891 | { |
892 | - return array_unshift($this->scopes,$scope); |
|
892 | + return array_unshift($this->scopes, $scope); |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | /** |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | */ |
902 | 902 | public function getScope() |
903 | 903 | { |
904 | - return $this->scopes[0]??null; |
|
904 | + return $this->scopes[ 0 ]??null; |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | /** |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | */ |
934 | 934 | protected function appendLine( string$content ):self |
935 | 935 | { |
936 | - false===$this->indentation or $content= str_repeat($this->indentation,$this->level-$this->sectionLevel).$content."\n"; |
|
936 | + false===$this->indentation or $content=str_repeat($this->indentation, $this->level-$this->sectionLevel).$content."\n"; |
|
937 | 937 | |
938 | 938 | return $this->append($content); |
939 | 939 | } |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | * |
980 | 980 | * @throw \Htsl\Parser\HtslParsingException |
981 | 981 | */ |
982 | - public function throw( string$message ) |
|
982 | + public function throw(string$message) |
|
983 | 983 | { |
984 | 984 | throw new HtslParsingException("$message at file {$this->buffer->filePath} line $this->lineNumber"); |
985 | 985 | } |
@@ -198,70 +198,70 @@ discard block |
||
198 | 198 | ], |
199 | 199 | ], |
200 | 200 | 'tag_nodes'=> [ |
201 | - 'SVG1.1'=> $svgTags= [ |
|
201 | + 'SVG1.1'=> $svgTags=[ |
|
202 | 202 | 'svg'=> [ |
203 | 203 | 'out'=> [ |
204 | - 'default_attributes'=> ['xmlns'=> 'http://www.w3.org/2000/svg','version'=> '1.1',], |
|
205 | - 'params'=> ['viewBox',], |
|
204 | + 'default_attributes'=> [ 'xmlns'=> 'http://www.w3.org/2000/svg', 'version'=> '1.1', ], |
|
205 | + 'params'=> [ 'viewBox', ], |
|
206 | 206 | 'scope'=> 'svg', |
207 | 207 | ], |
208 | 208 | 'in'=> [ |
209 | 209 | 'svg'=> [ |
210 | - 'params'=> ['x','y','width','height',], |
|
210 | + 'params'=> [ 'x', 'y', 'width', 'height', ], |
|
211 | 211 | ], |
212 | 212 | ], |
213 | 213 | ], |
214 | - '*'=> [], |
|
214 | + '*'=> [ ], |
|
215 | 215 | 'polygon'=> [ |
216 | - 'params'=> ['points',], |
|
217 | - 'only_in'=> ['svg',], |
|
216 | + 'params'=> [ 'points', ], |
|
217 | + 'only_in'=> [ 'svg', ], |
|
218 | 218 | ], |
219 | 219 | 'polyline'=> [ |
220 | - 'params'=> ['points',], |
|
221 | - 'only_in'=> ['svg',], |
|
220 | + 'params'=> [ 'points', ], |
|
221 | + 'only_in'=> [ 'svg', ], |
|
222 | 222 | ], |
223 | 223 | 'path'=> [ |
224 | - 'params'=> ['d',], |
|
225 | - 'only_in'=> ['svg',], |
|
224 | + 'params'=> [ 'd', ], |
|
225 | + 'only_in'=> [ 'svg', ], |
|
226 | 226 | ], |
227 | 227 | 'line'=> [ |
228 | - 'params'=> ['x1','y1','x2','y2',], |
|
229 | - 'only_in'=> ['svg',], |
|
228 | + 'params'=> [ 'x1', 'y1', 'x2', 'y2', ], |
|
229 | + 'only_in'=> [ 'svg', ], |
|
230 | 230 | ], |
231 | 231 | 'rect'=> [ |
232 | - 'params'=> ['x','y','width','height',], |
|
233 | - 'only_in'=> ['svg',], |
|
232 | + 'params'=> [ 'x', 'y', 'width', 'height', ], |
|
233 | + 'only_in'=> [ 'svg', ], |
|
234 | 234 | ], |
235 | 235 | 'circle'=> [ |
236 | - 'params'=> ['cx','cy','r',], |
|
237 | - 'only_in'=> ['svg',], |
|
236 | + 'params'=> [ 'cx', 'cy', 'r', ], |
|
237 | + 'only_in'=> [ 'svg', ], |
|
238 | 238 | ], |
239 | 239 | 'ellipse'=> [ |
240 | - 'params'=> ['cx','cy','rx','ry',], |
|
241 | - 'only_in'=> ['svg',], |
|
240 | + 'params'=> [ 'cx', 'cy', 'rx', 'ry', ], |
|
241 | + 'only_in'=> [ 'svg', ], |
|
242 | 242 | ], |
243 | 243 | 'text'=> [ |
244 | - 'params'=> ['x','y',], |
|
245 | - 'only_in'=> ['svg',], |
|
244 | + 'params'=> [ 'x', 'y', ], |
|
245 | + 'only_in'=> [ 'svg', ], |
|
246 | 246 | ], |
247 | 247 | ], |
248 | 248 | 'HTML5'=> [ |
249 | - '*'=> [], |
|
249 | + '*'=> [ ], |
|
250 | 250 | ''=> [ |
251 | 251 | 'opener'=> ' ', |
252 | 252 | 'closer'=> '', |
253 | 253 | ], |
254 | 254 | 'charset'=> [ |
255 | 255 | 'name'=> 'meta', |
256 | - 'params'=> ['charset',], |
|
256 | + 'params'=> [ 'charset', ], |
|
257 | 257 | ], |
258 | 258 | 'equiv'=> [ |
259 | 259 | 'name'=> 'meta', |
260 | - 'name_value'=> ['http-equiv','content','scheme',], |
|
260 | + 'name_value'=> [ 'http-equiv', 'content', 'scheme', ], |
|
261 | 261 | ], |
262 | 262 | 'meta'=> [ |
263 | 263 | 'name'=> 'meta', |
264 | - 'name_value'=> ['name','content','scheme',], |
|
264 | + 'name_value'=> [ 'name', 'content', 'scheme', ], |
|
265 | 265 | ], |
266 | 266 | 'php'=> [ |
267 | 267 | 'opener'=> '<?php ', |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | 'multiple'=> [ |
274 | 274 | [ |
275 | 275 | 'pattern'=> '/\{>$/', |
276 | - 'params'=> ['type',], |
|
277 | - 'default_attributes'=> ['codeset'=> 'codeset',], |
|
276 | + 'params'=> [ 'type', ], |
|
277 | + 'default_attributes'=> [ 'codeset'=> 'codeset', ], |
|
278 | 278 | 'embedding'=> 'code', |
279 | 279 | ], |
280 | 280 | [ |
281 | 281 | 'pattern'=> '/.?/', |
282 | 282 | 'name'=> 'code', |
283 | - 'params'=> ['type',], |
|
283 | + 'params'=> [ 'type', ], |
|
284 | 284 | ], |
285 | 285 | ], |
286 | 286 | ], |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | [ |
290 | 290 | 'pattern'=> '/^-js @/', |
291 | 291 | 'name'=> 'script', |
292 | - 'default_attributes'=> ['type'=> 'text/javascript',], |
|
292 | + 'default_attributes'=> [ 'type'=> 'text/javascript', ], |
|
293 | 293 | 'link'=> 'src', |
294 | 294 | ], |
295 | 295 | [ |
296 | 296 | 'pattern'=> '/^-js\{>/', |
297 | 297 | 'name'=> 'script', |
298 | - 'default_attributes'=> ['type'=> 'text/javascript',], |
|
298 | + 'default_attributes'=> [ 'type'=> 'text/javascript', ], |
|
299 | 299 | 'embedding'=> 'js', |
300 | 300 | ], |
301 | 301 | ], |
@@ -305,96 +305,96 @@ discard block |
||
305 | 305 | [ |
306 | 306 | 'pattern'=> '/^-css @/', |
307 | 307 | 'name'=> 'link', |
308 | - 'default_attributes'=> ['rel'=> 'stylesheet','type'=> 'text/css',], |
|
308 | + 'default_attributes'=> [ 'rel'=> 'stylesheet', 'type'=> 'text/css', ], |
|
309 | 309 | 'link'=> 'href', |
310 | 310 | ], |
311 | 311 | [ |
312 | 312 | 'pattern'=> '/^-css\{>/', |
313 | 313 | 'name'=> 'style', |
314 | - 'default_attributes'=> ['type'=> 'text/css',], |
|
314 | + 'default_attributes'=> [ 'type'=> 'text/css', ], |
|
315 | 315 | 'embedding'=> 'css', |
316 | 316 | ], |
317 | 317 | ], |
318 | 318 | ], |
319 | 319 | 'icon'=> [ |
320 | 320 | 'name'=> 'link', |
321 | - 'default_attributes'=> ['rel'=> 'icon',], |
|
322 | - 'params'=> ['sizes',], |
|
321 | + 'default_attributes'=> [ 'rel'=> 'icon', ], |
|
322 | + 'params'=> [ 'sizes', ], |
|
323 | 323 | 'link'=> 'href', |
324 | 324 | ], |
325 | 325 | 'shortcut'=> [ |
326 | 326 | 'name'=> 'link', |
327 | - 'default_attributes'=> ['rel'=> 'shortcut icon','type'=> 'image/x-icon',], |
|
327 | + 'default_attributes'=> [ 'rel'=> 'shortcut icon', 'type'=> 'image/x-icon', ], |
|
328 | 328 | 'link'=> 'href', |
329 | 329 | ], |
330 | 330 | 'link'=> [ |
331 | - 'params'=> ['rel',], |
|
331 | + 'params'=> [ 'rel', ], |
|
332 | 332 | 'link'=> 'href', |
333 | 333 | ], |
334 | 334 | 'script'=> [ |
335 | - 'params'=> ['type',], |
|
335 | + 'params'=> [ 'type', ], |
|
336 | 336 | 'link'=> 'source', |
337 | 337 | ], |
338 | 338 | 'a'=> [ |
339 | 339 | 'link'=> 'href', |
340 | - 'name_value'=> ['name',], |
|
340 | + 'name_value'=> [ 'name', ], |
|
341 | 341 | 'target'=> 'target', |
342 | 342 | ], |
343 | 343 | 'iframe'=> [ |
344 | 344 | 'link'=> 'src', |
345 | - 'default_attributes'=> ['frameborder'=> '0',], |
|
346 | - 'name_value'=> ['name',], |
|
345 | + 'default_attributes'=> [ 'frameborder'=> '0', ], |
|
346 | + 'name_value'=> [ 'name', ], |
|
347 | 347 | ], |
348 | 348 | 'img'=> [ |
349 | 349 | 'link'=> 'src', |
350 | 350 | 'alt'=> 'alt', |
351 | 351 | ], |
352 | - 'fpost'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post',],], |
|
353 | - 'fupload'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post','enctype'=> 'multipart/form-data',],], |
|
354 | - 'fget'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'get',],], |
|
355 | - 'fput'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'put',],], |
|
356 | - 'fpatch'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'patch',],], |
|
357 | - 'fdelete'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'delete',],], |
|
352 | + 'fpost'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', ], ], |
|
353 | + 'fupload'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', 'enctype'=> 'multipart/form-data', ], ], |
|
354 | + 'fget'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'get', ], ], |
|
355 | + 'fput'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'put', ], ], |
|
356 | + 'fpatch'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'patch', ], ], |
|
357 | + 'fdelete'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'delete', ], ], |
|
358 | 358 | |
359 | - 'fhidden'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'hidden',], 'name_value'=> ['name', 'value', 'form',],], |
|
360 | - 'ftext'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'text',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
361 | - 'fsearch'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'search',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
362 | - 'fpassword'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'password',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
363 | - 'femail'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'email',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
364 | - 'furl'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'url',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
365 | - 'ftel'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'tel',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
366 | - 'fnumber'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'number',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder', 'params'=> ['min', 'step', 'max',],], |
|
367 | - 'frange'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'range',], 'name_value'=> ['name', 'value', 'form',], 'params'=> ['min', 'step', 'max',],], |
|
368 | - 'fradio'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'radio',], 'name_value'=> ['name', 'value', 'form',],], |
|
369 | - 'fcheckbox'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'checkbox',], 'name_value'=> ['name', 'value', 'form',],], |
|
370 | - 'fdate'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'date',], 'name_value'=> ['name', 'value', 'form',],], |
|
371 | - 'fmonth'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'month',], 'name_value'=> ['name', 'value', 'form',],], |
|
372 | - 'fweek'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'week',], 'name_value'=> ['name', 'value', 'form',],], |
|
373 | - 'ftime'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'time',], 'name_value'=> ['name', 'value', 'form',],], |
|
374 | - 'fdatetime'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'datetime',], 'name_value'=> ['name', 'value', 'form',],], |
|
375 | - 'fdatetime-local'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'datetime-local',], 'name_value'=> ['name', 'value', 'form',],], |
|
376 | - 'fcolor'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'color',], 'name_value'=> ['name', 'value', 'form',],], |
|
377 | - 'ffile'=> ['name'=> 'input', 'default_attributes'=> ['type'=> 'file',], 'name_value'=> ['name', 'form',], 'params'=> ['accept',],], |
|
359 | + 'fhidden'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'hidden', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
360 | + 'ftext'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'text', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
361 | + 'fsearch'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'search', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
362 | + 'fpassword'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'password', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
363 | + 'femail'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'email', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
364 | + 'furl'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'url', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
365 | + 'ftel'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'tel', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
366 | + 'fnumber'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'number', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', 'params'=> [ 'min', 'step', 'max', ], ], |
|
367 | + 'frange'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'range', ], 'name_value'=> [ 'name', 'value', 'form', ], 'params'=> [ 'min', 'step', 'max', ], ], |
|
368 | + 'fradio'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'radio', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
369 | + 'fcheckbox'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'checkbox', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
370 | + 'fdate'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'date', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
371 | + 'fmonth'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'month', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
372 | + 'fweek'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'week', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
373 | + 'ftime'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'time', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
374 | + 'fdatetime'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'datetime', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
375 | + 'fdatetime-local'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'datetime-local', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
376 | + 'fcolor'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'color', ], 'name_value'=> [ 'name', 'value', 'form', ], ], |
|
377 | + 'ffile'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'file', ], 'name_value'=> [ 'name', 'form', ], 'params'=> [ 'accept', ], ], |
|
378 | 378 | |
379 | - 'fsubmit'=> ['name'=> 'button', 'default_attributes'=> ['type'=> 'submit',], 'name_value'=> ['name', 'value','form',], 'link'=> 'formaction', 'target'=> 'formtarget',], |
|
380 | - 'freset'=> ['name'=> 'button', 'default_attributes'=> ['type'=> 'reset',], 'name_value'=> ['form',],], |
|
381 | - 'button'=> ['name'=> 'button', 'default_attributes'=> ['type'=> 'button',],], |
|
379 | + 'fsubmit'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'submit', ], 'name_value'=> [ 'name', 'value', 'form', ], 'link'=> 'formaction', 'target'=> 'formtarget', ], |
|
380 | + 'freset'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'reset', ], 'name_value'=> [ 'form', ], ], |
|
381 | + 'button'=> [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'button', ], ], |
|
382 | 382 | |
383 | - 'ftextarea'=> ['name'=> 'textarea', 'name_value'=> ['name','value','form',],'alt'=> 'placeholder',], |
|
383 | + 'ftextarea'=> [ 'name'=> 'textarea', 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
384 | 384 | |
385 | 385 | 'fselect'=> [ |
386 | 386 | 'name'=> 'select', |
387 | - 'name_value'=> ['name', 'value','form',], |
|
387 | + 'name_value'=> [ 'name', 'value', 'form', ], |
|
388 | 388 | 'scope'=> 'select', |
389 | 389 | ], |
390 | 390 | 'datalist'=> [ |
391 | - 'params'=> ['id',], |
|
391 | + 'params'=> [ 'id', ], |
|
392 | 392 | 'scope'=> 'datalist', |
393 | 393 | ], |
394 | 394 | 'optgroup'=> [ |
395 | 395 | 'in'=> [ |
396 | 396 | 'select'=> [ |
397 | - 'name_value'=> ['label',], |
|
397 | + 'name_value'=> [ 'label', ], |
|
398 | 398 | ], |
399 | 399 | ], |
400 | 400 | ], |
@@ -402,24 +402,24 @@ discard block |
||
402 | 402 | 'in'=> [ |
403 | 403 | 'select'=> [ |
404 | 404 | 'scope_function'=> function( $scope ){ |
405 | - if( $scope['value']===$this['value'] ){ |
|
406 | - $this['selected']= 'selected'; |
|
405 | + if( $scope[ 'value' ]===$this[ 'value' ] ){ |
|
406 | + $this[ 'selected' ]='selected'; |
|
407 | 407 | }; |
408 | 408 | }, |
409 | - 'name_value'=> ['value',], |
|
409 | + 'name_value'=> [ 'value', ], |
|
410 | 410 | 'alt'=> 'label', |
411 | 411 | ], |
412 | 412 | 'datalist'=> [ |
413 | - 'name_value'=> ['value',], |
|
413 | + 'name_value'=> [ 'value', ], |
|
414 | 414 | ], |
415 | 415 | ], |
416 | 416 | ], |
417 | 417 | |
418 | 418 | 'param'=> [ |
419 | - 'name_value'=> ['name','value',], |
|
419 | + 'name_value'=> [ 'name', 'value', ], |
|
420 | 420 | ], |
421 | 421 | 'source'=> [ |
422 | - 'params'=>['type',], |
|
422 | + 'params'=>[ 'type', ], |
|
423 | 423 | 'link'=> 'src', |
424 | 424 | ], |
425 | 425 | 'base'=> [ |
@@ -427,14 +427,14 @@ discard block |
||
427 | 427 | 'target'=> 'target', |
428 | 428 | ], |
429 | 429 | 'map'=> [ |
430 | - 'params'=> ['name',], |
|
430 | + 'params'=> [ 'name', ], |
|
431 | 431 | 'scope'=> 'area-map', |
432 | 432 | ], |
433 | 433 | 'area'=> [ |
434 | 434 | 'link'=> 'href', |
435 | - 'params'=> ['shape','coords'], |
|
435 | + 'params'=> [ 'shape', 'coords' ], |
|
436 | 436 | 'target'=> 'target', |
437 | - 'only_in'=> ['area-map',], |
|
437 | + 'only_in'=> [ 'area-map', ], |
|
438 | 438 | ], |
439 | 439 | 'audio'=> [ |
440 | 440 | 'link'=> 'src', |
@@ -444,11 +444,11 @@ discard block |
||
444 | 444 | ], |
445 | 445 | 'track'=> [ |
446 | 446 | 'link'=> 'src', |
447 | - 'param'=> ['kind',], |
|
447 | + 'param'=> [ 'kind', ], |
|
448 | 448 | 'alt'=> 'label', |
449 | 449 | ], |
450 | 450 | 'progress'=> [ |
451 | - 'param'=> ['value','max',], |
|
451 | + 'param'=> [ 'value', 'max', ], |
|
452 | 452 | ], |
453 | 453 | ]+$svgTags, |
454 | 454 | ], |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | false===$content and $this->isLast=true; |
47 | 47 | |
48 | - $this->content= rtrim($content,"\n"); |
|
48 | + $this->content=rtrim($content, "\n"); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getContent():string |
59 | 59 | { |
60 | - return ltrim($this->content,"\t"); |
|
60 | + return ltrim($this->content, "\t"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function slice( int$start=0, int...$lengths ):string |
86 | 86 | { |
87 | - return substr($this->getContent(),$start,...array_slice($lengths,0,1)); |
|
87 | + return substr($this->getContent(), $start, ...array_slice($lengths, 0, 1)); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function getChar( int$offset ):string |
100 | 100 | { |
101 | - return substr($this->getcontent(),$offset,1); |
|
101 | + return substr($this->getcontent(), $offset, 1); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function pregMatch( string$pattern ):bool |
114 | 114 | { |
115 | - return !!preg_match($pattern,ltrim($this->content,"\t")); |
|
115 | + return !!preg_match($pattern, ltrim($this->content, "\t")); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function pregGet( string$pattern, /*int|string*/$match=0 ):string |
129 | 129 | { |
130 | - preg_match($pattern,ltrim($this->content,"\t"),$matches); |
|
131 | - return $matches[$match]??''; |
|
130 | + preg_match($pattern, ltrim($this->content, "\t"), $matches); |
|
131 | + return $matches[ $match ]??''; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function pregMap( string$pattern, callable$callback ):array |
145 | 145 | { |
146 | - preg_match_all($pattern,ltrim($this->content,"\t"),$matches); |
|
147 | - return array_map($callback,...$matches); |
|
146 | + preg_match_all($pattern, ltrim($this->content, "\t"), $matches); |
|
147 | + return array_map($callback, ...$matches); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function getIndentLevel():int |
158 | 158 | { |
159 | - return strlen($this->content)-strlen(ltrim($this->content,"\t")); |
|
159 | + return strlen($this->content)-strlen(ltrim($this->content, "\t")); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -228,6 +228,6 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function getSubIndentLine():self |
230 | 230 | { |
231 | - return new static(ltrim($this->getContent(),' ')); |
|
231 | + return new static(ltrim($this->getContent(), ' ')); |
|
232 | 232 | } |
233 | 233 | } |