@@ -14,7 +14,7 @@ |
||
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 | { |
@@ -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 | } |
@@ -14,7 +14,7 @@ |
||
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 | { |
@@ -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 | } |
@@ -22,7 +22,7 @@ |
||
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 | { |
@@ -18,7 +18,7 @@ |
||
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 | } |
@@ -14,7 +14,7 @@ |
||
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 | { |
@@ -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 | } |
@@ -14,7 +14,7 @@ |
||
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 | { |
@@ -18,7 +18,7 @@ |
||
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 | } |
@@ -15,7 +15,7 @@ |
||
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); |
@@ -14,7 +14,7 @@ |
||
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); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function __construct( string$name=null ) |
33 | 33 | { |
34 | - $this->name = $name; |
|
34 | + $this->name=$name; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | final public function __construct( Document$document, Line$line ) |
53 | 53 | { |
54 | - $this->htsl= $document->htsl; |
|
55 | - $this->document= $document; |
|
56 | - $this->line= $line; |
|
54 | + $this->htsl=$document->htsl; |
|
55 | + $this->document=$document; |
|
56 | + $this->line=$line; |
|
57 | 57 | |
58 | 58 | $this->construct(); |
59 | 59 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function getNodeType() |
100 | 100 | { |
101 | 101 | static $nodeType; |
102 | - return $nodeType??$nodeType= $this->nodeType??(static function($className){return strtolower(preg_replace('/(?<=\\w)([A-Z])/','_$1',preg_replace('/^(?:\\w+\\\\)*(\\w+)Node$/','$1',$className)));})(get_class($this)); |
|
102 | + return $nodeType??$nodeType=$this->nodeType??(static function( $className ){return strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_$1', preg_replace('/^(?:\\w+\\\\)*(\\w+)Node$/', '$1', $className))); })(get_class($this)); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -112,39 +112,39 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function loadConfig( string$name, IConfigProvider$configProvider ) |
114 | 114 | { |
115 | - $config= $configProvider->getConfig($this->nodeType.'_nodes',$name) ?: $configProvider->getConfig($this->nodeType.'_nodes','*'); |
|
115 | + $config=$configProvider->getConfig($this->nodeType.'_nodes', $name)?: $configProvider->getConfig($this->nodeType.'_nodes', '*'); |
|
116 | 116 | |
117 | - if( isset($config['multiple']) ){ |
|
118 | - foreach( $config['multiple'] as $value ){ |
|
119 | - if( $this->line->pregGet($value['pattern']) ){ |
|
120 | - $config= $value; |
|
117 | + if( isset($config[ 'multiple' ]) ){ |
|
118 | + foreach( $config[ 'multiple' ] as $value ){ |
|
119 | + if( $this->line->pregGet($value[ 'pattern' ]) ){ |
|
120 | + $config=$value; |
|
121 | 121 | break; |
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if( isset($config['in']) ){ |
|
126 | + if( isset($config[ 'in' ]) ){ |
|
127 | 127 | $config=(function( array$config )use($name){ |
128 | - foreach( $config['in'] as $key=>$value ){ |
|
128 | + foreach( $config[ 'in' ] as $key=>$value ){ |
|
129 | 129 | if( $this->document->scope && $this->document->scope->scope===$key ){ |
130 | - $value['in_scope']= $key; |
|
130 | + $value[ 'in_scope' ]=$key; |
|
131 | 131 | return $value; |
132 | 132 | } |
133 | 133 | } |
134 | - if( !isset($config['out']) ){ |
|
135 | - $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',array_keys($config['in']))); |
|
134 | + if( !isset($config[ 'out' ]) ){ |
|
135 | + $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',', array_keys($config[ 'in' ]))); |
|
136 | 136 | } |
137 | - return $config['out']; |
|
137 | + return $config[ 'out' ]; |
|
138 | 138 | })($config); |
139 | - }elseif( isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['only_in'])) ){ |
|
140 | - $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',$config['only_in'])); |
|
141 | - }elseif( isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['not_in'])) ){ |
|
142 | - $this->document->throw("The $this->nodeType node $name not use in scope ".implode(',',$config['not_in'])); |
|
139 | + }elseif( isset($config[ 'only_in' ]) && (!$this->document->scope || !in_array($this->document->scope->scope, $config[ 'only_in' ])) ){ |
|
140 | + $this->document->throw("The $this->nodeType node $name only use in scope ".implode(',', $config[ 'only_in' ])); |
|
141 | + }elseif( isset($config[ 'not_in' ]) && (!$this->document->scope || !in_array($this->document->scope->scope, $config[ 'not_in' ])) ){ |
|
142 | + $this->document->throw("The $this->nodeType node $name not use in scope ".implode(',', $config[ 'not_in' ])); |
|
143 | 143 | } |
144 | 144 | |
145 | - if( !is_array($config) ){$this->document->throw("The $this->nodeType node $name is not supported.");} |
|
145 | + if( !is_array($config) ){$this->document->throw("The $this->nodeType node $name is not supported."); } |
|
146 | 146 | |
147 | - $this->config= $config; |
|
147 | + $this->config=$config; |
|
148 | 148 | |
149 | 149 | return $this; |
150 | 150 | } |