Completed
Push — master ( e75327...ca0c2f )
by Fenz
02:31
created
libs/ReadingBuffer/StringBuffer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct( Htsl$htsl, string$content, string$filePath='' )
26 26
 	{
27
-		if( false!==strpos($content,"\r") ){
27
+		if( false!==strpos($content, "\r") ){
28 28
 			throw new \Exception("Line ending must be LF.", 1);
29 29
 		}
30 30
 
31
-		$this->filePath= $filePath;
31
+		$this->filePath=$filePath;
32 32
 
33
-		$this->lines= array_filter(explode("\n",$content),'strlen');
34
-		array_unshift($this->lines,null);
33
+		$this->lines=array_filter(explode("\n", $content), 'strlen');
34
+		array_unshift($this->lines, null);
35 35
 
36 36
 		parent::__construct($htsl);
37 37
 	}
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function goSide( $filePath ):parent
57 57
 	{
58
-		$filePath= $this->htsl->getFilePath($filePath,dirname($this->filePath));
59
-		$content= $this->htsl->getFileContent($filePath);
58
+		$filePath=$this->htsl->getFilePath($filePath, dirname($this->filePath));
59
+		$content=$this->htsl->getFileContent($filePath);
60 60
 
61
-		return new static($this->htsl,$content,$filePath);
61
+		return new static($this->htsl, $content, $filePath);
62 62
 	}
63 63
 }
Please login to merge, or discard this patch.
libs/ReadingBuffer/Line.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		false===$content and $this->isLast=true;
35 35
 
36
-		$this->content= rtrim($content,"\n");
36
+		$this->content=rtrim($content, "\n");
37 37
 	}
38 38
 
39 39
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function getContent():string
45 45
 	{
46
-		return ltrim($this->content,"\t");
46
+		return ltrim($this->content, "\t");
47 47
 	}
48 48
 
49 49
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function slice( int$start=0, int...$lengths ):string
68 68
 	{
69
-		return substr($this->getContent(),$start,...array_slice($lengths,0,1));
69
+		return substr($this->getContent(), $start, ...array_slice($lengths, 0, 1));
70 70
 	}
71 71
 
72 72
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function getChar( int$offset ):string
80 80
 	{
81
-		return substr($this->getcontent(),$offset,1);
81
+		return substr($this->getcontent(), $offset, 1);
82 82
 	}
83 83
 
84 84
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function pregMatch( string$pattern ):bool
92 92
 	{
93
-		return !!preg_match($pattern,ltrim($this->content,"\t"));
93
+		return !!preg_match($pattern, ltrim($this->content, "\t"));
94 94
 	}
95 95
 
96 96
 	/**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function pregGet( string$pattern, /*int|string*/$match=0 ):string
105 105
 	{
106
-		preg_match($pattern,ltrim($this->content,"\t"),$matches);
107
-		return $matches[$match]??'';
106
+		preg_match($pattern, ltrim($this->content, "\t"), $matches);
107
+		return $matches[ $match ]??'';
108 108
 	}
109 109
 
110 110
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function pregMap( string$pattern, callable$callback ):array
119 119
 	{
120
-		preg_match_all($pattern,ltrim($this->content,"\t"),$matches);
121
-		return array_map($callback,...$matches);
120
+		preg_match_all($pattern, ltrim($this->content, "\t"), $matches);
121
+		return array_map($callback, ...$matches);
122 122
 	}
123 123
 
124 124
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	{
131 131
 		// return (static function( $a ):int{$i=0;while($a{$i}==="\t")++$i;return $i;})($this->content);
132 132
 
133
-		return strlen($this->content)-strlen(ltrim($this->content,"\t"));
133
+		return strlen($this->content)-strlen(ltrim($this->content, "\t"));
134 134
 	}
135 135
 
136 136
 	/**
@@ -190,6 +190,6 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public function getSubIndentLine():self
192 192
 	{
193
-		return new static(ltrim($this->getContent(),' '));
193
+		return new static(ltrim($this->getContent(), ' '));
194 194
 	}
195 195
 }
Please login to merge, or discard this patch.
libs/Embedment/Contracts/AEmbedment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 	 */
31 31
 	final public function __construct( Document$document )
32 32
 	{
33
-		$this->document= $document;
33
+		$this->document=$document;
34 34
 
35 35
 		$this->construct();
36 36
 	}
