@@ -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 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | { |
| 18 | 18 | if( is_callable([static::class, $getter= 'get'.implode('',array_map('ucfirst',explode('_',$attribute))),]) ){ |
| 19 | 19 | return static::$getter(); |
| 20 | - }else{ |
|
| 20 | + } else{ |
|
| 21 | 21 | throw new \Exception(static::class.' has no attribute named '.$attribute); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -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 | |
@@ -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. |
@@ -242,11 +242,11 @@ |
||
| 242 | 242 | return $this->setMultinameAttribute('link',$this->sectionLedBy('@',true),function( string$link ){ |
| 243 | 243 | if( isset($this->config['target']) && ':'===$link{0} ){ |
| 244 | 244 | return 'javascript'.$link; |
| 245 | - }elseif( '//'===($firstTwoLetters=substr($link,0,2)) ){ |
|
| 245 | + } elseif( '//'===($firstTwoLetters=substr($link,0,2)) ){ |
|
| 246 | 246 | return 'http:'.$link; |
| 247 | - }elseif( '\\\\'===$firstTwoLetters ){ |
|
| 247 | + } elseif( '\\\\'===$firstTwoLetters ){ |
|
| 248 | 248 | return 'https://'.substr($link,2); |
| 249 | - }else{ |
|
| 249 | + } else{ |
|
| 250 | 250 | return $this->checkExpression($link); |
| 251 | 251 | } |
| 252 | 252 | }); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $this->parent= $parent; |
| 192 | 192 | $this->docType= $parent->docType; |
| 193 | 193 | $this->indentation= $parent->indentation; |
| 194 | - }else{ |
|
| 194 | + } else{ |
|
| 195 | 195 | $this->parseFirstLine(); |
| 196 | 196 | } |
| 197 | 197 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | { |
| 237 | 237 | if( $this->parent ){ |
| 238 | 238 | return $this->execute()->parent->getContent(); |
| 239 | - }else{ |
|
| 239 | + } else{ |
|
| 240 | 240 | return $this->execute()->content; |
| 241 | 241 | } |
| 242 | 242 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | if( $this->embedment ){ |
| 374 | 374 | $this->embeddingParse($line); |
| 375 | - }else{ |
|
| 375 | + } else{ |
|
| 376 | 376 | $this->parseLine($line); |
| 377 | 377 | } |
| 378 | 378 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | { |
| 400 | 400 | if( $line->content==='<}' ){ |
| 401 | 401 | $this->breakEmbedding(); |
| 402 | - }else{ |
|
| 402 | + } else{ |
|
| 403 | 403 | $this->embedment->parseLine($line->getSubIndentLine()); |
| 404 | 404 | } |
| 405 | 405 | |
@@ -827,9 +827,9 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | if( $level<=0 ){ |
| 829 | 829 | $this->closeNodes(-$level); |
| 830 | - }elseif( $level==1 ){ |
|
| 830 | + } elseif( $level==1 ){ |
|
| 831 | 831 | $this->level+= 1; |
| 832 | - }else{ |
|
| 832 | + } else{ |
|
| 833 | 833 | $this->throw('Indent error.'); |
| 834 | 834 | } |
| 835 | 835 | |
@@ -865,7 +865,9 @@ discard block |
||
| 865 | 865 | */ |
| 866 | 866 | protected function closeNodes( int$level=0 ):self |
| 867 | 867 | { |
| 868 | - if( empty($this->openedNodes) ) return $this; |
|
| 868 | + if( empty($this->openedNodes) ){ |
|
| 869 | + return $this; |
|
| 870 | + } |
|
| 869 | 871 | |
| 870 | 872 | while( $level-->=0 ){ |
| 871 | 873 | $node= array_pop($this->openedNodes); |
@@ -951,7 +953,7 @@ discard block |
||
| 951 | 953 | { |
| 952 | 954 | if( $this->currentSection ){ |
| 953 | 955 | $this->currentSection->append($content); |
| 954 | - }else{ |
|
| 956 | + } else{ |
|
| 955 | 957 | $this->content.=$content; |
| 956 | 958 | } |
| 957 | 959 | |