Completed
Push — master ( 988761...5d514e )
by Fenz
02:27
created
libs/Parser/Node/Contracts/ANode.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@
 block discarded – undo
136 136
 				}
137 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'])) ){
139
+		} elseif( isset($config['only_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['only_in'])) ){
140 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'])) ){
141
+		} elseif( isset($config['not_in']) && (!$this->document->scope || !in_array($this->document->scope->scope,$config['not_in'])) ){
142 142
 			$this->document->throw("The $this->nodeType node $name not use in scope ".implode(',',$config['not_in']));
143 143
 		}
144 144
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,17 +132,17 @@
 block discarded – undo
132 132
 					}
133 133
 				}
134 134
 				if( !isset($config['out']) ){
135
-					$this->document->throw("The $this->nodeType node $name only use in scope ".implode(',',array_keys($config['in'])));
135
+					$this->document->throw("the $this->nodeType node $name only use in scope ".implode(',',array_keys($config['in'])));
136 136
 				}
137 137
 				return $config['out'];
138 138
 			})($config);
139 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']));
140
+			$this->document->throw("the $this->nodeType node $name only use in scope ".implode(',',$config['only_in']));
141 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']));
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 147
 		$this->config= $config;
148 148
 
Please login to merge, or discard this patch.
libs/Parser/Section.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
libs/Parser/Node/NamelessSectionNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 */
26 26
 	protected function construct():parent
27 27
 	{
28
-		$this->name= null;
28
+		$this->name=null;
29 29
 
30 30
 		return $this;
31 31
 	}
Please login to merge, or discard this patch.
libs/Parser/Node/SectionNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 */
26 26
 	protected function construct():parent
27 27
 	{
28
-		$this->name= $this->line->pregGet('/(?<=\( ).*(?= \))/');
28
+		$this->name=$this->line->pregGet('/(?<=\( ).*(?= \))/');
29 29
 
30 30
 		return $this;
31 31
 	}
Please login to merge, or discard this patch.
libs/Parser/Node/ControlNode.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	protected function construct():parent
40 40
 	{
41
-		$name= $this->line->pregGet('/(?<=^~)[\w-]*/');
41
+		$name=$this->line->pregGet('/(?<=^~)[\w-]*/');
42 42
 		$this->name=$name;
43 43
 
44
-		$this->loadConfig($name,$this->htsl);
44
+		$this->loadConfig($name, $this->htsl);
45 45
 
46
-		$this->param= $this->line->pregGet('/^~[\w-]*\( (.*) \)/',1);
46
+		$this->param=$this->line->pregGet('/^~[\w-]*\( (.*) \)/', 1);
47 47
 
48
-		$this->structureName=$this->config['name']??$name;
48
+		$this->structureName=$this->config[ 'name' ]??$name;
49 49
 
50 50
 		$this->id=strtoupper(uniqid());
51 51
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function open():string
61 61
 	{
62
-		return $this->withParam($this->config['opener']);
62
+		return $this->withParam($this->config[ 'opener' ]);
63 63
 	}
64 64
 
65 65
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function getScope()
71 71
 	{
72
-		return $this->config['scope']??null;
72
+		return $this->config[ 'scope' ]??null;
73 73
 	}
74 74
 
75 75
 
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function close( Line$closerLine ):string
84 84
 	{
85
-		if( isset($this->config['close_by']) && $closerLine->indentLevel==$this->line->indentLevel ){
86
-			foreach( $this->config['close_by'] as $key=>$value ){
85
+		if( isset($this->config[ 'close_by' ]) && $closerLine->indentLevel==$this->line->indentLevel ){
86
+			foreach( $this->config[ 'close_by' ] as $key=>$value ){
87 87
 				if( $closerLine->pregMatch($key) ){
88 88
 					return $this->withParam($value);
89 89
 				}
90 90
 			}
91 91
 		}
92 92
 
93
-		if( isset($this->config['closer']) )
94
-			{ return $this->withParam($this->config['closer']); }
93
+		if( isset($this->config[ 'closer' ]) )
94
+			{ return $this->withParam($this->config[ 'closer' ]); }
95 95
 
96 96
 		return '';
97 97
 	}
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	private function withParam( string$input )
107 107
 	{
108
-		return str_replace('$_FLAG_$',"__HTSL_CTRL_FLAG_{$this->id}__",preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/',function( array$matches ){
109
-			$param= $this->param;
108
+		return str_replace('$_FLAG_$', "__HTSL_CTRL_FLAG_{$this->id}__", preg_replace_callback('/(?<!%)%s((?:\\/.+?(?<!\\\\)\\/.+?(?<!\\\\)\\/)+)?/', function( array$matches ){
109
+			$param=$this->param;
110 110
 
111
-			if( isset($matches[1]) ){
111
+			if( isset($matches[ 1 ]) ){
112 112
 				array_map(...[
113
-					function($replacer)use(&$param){
114
-						list($pattern,$replacement,)= preg_split('/(?<!\\\\)\\//',$replacer);
115
-						$param= preg_replace(...[
113
+					function( $replacer )use(&$param){
114
+						list($pattern, $replacement,)=preg_split('/(?<!\\\\)\\//', $replacer);
115
+						$param=preg_replace(...[
116 116
 							"/$pattern/",
117
-							preg_replace('/^\\\\_$/','',$replacement),
117
+							preg_replace('/^\\\\_$/', '', $replacement),
118 118
 							$param,
119 119
 						]);
120 120
 					},
121 121
 					preg_split(
122 122
 						'/(?<!\\\\)\\/\\//'
123 123
 						,
124
-						trim($matches[1],'/')
124
+						trim($matches[ 1 ], '/')
125 125
 					),
126 126
 				]);
127 127
 			}
Please login to merge, or discard this patch.
libs/ReadingBuffer/FileBuffer.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 		substr($filePath,-5)==='.htsl' or $filePath.= '.htsl';
27 27
 
28 28
 		if( !file_exists($filePath) || !is_file($filePath) ){
29
-			throw new \Exception("File $filePath not exists.", 1);
29
+			throw new \Exception("file $filePath not exists.", 1);
30 30
 		}
31 31
 
32 32
 		$this->filePath= $filePath;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
libs/Embedment/Contracts/AEmbedment.php 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@
 block discarded – undo
48 48
 	/**
49 49
 	 * Real constructor to be rewrite.
50 50
 	 */
51
-	protected function construct(){}
51
+	protected function construct()
52
+	{
53
+}
52 54
 
53 55
 	/**
54 56
 	 * Parsing line.
Please login to merge, or discard this patch.
libs/ReadingBuffer/Contracts/ABuffer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
libs/ReadingBuffer/StringBuffer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.