@@ -18,7 +18,7 @@ |
||
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 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function parseLine( Line$line ):parent |
28 | 28 | { |
29 | - $this->content.= $line->fullContent."\n"; |
|
29 | + $this->content.=$line->fullContent."\n"; |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | } |
@@ -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 | } |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param array $config |
36 | 36 | */ |
37 | - public function __construct( array$config=[] ) |
|
37 | + public function __construct( array$config=[ ] ) |
|
38 | 38 | { |
39 | - $this->config= array_replace_recursive($this->getDefaultConfigs(),$config); |
|
39 | + $this->config=array_replace_recursive($this->getDefaultConfigs(), $config); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function parse( string$content ):string |
50 | 50 | { |
51 | - return $this->execute(new StringBuffer($this,$content)); |
|
51 | + return $this->execute(new StringBuffer($this, $content)); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function compile( string$fromFile, string$toFile=null ) |
63 | 63 | { |
64 | - $fromFile= $this->getFilePath($fromFile); |
|
64 | + $fromFile=$this->getFilePath($fromFile); |
|
65 | 65 | |
66 | - $result= $this->execute(new FileBuffer($this,$fromFile)); |
|
66 | + $result=$this->execute(new FileBuffer($this, $fromFile)); |
|
67 | 67 | |
68 | 68 | if( $toFile ){ |
69 | - return file_put_contents($toFile,$result); |
|
69 | + return file_put_contents($toFile, $result); |
|
70 | 70 | }else{ |
71 | 71 | return $result; |
72 | 72 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function setBasePath( string$basePath ):self |
95 | 95 | { |
96 | - $this->basePath= '/'===substr($basePath,-1) ? substr($basePath,0,-1) : $basePath; |
|
96 | + $this->basePath='/'===substr($basePath, -1)? substr($basePath, 0, -1) : $basePath; |
|
97 | 97 | |
98 | 98 | return $this; |
99 | 99 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function execute( ABuffer$buffer ):string |
119 | 119 | { |
120 | - return (new Document($this,$buffer))->content; |
|
120 | + return (new Document($this, $buffer))->content; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getConfig( string...$keys ) |
131 | 131 | { |
132 | - $result= $this->config; |
|
132 | + $result=$this->config; |
|
133 | 133 | |
134 | 134 | foreach( $keys as $key ){ |
135 | - if( !isset($result[$key]) ) |
|
135 | + if( !isset($result[ $key ]) ) |
|
136 | 136 | { return null; } |
137 | 137 | |
138 | - $result= $result[$key]; |
|
138 | + $result=$result[ $key ]; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | return $result; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | }else{ |
166 | 166 | if( !strlen($path) ) |
167 | 167 | { return $this->basePath.'/'.$filePath; } |
168 | - elseif( '/'===substr($path,-1) ) |
|
168 | + elseif( '/'===substr($path, -1) ) |
|
169 | 169 | { return $path.$filePath; } |
170 | 170 | else |
171 | 171 | { return $path.'/'.$filePath; } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function getFileContent( string$filePath ):string |
183 | 183 | { |
184 | - return isset($this->fileGetter) ? $this->fileGetter($filePath) : file_get_contents($filePath); |
|
184 | + return isset($this->fileGetter)? $this->fileGetter($filePath) : file_get_contents($filePath); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -18,7 +18,7 @@ |
||
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 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function parseLine( Line$line ):parent |
28 | 28 | { |
29 | - $this->content.= $line->fullContent."\n"; |
|
29 | + $this->content.=$line->fullContent."\n"; |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | } |
@@ -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 | } |