Please login to merge, or discard this patch.
libs/Embedment/PhpEmbedment.php 1 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 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
libs/Embedment/CodeEmbedment.php 1 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/Htsl.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
libs/Helper/DefaultConfigs.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -168,66 +168,66 @@  discard block
 block discarded – undo
168 168
 				],
169 169
 			],
170 170
 			'tag_nodes'=> [
171
-				'SVG1.1'=> $svgTags= [
171
+				'SVG1.1'=> $svgTags=[
172 172
 					'svg'=> [
173 173
 						'out'=> [
174
-							'default_attributes'=> ['xmlns'=> 'http://www.w3.org/2000/svg','version'=> '1.1',],
175
-							'params'=> ['viewBox',],
174
+							'default_attributes'=> [ 'xmlns'=> 'http://www.w3.org/2000/svg', 'version'=> '1.1', ],
175
+							'params'=> [ 'viewBox', ],
176 176
 							'scope'=> 'svg',
177 177
 						],
178 178
 						'in'=> [
179 179
 							'svg'=> [
180
-								'params'=> ['x','y','width','height',],
180
+								'params'=> [ 'x', 'y', 'width', 'height', ],
181 181
 							],
182 182
 						],
183 183
 					],
184
-					'*'=> [],
184
+					'*'=> [ ],
185 185
 					'polygon'=> [
186
-						'params'=> ['points',],
187
-						'only_in'=> ['svg',],
186
+						'params'=> [ 'points', ],
187
+						'only_in'=> [ 'svg', ],
188 188
 					],
189 189
 					'polyline'=> [
190
-						'params'=> ['points',],
191
-						'only_in'=> ['svg',],
190
+						'params'=> [ 'points', ],
191
+						'only_in'=> [ 'svg', ],
192 192
 					],
193 193
 					'path'=> [
194
-						'params'=> ['d',],
195
-						'only_in'=> ['svg',],
194
+						'params'=> [ 'd', ],
195
+						'only_in'=> [ 'svg', ],
196 196
 					],
197 197
 					'line'=> [
198
-						'params'=> ['x1','y1','x2','y2',],
199
-						'only_in'=> ['svg',],
198
+						'params'=> [ 'x1', 'y1', 'x2', 'y2', ],
199
+						'only_in'=> [ 'svg', ],
200 200
 					],
201 201
 					'rect'=> [
202
-						'params'=> ['x','y','width','height',],
203
-						'only_in'=> ['svg',],
202
+						'params'=> [ 'x', 'y', 'width', 'height', ],
203
+						'only_in'=> [ 'svg', ],
204 204
 					],
205 205
 					'circle'=> [
206
-						'params'=> ['cx','cy','r',],
207
-						'only_in'=> ['svg',],
206
+						'params'=> [ 'cx', 'cy', 'r', ],
207
+						'only_in'=> [ 'svg', ],
208 208
 					],
209 209
 					'ellipse'=> [
210
-						'params'=> ['cx','cy','rx','ry',],
211
-						'only_in'=> ['svg',],
210
+						'params'=> [ 'cx', 'cy', 'rx', 'ry', ],
211
+						'only_in'=> [ 'svg', ],
212 212
 					],
213 213
 					'text'=> [
214
-						'params'=> ['x','y',],
215
-						'only_in'=> ['svg',],
214
+						'params'=> [ 'x', 'y', ],
215
+						'only_in'=> [ 'svg', ],
216 216
 					],
217 217
 				],
218 218
 				'HTML5'=> [
219
-					'*'=> [],
219
+					'*'=> [ ],
220 220
 					'charset'=> [
221 221
 						'name'=> 'meta',
222
-						'params'=> ['charset',],
222
+						'params'=> [ 'charset', ],
223 223
 					],
224 224
 					'equiv'=> [
225 225
 						'name'=> 'meta',
226
-						'name_value'=> ['http-equiv','content','scheme',],
226
+						'name_value'=> [ 'http-equiv', 'content', 'scheme', ],
227 227
 					],
228 228
 					'meta'=> [
229 229
 						'name'=> 'meta',
230
-						'name_value'=> ['name','content','scheme',],
230
+						'name_value'=> [ 'name', 'content', 'scheme', ],
231 231
 					],
232 232
 					'php'=> [
233 233
 						'opener'=> '<?php ',
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
 						'multiple'=> [
240 240
 							[
241 241
 								'pattern'=> '/\{>$/',
242
-								'params'=> ['type',],
243
-								'default_attributes'=> ['codeset'=> 'codeset',],
242
+								'params'=> [ 'type', ],
243
+								'default_attributes'=> [ 'codeset'=> 'codeset', ],
244 244
 								'embedding'=> 'code',
245 245
 							],
246 246
 							[
247 247
 								'pattern'=> '/.?/',
248 248
 								'name'=> 'code',
249
-								'params'=> ['type',],
249
+								'params'=> [ 'type', ],
250 250
 							],
251 251
 						],
252 252
 					],
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 							[
256 256
 								'pattern'=> '/^-js @/',
257 257
 								'name'=> 'script',
258
-								'default_attributes'=> ['type'=> 'text/javascript',],
258
+								'default_attributes'=> [ 'type'=> 'text/javascript', ],
259 259
 								'link'=> 'src',
260 260
 							],
261 261
 							[
262 262
 								'pattern'=> '/^-js\{>/',
263 263
 								'name'=> 'script',
264
-								'default_attributes'=> ['type'=> 'text/javascript',],
264
+								'default_attributes'=> [ 'type'=> 'text/javascript', ],
265 265
 								'embedding'=> 'js',
266 266
 							],
267 267
 						],
@@ -271,90 +271,90 @@  discard block
 block discarded – undo
271 271
 							[
272 272
 								'pattern'=> '/^-css @/',
273 273
 								'name'=> 'link',
274
-								'default_attributes'=> ['rel'=> 'stylesheet','type'=> 'text/css',],
274
+								'default_attributes'=> [ 'rel'=> 'stylesheet', 'type'=> 'text/css', ],
275 275
 								'link'=> 'href',
276 276
 							],
277 277
 							[
278 278
 								'pattern'=> '/^-css\{>/',
279 279
 								'name'=> 'style',
280
-								'default_attributes'=> ['type'=> 'text/css',],
280
+								'default_attributes'=> [ 'type'=> 'text/css', ],
281 281
 								'embedding'=> 'css',
282 282
 							],
283 283
 						],
284 284
 					],
