@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if( $toFile ){ |
| 69 | 69 | return file_put_contents($toFile,$result); |
| 70 | - }else{ |
|
| 70 | + } else{ |
|
| 71 | 71 | return $result; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -159,15 +159,12 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | if( '/'===$filePath{0} ){ |
| 161 | 161 | if( is_null($path) ) |
| 162 | - { return $filePath; } |
|
| 163 | - else |
|
| 162 | + { return $filePath; } else |
|
| 164 | 163 | { return $this->basePath.$filePath; } |
| 165 | - }else{ |
|
| 164 | + } else{ |
|
| 166 | 165 | if( !strlen($path) ) |
| 167 | - { return $this->basePath.'/'.$filePath; } |
|
| 168 | - elseif( '/'===substr($path,-1) ) |
|
| 169 | - { return $path.$filePath; } |
|
| 170 | - else |
|
| 166 | + { return $this->basePath.'/'.$filePath; } elseif( '/'===substr($path,-1) ) |
|
| 167 | + { return $path.$filePath; } else |
|
| 171 | 168 | { return $path.'/'.$filePath; } |
| 172 | 169 | } |
| 173 | 170 | |
@@ -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 | } |
@@ -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 | |
@@ -161,11 +161,11 @@ |
||
| 161 | 161 | if( strlen($link) ){ |
| 162 | 162 | if( isset($this->config['target']) && ':'===$link{0} ){ |
| 163 | 163 | $this->setAttribute($this->config['link'],'javascript'.$link); |
| 164 | - }elseif( '//'===($firstTwoLetters=substr($link,0,2)) ){ |
|
| 164 | + } elseif( '//'===($firstTwoLetters=substr($link,0,2)) ){ |
|
| 165 | 165 | $this->setAttribute($this->config['link'],'http:'.$link); |
| 166 | - }elseif( '\\\\'===$firstTwoLetters ){ |
|
| 166 | + } elseif( '\\\\'===$firstTwoLetters ){ |
|
| 167 | 167 | $this->setAttribute($this->config['link'],'https://'.substr($link,2)); |
| 168 | - }else{ |
|
| 168 | + } else{ |
|
| 169 | 169 | $this->setAttribute($this->config['link'],$this->checkExpression($link)); |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -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 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->parent= $parent; |
| 150 | 150 | $this->docType= $parent->docType; |
| 151 | 151 | $this->indentation= $parent->indentation; |
| 152 | - }else{ |
|
| 152 | + } else{ |
|
| 153 | 153 | $this->parseFirstLine(); |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | if( $this->parent ){ |
| 190 | 190 | return $this->execute()->parent->getContent(); |
| 191 | - }else{ |
|
| 191 | + } else{ |
|
| 192 | 192 | return $this->execute()->content; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | if( $this->embedment ){ |
| 309 | 309 | $this->embeddingParse($line); |
| 310 | - }else{ |
|
| 310 | + } else{ |
|
| 311 | 311 | $this->parseLine($line); |
| 312 | 312 | } |
| 313 | 313 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | { |
| 333 | 333 | if( $line->content==='<}' ){ |
| 334 | 334 | $this->breakEmbedding(); |
| 335 | - }else{ |
|
| 335 | + } else{ |
|
| 336 | 336 | $this->embedment->parseLine($line->getSubIndentLine()); |
| 337 | 337 | } |
| 338 | 338 | return $this; |
@@ -386,8 +386,7 @@ discard block |
||
| 386 | 386 | }break; |
| 387 | 387 | case '`':{ |
| 388 | 388 | if( '='===$line->getChar(1) ) |
| 389 | - { $this->parseExpressionHtmlLine($line); } |
|
| 390 | - else |
|
| 389 | + { $this->parseExpressionHtmlLine($line); } else |
|
| 391 | 390 | { $this->parseHtmlLine($line); } |
| 392 | 391 | }break; |
| 393 | 392 | case '=':{ |
@@ -738,9 +737,9 @@ discard block |
||
| 738 | 737 | |
| 739 | 738 | if( $level<=0 ){ |
| 740 | 739 | $this->closeNodes(-$level); |
| 741 | - }elseif( $level==1 ){ |
|
| 740 | + } elseif( $level==1 ){ |
|
| 742 | 741 | $this->level+= 1; |
| 743 | - }else{ |
|
| 742 | + } else{ |
|
| 744 | 743 | $this->throw('Indent error.'); |
| 745 | 744 | } |
| 746 | 745 | |
@@ -772,7 +771,9 @@ discard block |
||
| 772 | 771 | */ |
| 773 | 772 | protected function closeNodes( int$level=0 ):self |
| 774 | 773 | { |
| 775 | - if( empty($this->openedNodes) ) return $this; |
|
| 774 | + if( empty($this->openedNodes) ){ |
|
| 775 | + return $this; |
|
| 776 | + } |
|
| 776 | 777 | |
| 777 | 778 | while( $level-->=0 ){ |
| 778 | 779 | $node= array_pop($this->openedNodes); |
@@ -850,7 +851,7 @@ discard block |
||
| 850 | 851 | { |
| 851 | 852 | if( $this->currentSection ){ |
| 852 | 853 | $this->currentSection->append($content); |
| 853 | - }else{ |
|
| 854 | + } else{ |
|
| 854 | 855 | $this->content.=$content; |
| 855 | 856 | } |
| 856 | 857 | |
@@ -48,7 +48,9 @@ |
||
| 48 | 48 | /** |
| 49 | 49 | * Real constructor to be rewrite. |
| 50 | 50 | */ |
| 51 | - protected function construct(){} |
|
| 51 | + protected function construct() |
|
| 52 | + { |
|
| 53 | +} |
|
| 52 | 54 | |
| 53 | 55 | /** |
| 54 | 56 | * Parsing line. |