@@ -197,7 +197,7 @@  | 
                                                    ||
| 197 | 197 | * @param int $index  | 
                                                        
| 198 | 198 | * @param int $nodeType  | 
                                                        
| 199 | 199 | *  | 
                                                        
| 200 | - * @return \chillerlan\PrototypeDOM\Element|\DOMNode|null  | 
                                                        |
| 200 | + * @return Element|null  | 
                                                        |
| 201 | 201 | */  | 
                                                        
| 202 | 202 |  	public function _recursivelyFind(DOMNode $element, string $property, string $selector = null, int $index = 0, int $nodeType = XML_ELEMENT_NODE){ | 
                                                        
| 203 | 203 | |
@@ -12,7 +12,10 @@  | 
                                                    ||
| 12 | 12 | |
| 13 | 13 | namespace chillerlan\PrototypeDOM;  | 
                                                        
| 14 | 14 | |
| 15 | -use DOMDocument, DOMNode, DOMNodeList, DOMXPath;  | 
                                                        |
| 15 | +use DOMDocument;  | 
                                                        |
| 16 | +use DOMNode;  | 
                                                        |
| 17 | +use DOMNodeList;  | 
                                                        |
| 18 | +use DOMXPath;  | 
                                                        |
| 16 | 19 | use Symfony\Component\CssSelector\CssSelectorConverter;  | 
                                                        
| 17 | 20 | |
| 18 | 21 |  class Document extends DOMDocument{ | 
                                                        
@@ -15,7 +15,7 @@ discard block  | 
                                                    ||
| 15 | 15 | use DOMDocument, DOMNode, DOMNodeList, DOMXPath;  | 
                                                        
| 16 | 16 | use Symfony\Component\CssSelector\CssSelectorConverter;  | 
                                                        
| 17 | 17 | |
| 18 | -class Document extends DOMDocument{ | 
                                                        |
| 18 | +class Document extends DOMDocument { | 
                                                        |
| 19 | 19 | |
| 20 | 20 | /**  | 
                                                        
| 21 | 21 | * Document constructor.  | 
                                                        
@@ -23,7 +23,7 @@ discard block  | 
                                                    ||
| 23 | 23 | * @param string|null $version  | 
                                                        
| 24 | 24 | * @param string|null $encoding  | 
                                                        
| 25 | 25 | */  | 
                                                        
| 26 | -	public function __construct($version = null, $encoding = null){ | 
                                                        |
| 26 | +	public function __construct($version = null, $encoding = null) { | 
                                                        |
| 27 | 27 | parent::__construct($version, $encoding);  | 
                                                        
| 28 | 28 | |
| 29 | 29 |  		$this->registerNodeClass('DOMElement', Element::class); | 
                                                        
@@ -73,21 +73,21 @@ discard block  | 
                                                    ||
| 73 | 73 | */  | 
                                                        
| 74 | 74 |  	public function select($selectors = null, DOMNode $contextNode = null, string $axis = 'descendant-or-self::', int $nodeType = XML_ELEMENT_NODE):array{ | 
                                                        
| 75 | 75 | |
| 76 | -		if(is_string($selectors)){ | 
                                                        |
| 76 | +		if (is_string($selectors)) { | 
                                                        |
| 77 | 77 | $selectors = [trim($selectors)];  | 
                                                        
| 78 | 78 | }  | 
                                                        
| 79 | 79 | |
| 80 | -		if(!is_array($selectors) || empty($selectors)){ | 
                                                        |
| 80 | +		if (!is_array($selectors) || empty($selectors)) { | 
                                                        |
| 81 | 81 | $selectors = ['*'];  | 
                                                        
| 82 | 82 | }  | 
                                                        
| 83 | 83 | |
| 84 | 84 | $elements = [];  | 
                                                        
| 85 | 85 | |
| 86 | -		foreach($selectors as $selector){ | 
                                                        |
| 86 | +		foreach ($selectors as $selector) { | 
                                                        |
| 87 | 87 | |
| 88 | -			foreach($this->getElementsBySelector($selector, $contextNode, $axis) as $element){ | 
                                                        |
| 88 | +			foreach ($this->getElementsBySelector($selector, $contextNode, $axis) as $element) { | 
                                                        |
| 89 | 89 | |
| 90 | -				if($element->nodeType === $nodeType){ | 
                                                        |
| 90 | +				if ($element->nodeType === $nodeType) { | 
                                                        |
| 91 | 91 | $elements[] = $element;  | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | |
@@ -120,9 +120,9 @@ discard block  | 
                                                    ||
| 120 | 120 |  	public function removeElementsBySelector($selectors, DOMNode $contextNode = null, string $axis = 'descendant-or-self::'):Document{ | 
                                                        
| 121 | 121 | $nodes = $this->select($selectors, $contextNode, $axis);  | 
                                                        
| 122 | 122 | |
| 123 | -		if(count($nodes) > 0){ | 
                                                        |
| 123 | +		if (count($nodes) > 0) { | 
                                                        |
| 124 | 124 | /** @var \chillerlan\PrototypeDOM\Element $node */  | 
                                                        
| 125 | -			foreach($nodes as $node){ | 
                                                        |
| 125 | +			foreach ($nodes as $node) { | 
                                                        |
| 126 | 126 | $node->remove();  | 
                                                        
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
@@ -139,21 +139,21 @@ discard block  | 
                                                    ||
| 139 | 139 | */  | 
                                                        
| 140 | 140 |  	public function _toDOMNodeList($content):DOMNodeList{ | 
                                                        
| 141 | 141 | |
| 142 | -		if($content instanceof DOMNodeList){ | 
                                                        |
| 142 | +		if ($content instanceof DOMNodeList) { | 
                                                        |
| 143 | 143 | return $content;  | 
                                                        
| 144 | 144 | }  | 
                                                        
| 145 | 145 | |
| 146 | 146 | $document = new Document;  | 
                                                        
| 147 | 147 | |
| 148 | -		if($content instanceof DOMNode){ | 
                                                        |
| 148 | +		if ($content instanceof DOMNode) { | 
                                                        |
| 149 | 149 |  			$document->loadHTML('<html><body id="content"></body></html>'); | 
                                                        
| 150 | 150 | |
| 151 | 151 |  			$document->getElementById('content')->appendChild($document->importNode($content, true)); | 
                                                        
| 152 | 152 | }  | 
                                                        
| 153 | -		elseif(is_string($content)){ | 
                                                        |
| 153 | +		elseif (is_string($content)) { | 
                                                        |
| 154 | 154 |  			$document->loadHTML('<html><body id="content">'.$content.'</body></html>'); | 
                                                        
| 155 | 155 | }  | 
                                                        
| 156 | -		else{ | 
                                                        |
| 156 | +		else { | 
                                                        |
| 157 | 157 |  			throw new \Exception('invalid content'); | 
                                                        
| 158 | 158 | }  | 
                                                        
| 159 | 159 | |
@@ -171,15 +171,15 @@ discard block  | 
                                                    ||
| 171 | 171 |  	public function recursivelyCollect(DOMNode $element, string $property, int $maxLength = -1, int $nodeType = XML_ELEMENT_NODE):array{ | 
                                                        
| 172 | 172 | $nodes = [];  | 
                                                        
| 173 | 173 | |
| 174 | -		if(in_array($property, ['parentNode', 'previousSibling', 'nextSibling'])){ | 
                                                        |
| 174 | +		if (in_array($property, ['parentNode', 'previousSibling', 'nextSibling'])) { | 
                                                        |
| 175 | 175 | |
| 176 | -			while($element = $element->{$property}){ | 
                                                        |
| 176 | +			while ($element = $element->{$property}) { | 
                                                        |
| 177 | 177 | |
| 178 | -				if($element->nodeType === $nodeType){ | 
                                                        |
| 178 | +				if ($element->nodeType === $nodeType) { | 
                                                        |
| 179 | 179 | $nodes[] = $element;  | 
                                                        
| 180 | 180 | }  | 
                                                        
| 181 | 181 | |
| 182 | -				if(count($nodes) === $maxLength){ | 
                                                        |
| 182 | +				if (count($nodes) === $maxLength) { | 
                                                        |
| 183 | 183 | break;  | 
                                                        
| 184 | 184 | }  | 
                                                        
| 185 | 185 | |
@@ -199,14 +199,14 @@ discard block  | 
                                                    ||
| 199 | 199 | *  | 
                                                        
| 200 | 200 | * @return \chillerlan\PrototypeDOM\Element|\DOMNode|null  | 
                                                        
| 201 | 201 | */  | 
                                                        
| 202 | -	public function _recursivelyFind(DOMNode $element, string $property, string $selector = null, int $index = 0, int $nodeType = XML_ELEMENT_NODE){ | 
                                                        |
| 202 | +	public function _recursivelyFind(DOMNode $element, string $property, string $selector = null, int $index = 0, int $nodeType = XML_ELEMENT_NODE) { | 
                                                        |
| 203 | 203 | |
| 204 | -		if(in_array($property, ['parentNode', 'previousSibling', 'nextSibling'])){ | 
                                                        |
| 204 | +		if (in_array($property, ['parentNode', 'previousSibling', 'nextSibling'])) { | 
                                                        |
| 205 | 205 | |
| 206 | -			while($element = $element->{$property}){ | 
                                                        |
| 206 | +			while ($element = $element->{$property}) { | 
                                                        |
| 207 | 207 | |
| 208 | 208 | /** @var \chillerlan\PrototypeDOM\Element $element */  | 
                                                        
| 209 | -				if($element->nodeType !== $nodeType || $selector && !$element->match($selector) || --$index >= 0){ | 
                                                        |
| 209 | +				if ($element->nodeType !== $nodeType || $selector && !$element->match($selector) || --$index >= 0) { | 
                                                        |
| 210 | 210 | continue;  | 
                                                        
| 211 | 211 | }  | 
                                                        
| 212 | 212 | |
@@ -226,9 +226,9 @@ discard block  | 
                                                    ||
| 226 | 226 | */  | 
                                                        
| 227 | 227 |  	public function match(DOMNode $element, string $selector):bool{ | 
                                                        
| 228 | 228 | |
| 229 | -		foreach($this->select($selector) as $match){ | 
                                                        |
| 229 | +		foreach ($this->select($selector) as $match) { | 
                                                        |
| 230 | 230 | |
| 231 | -			if($element->isSameNode($match)){ | 
                                                        |
| 231 | +			if ($element->isSameNode($match)) { | 
                                                        |
| 232 | 232 | return true;  | 
                                                        
| 233 | 233 | }  | 
                                                        
| 234 | 234 | |
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 | /** @var \chillerlan\PrototypeDOM\Element $element */  | 
                                                        
| 248 | 248 | $element = $this->createElement($tag);  | 
                                                        
| 249 | 249 | |
| 250 | -		if($attributes){ | 
                                                        |
| 250 | +		if ($attributes) { | 
                                                        |
| 251 | 251 | $element->setAttributes($attributes);  | 
                                                        
| 252 | 252 | }  | 
                                                        
| 253 | 253 | |
@@ -149,11 +149,9 @@  | 
                                                    ||
| 149 | 149 |  			$document->loadHTML('<html><body id="content"></body></html>'); | 
                                                        
| 150 | 150 | |
| 151 | 151 |  			$document->getElementById('content')->appendChild($document->importNode($content, true)); | 
                                                        
| 152 | - }  | 
                                                        |
| 153 | -		elseif(is_string($content)){ | 
                                                        |
| 152 | +		} elseif(is_string($content)){ | 
                                                        |
| 154 | 153 |  			$document->loadHTML('<html><body id="content">'.$content.'</body></html>'); | 
                                                        
| 155 | - }  | 
                                                        |
| 156 | -		else{ | 
                                                        |
| 154 | +		} else{ | 
                                                        |
| 157 | 155 |  			throw new \Exception('invalid content'); | 
                                                        
| 158 | 156 | }  | 
                                                        
| 159 | 157 | |
@@ -69,7 +69,7 @@ discard block  | 
                                                    ||
| 69 | 69 | }  | 
                                                        
| 70 | 70 | |
| 71 | 71 | /**  | 
                                                        
| 72 | - * @param array $classnames  | 
                                                        |
| 72 | + * @param string[] $classnames  | 
                                                        |
| 73 | 73 | *  | 
                                                        
| 74 | 74 | * @return \chillerlan\PrototypeDOM\Element  | 
                                                        
| 75 | 75 | */  | 
                                                        
@@ -90,7 +90,7 @@ discard block  | 
                                                    ||
| 90 | 90 | }  | 
                                                        
| 91 | 91 | |
| 92 | 92 | /**  | 
                                                        
| 93 | - * @param array $classnames  | 
                                                        |
| 93 | + * @param string[] $classnames  | 
                                                        |
| 94 | 94 | *  | 
                                                        
| 95 | 95 | * @return \chillerlan\PrototypeDOM\Element  | 
                                                        
| 96 | 96 | */  | 
                                                        
@@ -12,7 +12,7 @@  | 
                                                    ||
| 12 | 12 | |
| 13 | 13 | namespace chillerlan\PrototypeDOM;  | 
                                                        
| 14 | 14 | |
| 15 | -use DOMElement, DOMNode, DOMNodeList;  | 
                                                        |
| 15 | +use DOMElement;  | 
                                                        |
| 16 | 16 | |
| 17 | 17 |  class Element extends DOMElement{ | 
                                                        
| 18 | 18 | use NodeTraversalTrait, NodeManipulationTrait;  | 
                                                        
@@ -14,7 +14,7 @@ discard block  | 
                                                    ||
| 14 | 14 | |
| 15 | 15 | use DOMElement, DOMNode, DOMNodeList;  | 
                                                        
| 16 | 16 | |
| 17 | -class Element extends DOMElement{ | 
                                                        |
| 17 | +class Element extends DOMElement { | 
                                                        |
| 18 | 18 | use NodeTraversalTrait, NodeManipulationTrait;  | 
                                                        
| 19 | 19 | |
| 20 | 20 | /**  | 
                                                        
@@ -25,7 +25,7 @@ discard block  | 
                                                    ||
| 25 | 25 |  	public function id(string $newID = null):string { | 
                                                        
| 26 | 26 |  		$oldID = $this->getAttribute('id'); | 
                                                        
| 27 | 27 | |
| 28 | -		if($newID){ | 
                                                        |
| 28 | +		if ($newID) { | 
                                                        |
| 29 | 29 |  			$this->setAttribute('id', $newID); | 
                                                        
| 30 | 30 | }  | 
                                                        
| 31 | 31 | |
@@ -38,14 +38,14 @@ discard block  | 
                                                    ||
| 38 | 38 |  	public function getClassNames():array{ | 
                                                        
| 39 | 39 | $currentClassnames = [];  | 
                                                        
| 40 | 40 | |
| 41 | -		if($this->hasAttributes()){ | 
                                                        |
| 41 | +		if ($this->hasAttributes()) { | 
                                                        |
| 42 | 42 |  			$classnames = explode(' ', trim($this->getAttribute('class'))); | 
                                                        
| 43 | 43 | |
| 44 | -			if(!empty($classnames)){ | 
                                                        |
| 44 | +			if (!empty($classnames)) { | 
                                                        |
| 45 | 45 | |
| 46 | -				foreach($classnames as $classname){ | 
                                                        |
| 46 | +				foreach ($classnames as $classname) { | 
                                                        |
| 47 | 47 | |
| 48 | -					if(empty($classname)){ | 
                                                        |
| 48 | +					if (empty($classname)) { | 
                                                        |
| 49 | 49 | continue;  | 
                                                        
| 50 | 50 | }  | 
                                                        
| 51 | 51 | |
@@ -76,9 +76,9 @@ discard block  | 
                                                    ||
| 76 | 76 |  	public function addClassNames(array $classnames):Element{ | 
                                                        
| 77 | 77 | $currentClassnames = $this->getClassNames();  | 
                                                        
| 78 | 78 | |
| 79 | -		foreach($classnames as $classname){ | 
                                                        |
| 79 | +		foreach ($classnames as $classname) { | 
                                                        |
| 80 | 80 | |
| 81 | -			if(!in_array($classname, $currentClassnames, true)){ | 
                                                        |
| 81 | +			if (!in_array($classname, $currentClassnames, true)) { | 
                                                        |
| 82 | 82 | array_push($currentClassnames, $classname);  | 
                                                        
| 83 | 83 | }  | 
                                                        
| 84 | 84 | |
@@ -98,12 +98,12 @@ discard block  | 
                                                    ||
| 98 | 98 | $currentClassnames = $this->getClassNames();  | 
                                                        
| 99 | 99 | |
| 100 | 100 | // @todo -> regex?  | 
                                                        
| 101 | -		foreach($classnames as $classname){ | 
                                                        |
| 101 | +		foreach ($classnames as $classname) { | 
                                                        |
| 102 | 102 | $keys = array_keys($currentClassnames, $classname);  | 
                                                        
| 103 | 103 | |
| 104 | -			if(!empty($keys)){ | 
                                                        |
| 104 | +			if (!empty($keys)) { | 
                                                        |
| 105 | 105 | |
| 106 | -				foreach($keys as $key){ | 
                                                        |
| 106 | +				foreach ($keys as $key) { | 
                                                        |
| 107 | 107 | unset($currentClassnames[$key]);  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
@@ -152,15 +152,15 @@ discard block  | 
                                                    ||
| 152 | 152 |  	public function getStyle():array{ | 
                                                        
| 153 | 153 | $currentStyle = [];  | 
                                                        
| 154 | 154 | |
| 155 | -		if($this->hasAttributes()){ | 
                                                        |
| 155 | +		if ($this->hasAttributes()) { | 
                                                        |
| 156 | 156 |  			$styles = explode(';', trim($this->getAttribute('style'))); | 
                                                        
| 157 | 157 | |
| 158 | -			if(!empty($styles)){ | 
                                                        |
| 158 | +			if (!empty($styles)) { | 
                                                        |
| 159 | 159 | |
| 160 | -				foreach($styles as $style){ | 
                                                        |
| 160 | +				foreach ($styles as $style) { | 
                                                        |
| 161 | 161 |  					$s = explode(':', $style); | 
                                                        
| 162 | 162 | |
| 163 | -					if(count($s) === 2){ | 
                                                        |
| 163 | +					if (count($s) === 2) { | 
                                                        |
| 164 | 164 | $currentStyle[strtolower(trim($s[0]))] = trim($s[1]);  | 
                                                        
| 165 | 165 | }  | 
                                                        
| 166 | 166 | |
@@ -178,10 +178,10 @@ discard block  | 
                                                    ||
| 178 | 178 | *  | 
                                                        
| 179 | 179 | * @return bool|string  | 
                                                        
| 180 | 180 | */  | 
                                                        
| 181 | -	public function hasStyle(string $property){ | 
                                                        |
| 181 | +	public function hasStyle(string $property) { | 
                                                        |
| 182 | 182 | $currentStyle = $this->getStyle();  | 
                                                        
| 183 | 183 | |
| 184 | -		if(array_key_exists(strtolower($property), $currentStyle)){ | 
                                                        |
| 184 | +		if (array_key_exists(strtolower($property), $currentStyle)) { | 
                                                        |
| 185 | 185 | return $currentStyle[$property];  | 
                                                        
| 186 | 186 | }  | 
                                                        
| 187 | 187 | |
@@ -197,11 +197,11 @@ discard block  | 
                                                    ||
| 197 | 197 |  	public function setStyle(array $style, bool $replace = false):Element{ | 
                                                        
| 198 | 198 | $currentStyle = $this->getStyle();  | 
                                                        
| 199 | 199 | |
| 200 | -		if(!$replace){ | 
                                                        |
| 200 | +		if (!$replace) { | 
                                                        |
| 201 | 201 | $style = array_merge($currentStyle, $style);  | 
                                                        
| 202 | 202 | }  | 
                                                        
| 203 | 203 | |
| 204 | -		foreach($style as $property => $value){ | 
                                                        |
| 204 | +		foreach ($style as $property => $value) { | 
                                                        |
| 205 | 205 | $style[$property] = $property.': '.$value.';';  | 
                                                        
| 206 | 206 | }  | 
                                                        
| 207 | 207 | |
@@ -216,7 +216,7 @@ discard block  | 
                                                    ||
| 216 | 216 |  	public function getAttributes():array{ | 
                                                        
| 217 | 217 | $attributes = [];  | 
                                                        
| 218 | 218 | |
| 219 | -		foreach($this->attributes as $attribute){ | 
                                                        |
| 219 | +		foreach ($this->attributes as $attribute) { | 
                                                        |
| 220 | 220 | $attributes[$attribute->nodeName] = $attribute->nodeValue;  | 
                                                        
| 221 | 221 | }  | 
                                                        
| 222 | 222 | |
@@ -230,7 +230,7 @@ discard block  | 
                                                    ||
| 230 | 230 | */  | 
                                                        
| 231 | 231 |  	public function setAttributes(array $attributes):Element{ | 
                                                        
| 232 | 232 | |
| 233 | -		foreach($attributes as $name => $value){ | 
                                                        |
| 233 | +		foreach ($attributes as $name => $value) { | 
                                                        |
| 234 | 234 | $this->setAttribute($name, $value);  | 
                                                        
| 235 | 235 | }  | 
                                                        
| 236 | 236 | |
@@ -244,7 +244,7 @@ discard block  | 
                                                    ||
| 244 | 244 | */  | 
                                                        
| 245 | 245 |  	public function removeAttributes(array $attributes):Element{ | 
                                                        
| 246 | 246 | |
| 247 | -		foreach($attributes as $name){ | 
                                                        |
| 247 | +		foreach ($attributes as $name) { | 
                                                        |
| 248 | 248 | $this->removeAttribute($name);  | 
                                                        
| 249 | 249 | }  | 
                                                        
| 250 | 250 | |
@@ -12,7 +12,8 @@  | 
                                                    ||
| 12 | 12 | |
| 13 | 13 | namespace chillerlan\PrototypeDOM;  | 
                                                        
| 14 | 14 | |
| 15 | -use DOMNode, DOMNodeList;  | 
                                                        |
| 15 | +use DOMNode;  | 
                                                        |
| 16 | +use DOMNodeList;  | 
                                                        |
| 16 | 17 | |
| 17 | 18 | /**  | 
                                                        
| 18 | 19 | * @extends \DOMNode  | 
                                                        
@@ -17,7 +17,7 @@ discard block  | 
                                                    ||
| 17 | 17 | /**  | 
                                                        
| 18 | 18 | * @extends \DOMNode  | 
                                                        
| 19 | 19 | */  | 
                                                        
| 20 | -trait NodeManipulationTrait{ | 
                                                        |
| 20 | +trait NodeManipulationTrait { | 
                                                        |
| 21 | 21 | |
| 22 | 22 | /**  | 
                                                        
| 23 | 23 | * @link http://php.net/manual/class.domnode.php#domnode.props.ownerdocument  | 
                                                        
@@ -74,7 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 | */  | 
                                                        
| 75 | 75 |  	public function empty():DOMNode{ | 
                                                        
| 76 | 76 | |
| 77 | -		while($this->hasChildNodes()){ | 
                                                        |
| 77 | +		while ($this->hasChildNodes()) { | 
                                                        |
| 78 | 78 | $this->firstChild->remove();  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | 80 | |
@@ -101,9 +101,9 @@ discard block  | 
                                                    ||
| 101 | 101 |  	public function cleanWhitespace():DOMNode{ | 
                                                        
| 102 | 102 | $node = $this->firstChild;  | 
                                                        
| 103 | 103 | |
| 104 | -		while($node){ | 
                                                        |
| 104 | +		while ($node) { | 
                                                        |
| 105 | 105 | $nextNode = $node->nextSibling;  | 
                                                        
| 106 | -			if($node->nodeType === XML_TEXT_NODE && empty(trim($node->nodeValue))){ | 
                                                        |
| 106 | +			if ($node->nodeType === XML_TEXT_NODE && empty(trim($node->nodeValue))) { | 
                                                        |
| 107 | 107 | $node->remove();  | 
                                                        
| 108 | 108 | }  | 
                                                        
| 109 | 109 | |
@@ -130,7 +130,7 @@ discard block  | 
                                                    ||
| 130 | 130 | */  | 
                                                        
| 131 | 131 |  	public function _insertBottom(DOMNodeList $nodes):DOMNode{ | 
                                                        
| 132 | 132 | |
| 133 | -		foreach($nodes as $node){ | 
                                                        |
| 133 | +		foreach ($nodes as $node) { | 
                                                        |
| 134 | 134 | $this->appendChild($this->_importNode($node));  | 
                                                        
| 135 | 135 | }  | 
                                                        
| 136 | 136 | |
@@ -145,7 +145,7 @@ discard block  | 
                                                    ||
| 145 | 145 | */  | 
                                                        
| 146 | 146 |  	public function _insertBefore(DOMNodeList $nodes):DOMNode{ | 
                                                        
| 147 | 147 | |
| 148 | -		foreach($nodes as $node){ | 
                                                        |
| 148 | +		foreach ($nodes as $node) { | 
                                                        |
| 149 | 149 | $this->parentNode->insertBefore($this->_importNode($node), $this);  | 
                                                        
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
@@ -173,10 +173,10 @@ discard block  | 
                                                    ||
| 173 | 173 |  	public function _insertAfter(DOMNodeList $nodes):DOMNode{ | 
                                                        
| 174 | 174 | $node = $this->nextSibling;  | 
                                                        
| 175 | 175 | |
| 176 | -		if(!$node){ | 
                                                        |
| 176 | +		if (!$node) { | 
                                                        |
| 177 | 177 | $this->parentNode->_insertBottom($nodes);  | 
                                                        
| 178 | 178 | }  | 
                                                        
| 179 | -		else{ | 
                                                        |
| 179 | +		else { | 
                                                        |
| 180 | 180 | $node->_insertBefore($nodes);  | 
                                                        
| 181 | 181 | }  | 
                                                        
| 182 | 182 | |
@@ -198,14 +198,14 @@ discard block  | 
                                                    ||
| 198 | 198 | */  | 
                                                        
| 199 | 199 |  	public function insert($content):DOMNode{ | 
                                                        
| 200 | 200 | |
| 201 | -		if(is_string($content) || $content instanceof DOMNode || $content instanceof DOMNodeList){ | 
                                                        |
| 201 | +		if (is_string($content) || $content instanceof DOMNode || $content instanceof DOMNodeList) { | 
                                                        |
| 202 | 202 | $this->_insertBottom($this->ownerDocument->_toDOMNodeList($content));  | 
                                                        
| 203 | 203 | }  | 
                                                        
| 204 | -		elseif(is_array($content)){ | 
                                                        |
| 204 | +		elseif (is_array($content)) { | 
                                                        |
| 205 | 205 | |
| 206 | -			foreach(['before', 'after', 'top', 'bottom'] as $pos){ | 
                                                        |
| 206 | +			foreach (['before', 'after', 'top', 'bottom'] as $pos) { | 
                                                        |
| 207 | 207 | |
| 208 | -				if(array_key_exists($pos, $content)){ | 
                                                        |
| 208 | +				if (array_key_exists($pos, $content)) { | 
                                                        |
| 209 | 209 | call_user_func_array(  | 
                                                        
| 210 | 210 | [$this, '_insert'.ucfirst($pos)],  | 
                                                        
| 211 | 211 | [$this->ownerDocument->_toDOMNodeList($content[$pos])]  | 
                                                        
@@ -215,7 +215,7 @@ discard block  | 
                                                    ||
| 215 | 215 | }  | 
                                                        
| 216 | 216 | |
| 217 | 217 | }  | 
                                                        
| 218 | -		else{ | 
                                                        |
| 218 | +		else { | 
                                                        |
| 219 | 219 |  			throw new \Exception('invalid content: '.gettype($content)); | 
                                                        
| 220 | 220 | }  | 
                                                        
| 221 | 221 | |
@@ -175,8 +175,7 @@ discard block  | 
                                                    ||
| 175 | 175 | |
| 176 | 176 |  		if(!$node){ | 
                                                        
| 177 | 177 | $this->parentNode->_insertBottom($nodes);  | 
                                                        
| 178 | - }  | 
                                                        |
| 179 | -		else{ | 
                                                        |
| 178 | +		} else{ | 
                                                        |
| 180 | 179 | $node->_insertBefore($nodes);  | 
                                                        
| 181 | 180 | }  | 
                                                        
| 182 | 181 | |
@@ -200,8 +199,7 @@ discard block  | 
                                                    ||
| 200 | 199 | |
| 201 | 200 |  		if(is_string($content) || $content instanceof DOMNode || $content instanceof DOMNodeList){ | 
                                                        
| 202 | 201 | $this->_insertBottom($this->ownerDocument->_toDOMNodeList($content));  | 
                                                        
| 203 | - }  | 
                                                        |
| 204 | -		elseif(is_array($content)){ | 
                                                        |
| 202 | +		} elseif(is_array($content)){ | 
                                                        |
| 205 | 203 | |
| 206 | 204 |  			foreach(['before', 'after', 'top', 'bottom'] as $pos){ | 
                                                        
| 207 | 205 | |
@@ -214,8 +212,7 @@ discard block  | 
                                                    ||
| 214 | 212 | |
| 215 | 213 | }  | 
                                                        
| 216 | 214 | |
| 217 | - }  | 
                                                        |
| 218 | -		else{ | 
                                                        |
| 215 | +		} else{ | 
                                                        |
| 219 | 216 |  			throw new \Exception('invalid content: '.gettype($content)); | 
                                                        
| 220 | 217 | }  | 
                                                        
| 221 | 218 | |
@@ -39,8 +39,8 @@  | 
                                                    ||
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
| 41 | 41 | /**  | 
                                                        
| 42 | - * @param $selector  | 
                                                        |
| 43 | - * @param $index  | 
                                                        |
| 42 | + * @param string|null $selector  | 
                                                        |
| 43 | + * @param null|integer $index  | 
                                                        |
| 44 | 44 | * @param string $property  | 
                                                        
| 45 | 45 | * @param int $nodeType  | 
                                                        
| 46 | 46 | *  | 
                                                        
@@ -12,7 +12,7 @@  | 
                                                    ||
| 12 | 12 | |
| 13 | 13 | namespace chillerlan\PrototypeDOM;  | 
                                                        
| 14 | 14 | |
| 15 | -use DOMNode, DOMNodeList;  | 
                                                        |
| 15 | +use DOMNode;  | 
                                                        |
| 16 | 16 | |
| 17 | 17 | /**  | 
                                                        
| 18 | 18 | * @extends \DOMNode  | 
                                                        
@@ -17,7 +17,7 @@ discard block  | 
                                                    ||
| 17 | 17 | /**  | 
                                                        
| 18 | 18 | * @extends \DOMNode  | 
                                                        
| 19 | 19 | */  | 
                                                        
| 20 | -trait NodeTraversalTrait{ | 
                                                        |
| 20 | +trait NodeTraversalTrait { | 
                                                        |
| 21 | 21 | |
| 22 | 22 | /**  | 
                                                        
| 23 | 23 | * @link http://php.net/manual/class.domnode.php#domnode.props.ownerdocument  | 
                                                        
@@ -46,9 +46,9 @@ discard block  | 
                                                    ||
| 46 | 46 | *  | 
                                                        
| 47 | 47 | * @return \DOMNode|null  | 
                                                        
| 48 | 48 | */  | 
                                                        
| 49 | -	public function _recursivelyFind($selector, $index, string $property, int $nodeType = XML_ELEMENT_NODE){ | 
                                                        |
| 49 | +	public function _recursivelyFind($selector, $index, string $property, int $nodeType = XML_ELEMENT_NODE) { | 
                                                        |
| 50 | 50 | |
| 51 | -		if(is_numeric($selector)){ | 
                                                        |
| 51 | +		if (is_numeric($selector)) { | 
                                                        |
| 52 | 52 | $index = $selector;  | 
                                                        
| 53 | 53 | $selector = null;  | 
                                                        
| 54 | 54 | }  | 
                                                        
@@ -91,13 +91,13 @@ discard block  | 
                                                    ||
| 91 | 91 | *  | 
                                                        
| 92 | 92 | * @return \DOMNode|null  | 
                                                        
| 93 | 93 | */  | 
                                                        
| 94 | -	public function down($expression = null, int $index = 0){ | 
                                                        |
| 94 | +	public function down($expression = null, int $index = 0) { | 
                                                        |
| 95 | 95 | |
| 96 | -		if(count(func_get_args()) === 0){ | 
                                                        |
| 96 | +		if (count(func_get_args()) === 0) { | 
                                                        |
| 97 | 97 | return $this->firstDescendant();  | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
| 100 | -		if(is_numeric($expression)){ | 
                                                        |
| 100 | +		if (is_numeric($expression)) { | 
                                                        |
| 101 | 101 | $index = $expression;  | 
                                                        
| 102 | 102 | $expression = '*';  | 
                                                        
| 103 | 103 | }  | 
                                                        
@@ -111,7 +111,7 @@ discard block  | 
                                                    ||
| 111 | 111 | *  | 
                                                        
| 112 | 112 | * @return \DOMNode|null  | 
                                                        
| 113 | 113 | */  | 
                                                        
| 114 | -	public function up($expression = null, int $index = null){ | 
                                                        |
| 114 | +	public function up($expression = null, int $index = null) { | 
                                                        |
| 115 | 115 | return $this->_recursivelyFind($expression, $index, 'parentNode');  | 
                                                        
| 116 | 116 | }  | 
                                                        
| 117 | 117 | |
@@ -121,7 +121,7 @@ discard block  | 
                                                    ||
| 121 | 121 | *  | 
                                                        
| 122 | 122 | * @return \DOMNode|null  | 
                                                        
| 123 | 123 | */  | 
                                                        
| 124 | -	public function previous($expression = null, int $index = null){ | 
                                                        |
| 124 | +	public function previous($expression = null, int $index = null) { | 
                                                        |
| 125 | 125 | return $this->_recursivelyFind($expression, $index, 'previousSibling');  | 
                                                        
| 126 | 126 | }  | 
                                                        
| 127 | 127 | |
@@ -131,7 +131,7 @@ discard block  | 
                                                    ||
| 131 | 131 | *  | 
                                                        
| 132 | 132 | * @return \DOMNode|null  | 
                                                        
| 133 | 133 | */  | 
                                                        
| 134 | -	public function next($expression = null, int $index = null){ | 
                                                        |
| 134 | +	public function next($expression = null, int $index = null) { | 
                                                        |
| 135 | 135 | return $this->_recursivelyFind($expression, $index, 'nextSibling');  | 
                                                        
| 136 | 136 | }  | 
                                                        
| 137 | 137 | |
@@ -143,9 +143,9 @@ discard block  | 
                                                    ||
| 143 | 143 |  	public function childElements(int $nodeType = XML_ELEMENT_NODE):array{ | 
                                                        
| 144 | 144 | $children = [];  | 
                                                        
| 145 | 145 | |
| 146 | -		foreach($this->childNodes as $child){ | 
                                                        |
| 146 | +		foreach ($this->childNodes as $child) { | 
                                                        |
| 147 | 147 | |
| 148 | -			if($child->nodeType === $nodeType){ | 
                                                        |
| 148 | +			if ($child->nodeType === $nodeType) { | 
                                                        |
| 149 | 149 | $children[] = $child;  | 
                                                        
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
@@ -161,9 +161,9 @@ discard block  | 
                                                    ||
| 161 | 161 | */  | 
                                                        
| 162 | 162 |  	public function descendantOf(DOMNode $ancestor):bool{ | 
                                                        
| 163 | 163 | |
| 164 | -		foreach($this->ancestors() as $match){ | 
                                                        |
| 164 | +		foreach ($this->ancestors() as $match) { | 
                                                        |
| 165 | 165 | |
| 166 | -			if($ancestor->isSameNode($match)){ | 
                                                        |
| 166 | +			if ($ancestor->isSameNode($match)) { | 
                                                        |
| 167 | 167 | return true;  | 
                                                        
| 168 | 168 | }  | 
                                                        
| 169 | 169 | |
@@ -196,7 +196,7 @@ discard block  | 
                                                    ||
| 196 | 196 | /**  | 
                                                        
| 197 | 197 | * @return \DOMNode|null  | 
                                                        
| 198 | 198 | */  | 
                                                        
| 199 | -	public function firstDescendant(){ | 
                                                        |
| 199 | +	public function firstDescendant() { | 
                                                        |
| 200 | 200 | return $this->descendants()[0] ?? null;  | 
                                                        
| 201 | 201 | }  | 
                                                        
| 202 | 202 | |
@@ -14,6 +14,6 @@  | 
                                                    ||
| 14 | 14 | |
| 15 | 15 | use DOMText;  | 
                                                        
| 16 | 16 | |
| 17 | -class Text extends DOMText{ | 
                                                        |
| 17 | +class Text extends DOMText { | 
                                                        |
| 18 | 18 | use NodeTraversalTrait, NodeManipulationTrait;  | 
                                                        
| 19 | 19 | }  | 
                                                        
@@ -16,6 +16,6 @@  | 
                                                    ||
| 16 | 16 | |
| 17 | 17 | /**  | 
                                                        
| 18 | 18 | */  | 
                                                        
| 19 | -class DocumentFragment extends DOMDocumentFragment{ | 
                                                        |
| 19 | +class DocumentFragment extends DOMDocumentFragment { | 
                                                        |
| 20 | 20 | use NodeTraversalTrait, NodeManipulationTrait;  | 
                                                        
| 21 | 21 | }  |