285 285
 					'icon'=> [
286 286
 						'name'=> 'link',
287
-						'default_attributes'=> ['rel'=> 'icon',],
288
-						'params'=> ['sizes',],
287
+						'default_attributes'=> [ 'rel'=> 'icon', ],
288
+						'params'=> [ 'sizes', ],
289 289
 						'link'=> 'href',
290 290
 					],
291 291
 					'shortcut'=> [
292 292
 						'name'=> 'link',
293
-						'default_attributes'=> ['rel'=> 'shortcut icon','type'=> 'image/x-icon',],
293
+						'default_attributes'=> [ 'rel'=> 'shortcut icon', 'type'=> 'image/x-icon', ],
294 294
 						'link'=> 'href',
295 295
 					],
296 296
 					'link'=> [
297 297
 						'name'=> 'link',
298
-						'params'=> ['rel',],
298
+						'params'=> [ 'rel', ],
299 299
 						'link'=> 'href',
300 300
 					],
301 301
 					'a'=> [
302 302
 						'link'=> 'href',
303
-						'name_value'=> ['name',],
303
+						'name_value'=> [ 'name', ],
304 304
 						'target'=> 'target',
305 305
 					],
306 306
 					'iframe'=> [
307 307
 						'link'=> 'src',
308
-						'default_attributes'=> ['frameborder'=> '0',],
309
-						'name_value'=> ['name',],
308
+						'default_attributes'=> [ 'frameborder'=> '0', ],
309
+						'name_value'=> [ 'name', ],
310 310
 					],
311 311
 					'img'=> [
312 312
 						'link'=> 'src',
313 313
 						'alt'=> 'alt',
314 314
 					],
