@@ -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 | /** |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | - public function parse( string$content ):string |
|
| 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 | /** |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return int|string |
| 61 | 61 | */ |
| 62 | - public function compile( string$fromFile, string$toFile=null ) |
|
| 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 | - if( $toFile ){ |
|
| 69 | - return file_put_contents($toFile,$result); |
|
| 70 | - }else{ |
|
| 68 | + if ($toFile) { |
|
| 69 | + return file_put_contents($toFile, $result); |
|
| 70 | + }else { |
|
| 71 | 71 | return $result; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @param callable $fileGetter |
| 79 | 79 | */ |
| 80 | - public function setFileGetter( callable$fileGetter ):self |
|
| 80 | + public function setFileGetter(callable$fileGetter):self |
|
| 81 | 81 | { |
| 82 | 82 | $this->fileGetter=$fileGetter; |
| 83 | 83 | |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return self |
| 93 | 93 | */ |
| 94 | - public function setBasePath( string$basePath ):self |
|
| 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 | } |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @return string |
| 117 | 117 | */ |
| 118 | - protected function execute( ABuffer$buffer ):string |
|
| 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 | /** |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return mixed |
| 129 | 129 | */ |
| 130 | - public function getConfig( string...$keys ) |
|
| 130 | + public function getConfig(string...$keys) |
|
| 131 | 131 | { |
| 132 | - $result= $this->config; |
|
| 132 | + $result=$this->config; |
|
| 133 | 133 | |
| 134 | - foreach( $keys as $key ){ |
|
| 135 | - if( !isset($result[$key]) ) |
|
| 134 | + foreach ($keys as $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; |
@@ -149,23 +149,23 @@ discard block |
||
| 149 | 149 | * |
| 150 | 150 | * @return string |
| 151 | 151 | */ |
| 152 | - public function getFilePath( string$filePath, string$path=null ):string |
|
| 152 | + public function getFilePath(string$filePath, string$path=null):string |
|
| 153 | 153 | { |
| 154 | - if( !isset($this->basePath) ) |
|
| 154 | + if (!isset($this->basePath)) |
|
| 155 | 155 | { throw new \Exception('BasePath musbe set.'); } |
| 156 | 156 | |
| 157 | - if( !strlen($filePath) ) |
|
| 157 | + if (!strlen($filePath)) |
|
| 158 | 158 | { throw new \Exception('FilePath cannot be empty.'); } |
| 159 | 159 | |
| 160 | - if( '/'===$filePath{0} ){ |
|
| 161 | - if( is_null($path) ) |
|
| 160 | + if ('/'===$filePath{0} ) { |
|
| 161 | + if (is_null($path)) |
|
| 162 | 162 | { return $filePath; } |
| 163 | 163 | else |
| 164 | 164 | { return $this->basePath.$filePath; } |
| 165 | - }else{ |
|
| 166 | - if( !strlen($path) ) |
|
| 165 | + }else { |
|
| 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; } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param string $filePath |
| 180 | 180 | * @return string |
| 181 | 181 | */ |
| 182 | - public function getFileContent( string$filePath ):string |
|
| 182 | + public function getFileContent(string$filePath):string |
|
| 183 | 183 | { |
| 184 | 184 | return isset($this->fileGetter) ? $this->fileGetter($filePath) : file_get_contents($filePath); |
| 185 | 185 | } |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | * |
| 14 | 14 | * @return mixed |
| 15 | 15 | */ |
| 16 | - public function __get( $attribute ) |
|
| 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 | - }else{ |
|
| 20 | + }else { |
|
| 21 | 21 | throw new \Exception(static::class.' has no attribute named '.$attribute); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -167,66 +167,66 @@ discard block |
||
| 167 | 167 | ], |
| 168 | 168 | ], |
| 169 | 169 | 'tag_nodes'=>[ |
| 170 | - 'SVG1.1'=> $svgTags= [ |
|
| 170 | + 'SVG1.1'=> $svgTags=[ |
|
| 171 | 171 | 'svg'=> [ |
| 172 | 172 | 'out'=>[ |
| 173 | - 'default_attributes'=> ['xmlns'=>'http://www.w3.org/2000/svg','version'=>'1.1',], |
|
| 174 | - 'params'=> ['viewBox',], |
|
| 173 | + 'default_attributes'=> ['xmlns'=>'http://www.w3.org/2000/svg', 'version'=>'1.1', ], |
|
| 174 | + 'params'=> ['viewBox', ], |
|
| 175 | 175 | 'scope'=> 'svg', |
| 176 | 176 | ], |
| 177 | 177 | 'in'=>[ |
| 178 | 178 | 'svg'=>[ |
| 179 | - 'params'=> ['x','y','width','height',], |
|
| 179 | + 'params'=> ['x', 'y', 'width', 'height', ], |
|
| 180 | 180 | ], |
| 181 | 181 | ], |
| 182 | 182 | ], |
| 183 | 183 | '*'=> [], |
| 184 | 184 | 'polygon'=> [ |
| 185 | - 'params'=> ['points',], |
|
| 186 | - 'only_in'=> ['svg',], |
|
| 185 | + 'params'=> ['points', ], |
|
| 186 | + 'only_in'=> ['svg', ], |
|
| 187 | 187 | ], |
| 188 | 188 | 'polyline'=> [ |
| 189 | - 'params'=> ['points',], |
|
| 190 | - 'only_in'=> ['svg',], |
|
| 189 | + 'params'=> ['points', ], |
|
| 190 | + 'only_in'=> ['svg', ], |
|
| 191 | 191 | ], |
| 192 | 192 | 'path'=> [ |
| 193 | - 'params'=> ['d',], |
|
| 194 | - 'only_in'=> ['svg',], |
|
| 193 | + 'params'=> ['d', ], |
|
| 194 | + 'only_in'=> ['svg', ], |
|
| 195 | 195 | ], |
| 196 | 196 | 'line'=> [ |
| 197 | - 'params'=> ['x1','y1','x2','y2',], |
|
| 198 | - 'only_in'=> ['svg',], |
|
| 197 | + 'params'=> ['x1', 'y1', 'x2', 'y2', ], |
|
| 198 | + 'only_in'=> ['svg', ], |
|
| 199 | 199 | ], |
| 200 | 200 | 'rect'=> [ |
| 201 | - 'params'=> ['x','y','width','height',], |
|
| 202 | - 'only_in'=> ['svg',], |
|
| 201 | + 'params'=> ['x', 'y', 'width', 'height', ], |
|
| 202 | + 'only_in'=> ['svg', ], |
|
| 203 | 203 | ], |
| 204 | 204 | 'circle'=> [ |
| 205 | - 'params'=> ['cx','cy','r',], |
|
| 206 | - 'only_in'=> ['svg',], |
|
| 205 | + 'params'=> ['cx', 'cy', 'r', ], |
|
| 206 | + 'only_in'=> ['svg', ], |
|
| 207 | 207 | ], |
| 208 | 208 | 'ellipse'=> [ |
| 209 | - 'params'=> ['cx','cy','rx','ry',], |
|
| 210 | - 'only_in'=> ['svg',], |
|
| 209 | + 'params'=> ['cx', 'cy', 'rx', 'ry', ], |
|
| 210 | + 'only_in'=> ['svg', ], |
|
| 211 | 211 | ], |
| 212 | 212 | 'text'=> [ |
| 213 | - 'params'=> ['x','y',], |
|
| 214 | - 'only_in'=> ['svg',], |
|
| 213 | + 'params'=> ['x', 'y', ], |
|
| 214 | + 'only_in'=> ['svg', ], |
|
| 215 | 215 | ], |
| 216 | 216 | ], |
| 217 | 217 | 'HTML5'=> [ |
| 218 | 218 | '*'=> [], |
| 219 | 219 | 'charset'=> [ |
| 220 | 220 | 'name'=> 'meta', |
| 221 | - 'params'=> ['charset',], |
|
| 221 | + 'params'=> ['charset', ], |
|
| 222 | 222 | ], |
| 223 | 223 | 'equiv'=> [ |
| 224 | 224 | 'name'=> 'meta', |
| 225 | - 'name_value'=> ['http-equiv','content','scheme',], |
|
| 225 | + 'name_value'=> ['http-equiv', 'content', 'scheme', ], |
|
| 226 | 226 | ], |
| 227 | 227 | 'meta'=> [ |
| 228 | 228 | 'name'=> 'meta', |
| 229 | - 'name_value'=> ['name','content','scheme',], |
|
| 229 | + 'name_value'=> ['name', 'content', 'scheme', ], |
|
| 230 | 230 | ], |
| 231 | 231 | 'php'=> [ |
| 232 | 232 | 'opener'=> '<?php ', |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | 'multiple'=>[ |
| 239 | 239 | [ |
| 240 | 240 | 'pattern'=> '/\{>$/', |
| 241 | - 'params'=> ['type',], |
|
| 242 | - 'default_attributes'=> ['codeset'=>'codeset',], |
|
| 241 | + 'params'=> ['type', ], |
|
| 242 | + 'default_attributes'=> ['codeset'=>'codeset', ], |
|
| 243 | 243 | 'embedding'=> 'code', |
| 244 | 244 | ], |
| 245 | 245 | [ |
| 246 | 246 | 'pattern'=> '/.?/', |
| 247 | 247 | 'name'=> 'code', |
| 248 | - 'params'=> ['type',], |
|
| 248 | + 'params'=> ['type', ], |
|
| 249 | 249 | ], |
| 250 | 250 | ], |
| 251 | 251 | ], |
@@ -254,13 +254,13 @@ discard block |
||
| 254 | 254 | [ |
| 255 | 255 | 'pattern'=> '/^-js @/', |
| 256 | 256 | 'name'=> 'script', |
| 257 | - 'default_attributes'=> ['type'=>'text/javascript',], |
|
| 257 | + 'default_attributes'=> ['type'=>'text/javascript', ], |
|
| 258 | 258 | 'link'=> 'src', |
| 259 | 259 | ], |
| 260 | 260 | [ |
| 261 | 261 | 'pattern'=> '/^-js\{>/', |
| 262 | 262 | 'name'=> 'script', |
| 263 | - 'default_attributes'=> ['type'=>'text/javascript',], |
|
| 263 | + 'default_attributes'=> ['type'=>'text/javascript', ], |
|
| 264 | 264 | 'embedding'=> 'js', |
| 265 | 265 | ], |
| 266 | 266 | ], |
@@ -270,111 +270,111 @@ discard block |
||
| 270 | 270 | [ |
| 271 | 271 | 'pattern'=> '/^-css @/', |
| 272 | 272 | 'name'=> 'link', |
| 273 | - 'default_attributes'=> ['rel'=>'stylesheet','type'=>'text/css',], |
|
| 273 | + 'default_attributes'=> ['rel'=>'stylesheet', 'type'=>'text/css', ], |
|
| 274 | 274 | 'link'=> 'href', |
| 275 | 275 | ], |
| 276 | 276 | [ |
| 277 | 277 | 'pattern'=> '/^-css\{>/', |
| 278 | 278 | 'name'=> 'style', |
| 279 | - 'default_attributes'=> ['type'=>'text/css',], |
|
| 279 | + 'default_attributes'=> ['type'=>'text/css', ], |
|
| 280 | 280 | 'embedding'=> 'css', |
| 281 | 281 | ], |
| 282 | 282 | ], |
| 283 | 283 | ], |
| 284 | 284 | 'icon'=> [ |
| 285 | 285 | 'name'=> 'link', |
| 286 | - 'default_attributes'=> ['rel'=>'icon',], |
|
| 287 | - 'params'=> ['sizes',], |
|
| 286 | + 'default_attributes'=> ['rel'=>'icon', ], |
|
| 287 | + 'params'=> ['sizes', ], |
|
| 288 | 288 | 'link'=> 'href', |
| 289 | 289 | ], |
| 290 | 290 | 'shortcut'=> [ |
| 291 | 291 | 'name'=> 'link', |
| 292 | - 'default_attributes'=> ['rel'=>'shortcut icon','type'=>'image/x-icon',], |
|
| 292 | + 'default_attributes'=> ['rel'=>'shortcut icon', 'type'=>'image/x-icon', ], |
|
| 293 | 293 | 'link'=> 'href', |
| 294 | 294 | ], |
| 295 | 295 | 'link'=> [ |
| 296 | 296 | 'name'=> 'link', |
| 297 | - 'params'=> ['rel',], |
|
| 297 | + 'params'=> ['rel', ], |
|
| 298 | 298 | 'link'=>'href', |
| 299 | 299 | ], |
| 300 | 300 | 'a'=> [ |
| 301 | 301 | 'link'=> 'href', |
| 302 | - 'name_value'=> ['name',], |
|
| 302 | + 'name_value'=> ['name', ], |
|
| 303 | 303 | 'target'=> 'target', |
| 304 | 304 | ], |
| 305 | 305 | 'iframe'=>[ |
| 306 | 306 | 'link'=> 'src', |
| 307 | - 'default_attributes'=> ['frameborder'=>'0',], |
|
| 308 | - 'name_value'=> ['name',], |
|
| 307 | + 'default_attributes'=> ['frameborder'=>'0', ], |
|
| 308 | + 'name_value'=> ['name', ], |
|
| 309 | 309 | ], |
| 310 | 310 | 'img'=>[ |
| 311 | 311 | 'link'=> 'src', |
| 312 | 312 | 'alt'=> 'alt', |
| 313 | 313 | ], |
| 314 | - 'form'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'post',],], |
|
| 315 | - 'post'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'post',],], |
|
| 316 | - 'upload'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'post','enctype'=>'multipart/form-data',],], |
|
| 317 | - 'get'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name',], 'default_attributes'=> ['method'=>'get',],], |
|
| 314 | + 'form'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name', ], 'default_attributes'=> ['method'=>'post', ], ], |
|
| 315 | + 'post'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name', ], 'default_attributes'=> ['method'=>'post', ], ], |
|
| 316 | + 'upload'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name', ], 'default_attributes'=> ['method'=>'post', 'enctype'=>'multipart/form-data', ], ], |
|
| 317 | + 'get'=> ['name'=> 'form', 'link'=> 'action', 'target'=> 'target', 'name_value'=>['name', ], 'default_attributes'=> ['method'=>'get', ], ], |
|
| 318 | 318 | |
| 319 | - 'input'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'hidden',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 320 | - 'text'=> ['out'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'text',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], 'in'=>['svg'=>['params'=>['x','y',],],]], |
|
| 321 | - 'search'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'search',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
| 322 | - 'password'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'password',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
| 323 | - 'email'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'email',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
| 324 | - 'url'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'url',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
| 325 | - 'tel'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'tel',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder',], |
|
| 326 | - 'number'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'number',], 'name_value'=> ['name', 'value', 'form',], 'alt'=> 'placeholder', 'params'=>['min', 'step', 'max',],], |
|
| 327 | - 'range'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'range',], 'name_value'=> ['name', 'value', 'form',], 'params'=>['min', 'step', 'max',],], |
|
| 328 | - 'radio'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'radio',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 329 | - 'checkbox'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'checkbox',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 330 | - 'date'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'date',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 331 | - 'month'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'month',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 332 | - 'week'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'week',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 333 | - 'time'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'time',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 334 | - 'datetime'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'datetime',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 335 | - 'datetime-local'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'datetime-local',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 336 | - 'color'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'color',], 'name_value'=> ['name', 'value', 'form',],], |
|
| 337 | - 'file'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'file',], 'name_value'=> ['name', 'form',], 'params'=>['accept',],], |
|
| 319 | + 'input'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'hidden', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 320 | + 'text'=> ['out'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'text', ], 'name_value'=> ['name', 'value', 'form', ], 'alt'=> 'placeholder', ], 'in'=>['svg'=>['params'=>['x', 'y', ], ], ]], |
|
| 321 | + 'search'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'search', ], 'name_value'=> ['name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
| 322 | + 'password'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'password', ], 'name_value'=> ['name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
| 323 | + 'email'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'email', ], 'name_value'=> ['name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
| 324 | + 'url'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'url', ], 'name_value'=> ['name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
| 325 | + 'tel'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'tel', ], 'name_value'=> ['name', 'value', 'form', ], 'alt'=> 'placeholder', ], |
|
| 326 | + 'number'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'number', ], 'name_value'=> ['name', 'value', 'form', ], 'alt'=> 'placeholder', 'params'=>['min', 'step', 'max', ], ], |
|
| 327 | + 'range'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'range', ], 'name_value'=> ['name', 'value', 'form', ], 'params'=>['min', 'step', 'max', ], ], |
|
| 328 | + 'radio'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'radio', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 329 | + 'checkbox'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'checkbox', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 330 | + 'date'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'date', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 331 | + 'month'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'month', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 332 | + 'week'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'week', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 333 | + 'time'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'time', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 334 | + 'datetime'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'datetime', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 335 | + 'datetime-local'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'datetime-local', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 336 | + 'color'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'color', ], 'name_value'=> ['name', 'value', 'form', ], ], |
|
| 337 | + 'file'=> ['name'=> 'input', 'default_attributes'=> ['type'=>'file', ], 'name_value'=> ['name', 'form', ], 'params'=>['accept', ], ], |
|
| 338 | 338 | |
| 339 | - 'submit'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'submit',], 'name_value'=> ['name', 'value','form'], 'link'=> ' formaction', 'target'=> 'formtarget',], |
|
| 340 | - 'reset'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'reset',], 'name_value'=> ['form',]], |
|
| 341 | - 'button'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'button',],], |
|
| 339 | + 'submit'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'submit', ], 'name_value'=> ['name', 'value', 'form'], 'link'=> ' formaction', 'target'=> 'formtarget', ], |
|
| 340 | + 'reset'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'reset', ], 'name_value'=> ['form', ]], |
|
| 341 | + 'button'=> ['name'=> 'button', 'default_attributes'=> ['type'=>'button', ], ], |
|
| 342 | 342 | |
| 343 | - 'textarea'=> ['name'=> 'textarea', 'name_value'=>['name','value','form',],'alt'=>'placeholder',], |
|
| 343 | + 'textarea'=> ['name'=> 'textarea', 'name_value'=>['name', 'value', 'form', ], 'alt'=>'placeholder', ], |
|
| 344 | 344 | //* |
| 345 | 345 | 'select'=> [ |
| 346 | - 'name_value'=> ['name', 'value','form',], |
|
| 346 | + 'name_value'=> ['name', 'value', 'form', ], |
|
| 347 | 347 | 'scope'=>'select', |
| 348 | 348 | ], |
| 349 | 349 | 'datalist'=>[ |
| 350 | - 'params'=>['id',], |
|
| 350 | + 'params'=>['id', ], |
|
| 351 | 351 | 'scope'=>'datalist', |
| 352 | 352 | ], |
| 353 | 353 | 'optgroup'=> [ |
| 354 | 354 | 'in'=> [ |
| 355 | 355 | 'select'=>[ |
| 356 | - 'name_value'=> ['label',], |
|
| 356 | + 'name_value'=> ['label', ], |
|
| 357 | 357 | ], |
| 358 | 358 | ], |
| 359 | 359 | ], |
| 360 | 360 | 'option'=> [ |
| 361 | 361 | 'in'=> [ |
| 362 | 362 | 'select'=> [ |
| 363 | - 'scope_function'=>function( $scope ){ |
|
| 364 | - if( $scope['value']===$this['value'] ){ |
|
| 365 | - $this['selected']= 'selected'; |
|
| 363 | + 'scope_function'=>function($scope) { |
|
| 364 | + if ($scope['value']===$this['value']) { |
|
| 365 | + $this['selected']='selected'; |
|
| 366 | 366 | }; |
| 367 | 367 | }, |
| 368 | - 'name_value'=> ['value', 'label',], |
|
| 368 | + 'name_value'=> ['value', 'label', ], |
|
| 369 | 369 | ], |
| 370 | 370 | 'datalist'=> [ |
| 371 | - 'name_value'=> ['value',], |
|
| 371 | + 'name_value'=> ['value', ], |
|
| 372 | 372 | ], |
| 373 | 373 | ], |
| 374 | 374 | ], |
| 375 | 375 | //*/ |
| 376 | 376 | 'param'=> [ |
| 377 | - 'name_value'=> ['name','value',], |
|
| 377 | + 'name_value'=> ['name', 'value', ], |
|
| 378 | 378 | ], |
| 379 | 379 | ]+$svgTags, |
| 380 | 380 | ], |
@@ -13,5 +13,5 @@ |
||
| 13 | 13 | * |
| 14 | 14 | * @return mixed |
| 15 | 15 | */ |
| 16 | - public function getConfig( string...$key ); |
|
| 16 | + public function getConfig(string...$key); |
|
| 17 | 17 | } |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | * @param string $attribute |
| 13 | 13 | * @param mixed $value |
| 14 | 14 | */ |
| 15 | - public function __set( $attribute, $value ) |
|
| 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 | - }else{ |
|
| 19 | + }else { |
|
| 20 | 20 | throw new \Exception(static::class.' has no attribute named '.$attribute); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @return \Htsl\Embedment\Contracts |
| 18 | 18 | */ |
| 19 | - public function parseLine( Line$line ):parent |
|
| 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 | } |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param \Htsl\Parser\Document $document |
| 30 | 30 | */ |
| 31 | - final public function __construct( Document$document ) |
|
| 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 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Real constructor to be rewrite. |
| 50 | 50 | */ |
| 51 | - protected function construct(){} |
|
| 51 | + protected function construct() {} |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Parsing line. |
@@ -57,5 +57,5 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return \Htsl\Embedment\Contracts |
| 59 | 59 | */ |
| 60 | - abstract public function parseLine( Line$line ):self; |
|
| 60 | + abstract public function parseLine(Line$line):self; |
|
| 61 | 61 | } |
@@ -24,9 +24,9 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @return \Htsl\Embedment\Contracts |
| 26 | 26 | */ |
| 27 | - public function parseLine( Line$line ):parent |
|
| 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 | } |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @return \Htsl\Embedment\Contracts |
| 18 | 18 | */ |
| 19 | - public function parseLine( Line$line ):parent |
|
| 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 | } |