Completed
Push — master ( 988761...5d514e )
by Fenz
02:27
created
libs/Embedment/CodeEmbedment.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	 *
15 15
 	 * @param  \Htsl\ReadingBuffer\Line $line
16 16
 	 *
17
-	 * @return \Htsl\Embedment\Contracts
17
+	 * @return CodeEmbedment
18 18
 	 */
19 19
 	public function parseLine( Line$line ):parent
20 20
 	{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
libs/Embedment/CssEmbedment.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	 *
15 15
 	 * @param  \Htsl\ReadingBuffer\Line $line
16 16
 	 *
17
-	 * @return \Htsl\Embedment\Contracts
17
+	 * @return CssEmbedment
18 18
 	 */
19 19
 	public function parseLine( Line$line ):parent
20 20
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	 */
19 19
 	public function parseLine( Line$line ):parent
20 20
 	{
21
-		$this->content.= $line->content;
21
+		$this->content.=$line->content;
22 22
 		return $this;
23 23
 	}
24 24
 }
Please login to merge, or discard this patch.
libs/Embedment/JsEmbedment.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	 *
23 23
 	 * @param  \Htsl\ReadingBuffer\Line $line
24 24
 	 *
25
-	 * @return \Htsl\Embedment\Contracts
25
+	 * @return JsEmbedment
26 26
 	 */
27 27
 	public function parseLine( Line$line ):parent
28 28
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
libs/Embedment/PhpEmbedment.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	 *
15 15
 	 * @param  \Htsl\ReadingBuffer\Line $line
16 16
 	 *
17
-	 * @return \Htsl\Embedment\Contracts
17
+	 * @return PhpEmbedment
18 18
 	 */
19 19
 	public function parseLine( Line$line ):parent
20 20
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	 */
19 19
 	public function parseLine( Line$line ):parent
20 20
 	{
21
-		$this->content.= $line->content;
21
+		$this->content.=$line->content;
22 22
 		return $this;
23 23
 	}
24 24
 }
Please login to merge, or discard this patch.
libs/Embedment/TextEmbedment.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	 *
15 15
 	 * @param  \Htsl\ReadingBuffer\Line $line
16 16
 	 *
17
-	 * @return \Htsl\Embedment\Contracts
17
+	 * @return TextEmbedment
18 18
 	 */
19 19
 	public function parseLine( Line$line ):parent
20 20
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
libs/Htsl.php 3 patches
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@
 block discarded – undo
173 173
 	 *
174 174
 	 * @access public
175 175
 	 *
176
-	 * @param  string $keys
176
+	 * @param  string[] $keys
177 177
 	 *
178 178
 	 * @return mixed
179 179
 	 */
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @param array $config
58 58
 	 */
59
-	public function __construct( array$config=[] )
59
+	public function __construct( array$config=[ ] )
60 60
 	{
61
-		$this->config= array_replace_recursive($this->getDefaultConfigs(),$config);
61
+		$this->config=array_replace_recursive($this->getDefaultConfigs(), $config);
62 62
 	}
63 63
 
64 64
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function parse( string$content ):string
76 76
 	{
77
-		return $this->execute(new StringBuffer($this,$content));
77
+		return $this->execute(new StringBuffer($this, $content));
78 78
 	}
79 79
 
80 80
 	/**
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function compile( string$fromFile, string$toFile='' )
93 93
 	{
94
-		$fromFile= $this->getFilePath($fromFile);
94
+		$fromFile=$this->getFilePath($fromFile);
95 95
 
96
-		$result= $this->execute(new FileBuffer($this,$fromFile));
96
+		$result=$this->execute(new FileBuffer($this, $fromFile));
97 97
 
98 98
 		if( $toFile ){
99
-			return file_put_contents($toFile,$result);
99
+			return file_put_contents($toFile, $result);
100 100
 		}else{
101 101
 			return $result;
102 102
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function setBasePath( string$basePath ):self
133 133
 	{
134
-		$this->basePath= '/'===substr($basePath,-1) ? substr($basePath,0,-1) : $basePath;
134
+		$this->basePath='/'===substr($basePath, -1)? substr($basePath, 0, -1) : $basePath;
135 135
 
136 136
 		return $this;
137 137
 	}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	protected function execute( ABuffer$buffer ):string
165 165
 	{
166
-		return (new Document($this,$buffer))->content;
166
+		return (new Document($this, $buffer))->content;
167 167
 	}
168 168
 
169 169
 	/**
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function getConfig( string...$keys )
181 181
 	{
182
-		$result= $this->config;
182
+		$result=$this->config;
183 183
 
184 184
 		foreach( $keys as $key ){
185
-			if( !isset($result[$key]) )
185
+			if( !isset($result[ $key ]) )
186 186
 				{ return null; }
187 187
 
188
-			$result= $result[$key];
188
+			$result=$result[ $key ];
189 189
 		}
190 190
 
191 191
 		return $result;
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		}else{
220 220
 			if( !strlen($path) )
221 221
 				{ return $this->basePath.'/'.$filePath; }
222
-			elseif( '/'===substr($path,-1) )
222
+			elseif( '/'===substr($path, -1) )
223 223
 				{ return $path.$filePath; }
224 224
 			else
225 225
 				{ return $path.'/'.$filePath; }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function getFileContent( string$filePath ):string
242 242
 	{
243
-		return isset($this->fileGetter) ? $this->fileGetter($filePath) : file_get_contents($filePath);
243
+		return isset($this->fileGetter)? $this->fileGetter($filePath) : file_get_contents($filePath);
244 244
 	}
245 245
 
246 246
 	/**
Please login to merge, or discard this patch.
libs/Helper/TGetter.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
libs/Helper/TSetter.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	 */
15 15
 	public function __set( $attribute, $value )
16 16
 	{
17
-		if( is_callable([static::class, $setter= 'set'.implode('',array_map('ucfirst',explode('_',$attribute))),]) ){
17
+		if( is_callable([ static::class, $setter='set'.implode('', array_map('ucfirst', explode('_', $attribute))), ]) ){
18 18
 			return static::$setter($value);
19 19
 		}else{
20 20
 			throw new \Exception(static::class.' has no attribute named '.$attribute);
Please login to merge, or discard this patch.
libs/Parser/Document.php 5 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
 			return $this;
166 166
 		}
167 167
 		return $this->lineByLine()
168
-		            ->bubbleSections()
168
+					->bubbleSections()
169 169
 		;
170 170
 	}
171 171
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
 	 *
213 213
 	 * @param  [ string, ] ...$keys
214 214
 	 *
215
-	 * @return mixed
215
+	 * @return string
216 216
 	 */
217 217
 	public function getConfig( string...$keys )
218 218
 	{
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		}
324 324
 
325 325
 		$this->docType= $line->content;
326
-		$docTypeContent= $this->getConfig('doc_types') or $this->throw("DocType $this->docType is not supported");
326
+		$docTypeContent= $this->getConfig('doc_types') or $this->throw("doctype $this->docType is not supported");
327 327
 
328 328
 		$this->indentation= $this->htsl->getConfig('indentation',$this->docType) ?? ( function( $scalarOrFalse ){ return is_scalar($scalarOrFalse)?$scalarOrFalse:false; } )($this->htsl->getConfig('indentation'));
329 329
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 		}
786 786
 
787 787
 		if( isset($this->parent->sections[$section->name]) ){
788
-			$this->throw("Section {$section->name} already defined.");
788
+			$this->throw("section {$section->name} already defined.");
789 789
 		}
790 790
 
791 791
 		$this->currentSection= $section;
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.