315
-					'form'=>   ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post',],],
316
-					'post'=>   ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post',],],
317
-					'upload'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'post','enctype'=> 'multipart/form-data',],],
318
-					'get'=>    ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> ['name',], 'default_attributes'=> ['method'=> 'get',],],
315
+					'form'=>   [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', ], ],
316
+					'post'=>   [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', ], ],
317
+					'upload'=> [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'post', 'enctype'=> 'multipart/form-data', ], ],
318
+					'get'=>    [ 'name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=> [ 'name', ], 'default_attributes'=> [ 'method'=> 'get', ], ],
319 319
 
320
-					'input'=>          ['name'=> 'input',  'default_attributes'=> ['type'=> 'hidden',],         'name_value'=> ['name', 'value', 'form',],],
321
-					'text'=>  ['out'=> ['name'=> 'input',  'default_attributes'=> ['type'=> 'text',],           'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], 'in'=> ['svg'=> ['params'=> ['x','y',],],],],
322
-					'search'=>         ['name'=> 'input',  'default_attributes'=> ['type'=> 'search',],         'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',],
323
-					'password'=>       ['name'=> 'input',  'default_attributes'=> ['type'=> 'password',],       'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',],
324
-					'email'=>          ['name'=> 'input',  'default_attributes'=> ['type'=> 'email',],          'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',],
325
-					'url'=>            ['name'=> 'input',  'default_attributes'=> ['type'=> 'url',],            'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',],
326
-					'tel'=>            ['name'=> 'input',  'default_attributes'=> ['type'=> 'tel',],            'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',],
327
-					'number'=>         ['name'=> 'input',  'default_attributes'=> ['type'=> 'number',],         'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder', 'params'=> ['min', 'step', 'max',],],
328
-					'range'=>          ['name'=> 'input',  'default_attributes'=> ['type'=> 'range',],          'name_value'=> ['name', 'value', 'form',],                'params'=> ['min', 'step', 'max',],],
329
-					'radio'=>          ['name'=> 'input',  'default_attributes'=> ['type'=> 'radio',],          'name_value'=> ['name', 'value', 'form',],],
330
-					'checkbox'=>       ['name'=> 'input',  'default_attributes'=> ['type'=> 'checkbox',],       'name_value'=> ['name', 'value', 'form',],],
331
-					'date'=>           ['name'=> 'input',  'default_attributes'=> ['type'=> 'date',],           'name_value'=> ['name', 'value', 'form',],],
332
-					'month'=>          ['name'=> 'input',  'default_attributes'=> ['type'=> 'month',],          'name_value'=> ['name', 'value', 'form',],],
333
-					'week'=>           ['name'=> 'input',  'default_attributes'=> ['type'=> 'week',],           'name_value'=> ['name', 'value', 'form',],],
334
-					'time'=>           ['name'=> 'input',  'default_attributes'=> ['type'=> 'time',],           'name_value'=> ['name', 'value', 'form',],],
335
-					'datetime'=>       ['name'=> 'input',  'default_attributes'=> ['type'=> 'datetime',],       'name_value'=> ['name', 'value', 'form',],],
336
-					'datetime-local'=> ['name'=> 'input',  'default_attributes'=> ['type'=> 'datetime-local',], 'name_value'=> ['name', 'value', 'form',],],
337
-					'color'=>          ['name'=> 'input',  'default_attributes'=> ['type'=> 'color',],          'name_value'=> ['name', 'value', 'form',],],
338
-					'file'=>           ['name'=> 'input',  'default_attributes'=> ['type'=> 'file',],           'name_value'=> ['name', 'form',], 'params'=> ['accept',],],
320
+					'input'=>          [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'hidden', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
321
+					'text'=>  [ 'out'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'text', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ], 'in'=> [ 'svg'=> [ 'params'=> [ 'x', 'y', ], ], ], ],
322
+					'search'=>         [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'search', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ],
323
+					'password'=>       [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'password', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ],
324
+					'email'=>          [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'email', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ],
325
+					'url'=>            [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'url', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ],
326
+					'tel'=>            [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'tel', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ],
327
+					'number'=>         [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'number', ], 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', 'params'=> [ 'min', 'step', 'max', ], ],
328
+					'range'=>          [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'range', ], 'name_value'=> [ 'name', 'value', 'form', ], 'params'=> [ 'min', 'step', 'max', ], ],
329
+					'radio'=>          [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'radio', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
330
+					'checkbox'=>       [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'checkbox', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
331
+					'date'=>           [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'date', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
332
+					'month'=>          [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'month', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
333
+					'week'=>           [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'week', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
334
+					'time'=>           [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'time', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
335
+					'datetime'=>       [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'datetime', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
336
+					'datetime-local'=> [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'datetime-local', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
337
+					'color'=>          [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'color', ], 'name_value'=> [ 'name', 'value', 'form', ], ],
338
+					'file'=>           [ 'name'=> 'input', 'default_attributes'=> [ 'type'=> 'file', ], 'name_value'=> [ 'name', 'form', ], 'params'=> [ 'accept', ], ],
339 339
 
340
-					'submit'=>         ['name'=> 'button', 'default_attributes'=> ['type'=> 'submit',],         'name_value'=> ['name', 'value','form',], 'link'=> 'formaction', 'target'=> 'formtarget',],
341
-					'reset'=>          ['name'=> 'button', 'default_attributes'=> ['type'=> 'reset',],          'name_value'=> ['form',],],
342
-					'button'=>         ['name'=> 'button', 'default_attributes'=> ['type'=> 'button',],],
340
+					'submit'=>         [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'submit', ], 'name_value'=> [ 'name', 'value', 'form', ], 'link'=> 'formaction', 'target'=> 'formtarget', ],
341
+					'reset'=>          [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'reset', ], 'name_value'=> [ 'form', ], ],
342
+					'button'=>         [ 'name'=> 'button', 'default_attributes'=> [ 'type'=> 'button', ], ],
343 343
 
344
-					'textarea'=>       ['name'=> 'textarea', 'name_value'=> ['name','value','form',],'alt'=> 'placeholder',],
344
+					'textarea'=>       [ 'name'=> 'textarea', 'name_value'=> [ 'name', 'value', 'form', ], 'alt'=> 'placeholder', ],
345 345
 
346 346
 					'select'=> [
347
-						'name_value'=> ['name', 'value','form',],
347
+						'name_value'=> [ 'name', 'value', 'form', ],
348 348
 						'scope'=> 'select',
349 349
 					],
350 350
 					'datalist'=> [
351
-						'params'=> ['id',],
351
+						'params'=> [ 'id', ],
352 352
 						'scope'=> 'datalist',
353 353
 					],
354 354
 					'optgroup'=> [
355 355
 						'in'=> [
356 356
 							'select'=> [
357
-								'name_value'=> ['label',],
357
+								'name_value'=> [ 'label', ],
358 358
 							],
359 359
 						],
360 360
 					],
@@ -362,20 +362,20 @@  discard block
 block discarded – undo
362 362
 						'in'=> [
363 363
 							'select'=> [
364 364
 								'scope_function'=> function( $scope ){
365
-									if( $scope['value']===$this['value'] ){
366
-										$this['selected']= 'selected';
365
+									if( $scope[ 'value' ]===$this[ 'value' ] ){
366
+										$this[ 'selected' ]='selected';
367 367
 									};
368 368
 								},
369
-								'name_value'=> ['value', 'label',],
369
+								'name_value'=> [ 'value', 'label', ],
370 370
 							],
371 371
 							'datalist'=> [
372
-								'name_value'=> ['value',],
372
+								'name_value'=> [ 'value', ],
373 373
 							],
374 374
 						],
375 375
 					],
376 376
 
377 377
 					'param'=> [
378
-						'name_value'=> ['name','value',],
378
+						'name_value'=> [ 'name', 'value', ],
379 379
 					],
380 380
 				]+$svgTags,
381 381
 			],
Please login to merge, or discard this patch.
libs/Parser/Node/TagNode.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @var array
32 32
 	 */
33
-	private $attributes=[];
33
+	private $attributes=[ ];
34 34
 
35 35
 	/**
36 36
 	 * Real constructor.
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 	protected function construct():parent
41 41
 	{
42 42
 
43
-		$name= $this->line->pregGet('/(?<=^-)[\w-:]+/');
43
+		$name=$this->line->pregGet('/(?<=^-)[\w-:]+/');
44 44
 		$this->name=$name;
45 45
 
46
-		$this->loadConfig($name,$this->document);
46
+		$this->loadConfig($name, $this->document);
47 47
 
48
-		$this->tagName=$this->config['name']??$name;
49
-		$this->isEmpty= $this->line->getChar(-1)==='/' || $this->document->getConfig('empty_tags',$this->tagName);
50
-		isset($this->config['default_attributes']) and array_walk($this->config['default_attributes'],function( $value,$key ){ $this->setAttribute($key,$value); });
48
+		$this->tagName=$this->config[ 'name' ]??$name;
49
+		$this->isEmpty=$this->line->getChar(-1)==='/' || $this->document->getConfig('empty_tags', $this->tagName);
50
+		isset($this->config[ 'default_attributes' ]) and array_walk($this->config[ 'default_attributes' ], function( $value, $key ){ $this->setAttribute($key, $value); });
51 51
 
52 52
 		return $this;
53 53
 	}
@@ -59,30 +59,30 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function open():string
61 61
 	{
62
-		if( isset($this->config['opener']) )
63
-			{ return $this->config['opener']; }
62
+		if( isset($this->config[ 'opener' ]) )
63
+			{ return $this->config[ 'opener' ]; }
64 64
 
65
-		if( isset($this->config['params']) )
65
+		if( isset($this->config[ 'params' ]) )
66 66
 			{ $this->parseParams(); }
67 67
 
68
-		if( isset($this->config['name_value']) )
68
+		if( isset($this->config[ 'name_value' ]) )
69 69
 			{ $this->parseNameValue(); }
70 70
 
71
-		if( isset($this->config['link']) )
71
+		if( isset($this->config[ 'link' ]) )
72 72
 			{ $this->parseLink(); }
73 73
 
74
-		if( isset($this->config['target']) )
74
+		if( isset($this->config[ 'target' ]) )
75 75
 			{ $this->parseTarget(); }
76 76
 
77
-		if( isset($this->config['alt']) )
77
+		if( isset($this->config[ 'alt' ]) )
78 78
 			{ $this->parseAlt(); }
79 79
 
80 80
 		$this->parseCommonAttributes();
81 81
 
82
-		if( isset($this->config['in_scope']) && isset($this->config['scope_function']) && is_callable($this->config['scope_function']) )
83
-			{ $this->config['scope_function']->call($this,$this->document->scope); }
82
+		if( isset($this->config[ 'in_scope' ]) && isset($this->config[ 'scope_function' ]) && is_callable($this->config[ 'scope_function' ]) )
83
+			{ $this->config[ 'scope_function' ]->call($this, $this->document->scope); }
84 84
 
85
-		$finisher= $this->isEmpty ? ' />' : '>';
85
+		$finisher=$this->isEmpty? ' />' : '>';
86 86
 
87 87
 		return "<{$this->tagName}{$this->attributesString}{$finisher}";
88 88
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function close( Line$Line ):string
98 98
 	{
99
-		return $this->isEmpty ? '' : $this->config['closer']??"</{$this->tagName}>";
99
+		return $this->isEmpty? '' : $this->config[ 'closer' ]??"</{$this->tagName}>";
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function getEmbed():string
108 108
 	{
109
-		return $this->config['embedding']??'';
109
+		return $this->config[ 'embedding' ]??'';
110 110
 	}
111 111
 
112 112
 	/**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function getScope()
118 118
 	{
119
-		return $this->config['scope']??null;
119
+		return $this->config[ 'scope' ]??null;
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	protected function parseParams():self
128 128
 	{
129
-		$params= preg_split('/(?<!\\\\)\\|/',$this->line->pregGet('/^-[\w-:]+\((.*?)\)(?= |(\\{>)?$)/',1));
129
+		$params=preg_split('/(?<!\\\\)\\|/', $this->line->pregGet('/^-[\w-:]+\((.*?)\)(?= |(\\{>)?$)/', 1));
130 130
 
131
-		if( ($m= count($params)) != ($n= count($this->config['params'])) ){$this->document->throw("Tag $this->name has $n parameters $m given.");}
131
+		if( ($m=count($params))!=($n=count($this->config[ 'params' ])) ){$this->document->throw("Tag $this->name has $n parameters $m given."); }
132 132
 
133
-		array_map(function( $key, $value ){return $this->setAttribute($key,str_replace('\\|','|',$value));},$this->config['params'],$params);
133
+		array_map(function( $key, $value ){return $this->setAttribute($key, str_replace('\\|', '|', $value)); },$this->config[ 'params' ], $params);
134 134
 
135 135
 		return $this;
136 136
 	}
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function parseNameValue():self
144 144
 	{
145
-		$params= $this->line->pregGet('/ <(.*?)>(?= |$)/',1)
146
-		 and $params= preg_split('/(?<!\\\\)\\|/',$params)
147
-		  and array_map(function( $key, $value ){return isset($key)&&isset($value) ? $this->setAttribute($key,$this->checkExpression(str_replace('\\|','|',$value))) : '';},$this->config['name_value'],$params);
145
+		$params=$this->line->pregGet('/ <(.*?)>(?= |$)/', 1)
146
+		 and $params=preg_split('/(?<!\\\\)\\|/', $params)
147
+		  and array_map(function( $key, $value ){return isset($key) && isset($value)? $this->setAttribute($key, $this->checkExpression(str_replace('\\|', '|', $value))) : ''; },$this->config[ 'name_value' ], $params);
148 148
 
149 149
 		return $this;
150 150
 	}
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	protected function parseLink():self
158 158
 	{
159
-		$link= $this->line->pregGet('/ @((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1);
159
+		$link=$this->line->pregGet('/ @((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1);
160 160
 
161 161
 		if( strlen($link) ){
162
-			if( isset($this->config['target']) && ':'===$link{0} ){
163
-				$this->setAttribute($this->config['link'],'javascript'.$link);
164
-			}elseif( '//'===($firstTwoLetters=substr($link,0,2)) ){
165
-				$this->setAttribute($this->config['link'],'http:'.$link);
162
+			if( isset($this->config[ 'target' ]) && ':'===$link{0} ){
163
+				$this->setAttribute($this->config[ 'link' ], 'javascript'.$link);
164
+			}elseif( '//'===($firstTwoLetters=substr($link, 0, 2)) ){
165
+				$this->setAttribute($this->config[ 'link' ], 'http:'.$link);
166 166
 			}elseif( '\\\\'===$firstTwoLetters ){
167
-				$this->setAttribute($this->config['link'],'https://'.substr($link,2));
167
+				$this->setAttribute($this->config[ 'link' ], 'https://'.substr($link, 2));
168 168
 			}else{
169
-				$this->setAttribute($this->config['link'],$this->checkExpression($link));
169
+				$this->setAttribute($this->config[ 'link' ], $this->checkExpression($link));
170 170
 			}
171 171
 		}
172 172
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	protected function parseTarget():self
182 182
 	{
183
-		$target= $this->line->pregGet('/ >((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1);
183
+		$target=$this->line->pregGet('/ >((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1);
184 184
 
185 185
 		if( strlen($target) ){
186
-			$this->setAttribute($this->config['target'],$this->checkExpression($target));
186
+			$this->setAttribute($this->config[ 'target' ], $this->checkExpression($target));
187 187
 		}
188 188
 
189 189
 		return $this;
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	protected function parseAlt():self
198 198
 	{
199
-		$alt= $this->line->pregGet('/ _((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1);
199
+		$alt=$this->line->pregGet('/ _((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1);
200 200
 
201 201
 		if( strlen($alt) ){
202
-			$this->setAttribute($this->config['alt'],$this->checkExpression($alt));
202
+			$this->setAttribute($this->config[ 'alt' ], $this->checkExpression($alt));
203 203
 		}
204 204
 
205 205
 		return $this;
@@ -212,33 +212,33 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	protected function parseCommonAttributes():string
214 214
 	{
215
-		$attributes= '';
215
+		$attributes='';
216 216
 
217
-		$id= $this->line->pregGet('/ #([^ ]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1)
218
-		 and $this->setAttribute('id',$id);
217
+		$id=$this->line->pregGet('/ #([^ ]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1)
218
+		 and $this->setAttribute('id', $id);
219 219
 
220
-		$classes= $this->line->pregGet('/ \.[^ ]+(?= |$)/')
221
-		 and preg_match_all('/\.((?(?!\()[^.]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\))))/',$classes,$matches)
222
-		  and $classes= implode(' ',array_filter(array_map(function( $className ){return $this->checkExpression($className);},$matches[1])))
223
-		   and $this->setAttribute('class',$classes);
220
+		$classes=$this->line->pregGet('/ \.[^ ]+(?= |$)/')
221
+		 and preg_match_all('/\.((?(?!\()[^.]+|(?<exp>\((?:[^()]+|(?&exp)?)+?\))))/', $classes, $matches)
222
+		  and $classes=implode(' ', array_filter(array_map(function( $className ){return $this->checkExpression($className); },$matches[ 1 ])))
223
+		   and $this->setAttribute('class', $classes);
224 224
 
225
-		$title= $this->line->pregGet('/ \^((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/',1)
226
-		 and $this->setAttribute('title',$title);
225
+		$title=$this->line->pregGet('/ \^((?!\()(?:[^ ]| (?=[a-zA-Z0-9]))+|(?<exp>\((?:[^()]+|(?&exp)?)+?\)))(?= |$)/', 1)
226
+		 and $this->setAttribute('title', $title);
227 227
 
228
-		$style= $this->line->pregGet('/ \[([^\]]+;)(?=\]( |$))/',1)
229
-		 and $this->setAttribute('style',$style);
228
+		$style=$this->line->pregGet('/ \[([^\]]+;)(?=\]( |$))/', 1)
229
+		 and $this->setAttribute('style', $style);
230 230
 
231
-		$eventListeners= $this->line->pregMap('/ %(\w+)\{>(.*?)<\}(?= |$)/',function( $string, $name, $code ){
232
-			$this->setAttribute('on'.$name,str_replace('"','&quot;',$code));
231
+		$eventListeners=$this->line->pregMap('/ %(\w+)\{>(.*?)<\}(?= |$)/', function( $string, $name, $code ){
232
+			$this->setAttribute('on'.$name, str_replace('"', '&quot;', $code));
233 233
 		})
234
-		 and implode('',$eventListeners);
234
+		 and implode('', $eventListeners);
235 235
 
236
-		$other= $this->line->pregGet('/(?<=\{).*?(?=;\}( |$))/')
236
+		$other=$this->line->pregGet('/(?<=\{).*?(?=;\}( |$))/')
237 237
 		 and array_map(function( $keyValue ){
238
-			preg_replace_callback('/^([\w-:]+)(?:\?(.+?))?(?:\=(.*))?$/',function($matches){
239
-				$this->setAttribute($matches[1],($matches[3]??$matches[1])?:$matches[1],$matches[2]??null);
238
+			preg_replace_callback('/^([\w-:]+)(?:\?(.+?))?(?:\=(.*))?$/', function( $matches ){
239
+				$this->setAttribute($matches[ 1 ], ($matches[ 3 ]??$matches[ 1 ])?: $matches[ 1 ], $matches[ 2 ]??null);
240 240
 			},$keyValue);
241
-		},explode(';',$other));
241
+		},explode(';', $other));
242 242
 
243 243
 		return $attributes;
244 244
 	}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	protected function checkExpression( string$value ):string
254 254
 	{
255
-		return preg_match('/^\(.*\)$/',$value) ? '<?='.substr($value,1,-1).'?>' : str_replace('"','&quot;',$value);
255
+		return preg_match('/^\(.*\)$/', $value)? '<?='.substr($value, 1, -1).'?>' : str_replace('"', '&quot;', $value);
256 256
 	}
257 257
 
258 258
 	/**
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 	protected function getAttributesString():string
264 264
 	{
265 265
 		ksort($this->attributes);
266
-		return implode('',array_map(static function( string$key, array$data ){
267
-			return (isset($data['condition'])&&strlen($data['condition'])?
268
-				"<?php if( {$data['condition']} ){?> $key=\"{$data['value']}\"<?php }?>"
266
+		return implode('', array_map(static function( string$key, array$data ){
267
+			return (isset($data[ 'condition' ]) && strlen($data[ 'condition' ])?
268
+				"<?php if( {$data[ 'condition' ]} ){?> $key=\"{$data[ 'value' ]}\"<?php }?>"
269 269
 				:
270
-				" $key=\"{$data['value']}\""
270
+				" $key=\"{$data[ 'value' ]}\""
271 271
 			);
272
-		},array_keys($this->attributes),$this->attributes));
272
+		},array_keys($this->attributes), $this->attributes));
273 273
 	}
274 274
 
275 275
 	/**
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	protected function setAttribute( string$key, string$value, string$condition=null ):self
283 283
 	{
284
-		if( isset($this->attributes[$key]) )
284
+		if( isset($this->attributes[ $key ]) )
285 285
 			{ $this->document->throw("Attribute $key of $this->name cannot redeclare."); }
286 286
 
287
-		$this->attributes[$key]=[
287
+		$this->attributes[ $key ]=[
288 288
 			'value'=> $value,
289 289
 			'condition'=> $condition,
290 290
 		];
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 */
307 307
 	public function offsetExists( $offset ):bool
308 308
 	{
309
-		return isset($this->attributes[$offset]);
309
+		return isset($this->attributes[ $offset ]);
310 310
 	}
311 311
 
312 312
 	/**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public function offsetGet( $offset )
320 320
 	{
321
-		return $this->attributes[$offset]??null;
321
+		return $this->attributes[ $offset ]??null;
322 322
 	}
323 323
 
324 324
 	/**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 */
330 330
 	public function offsetSet( $offset, $value )
331 331
 	{
332
-		$this->setAttribute($offset,$value);
332
+		$this->setAttribute($offset, $value);
333 333
 	}
334 334
 
335 335
 	/**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	public function offsetUnset( $offset )
341 341
 	{
342
-		if( isset($this->attributes[$offset]) )
343
-			{ unset($this->attributes[$offset]); }
342
+		if( isset($this->attributes[ $offset ]) )
343
+			{ unset($this->attributes[ $offset ]); }
344 344
 	}
345 345
 }
Please login to merge, or discard this patch.