Passed
Push — master ( 9afa79...f29488 )
by smiley
01:58
created
src/Node/PrototypeElementTrait.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @param string|array|\DOMNode|\DOMNodeList $content
52 52
 	 *
53
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeElement
53
+	 * @return PrototypeElementTrait
54 54
 	 */
55 55
 	public function insert($content):PrototypeElement{
56 56
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @param \chillerlan\PrototypeDOM\Node\PrototypeElement      $node
89 89
 	 * @param \chillerlan\PrototypeDOM\Node\PrototypeElement|null $refNode
90 90
 	 *
91
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeElement
91
+	 * @return PrototypeElementTrait
92 92
 	 */
93 93
 	public function insert_before(PrototypeElement $node, PrototypeElement $refNode = null):PrototypeElement{
94 94
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	/**
131 131
 	 * @param \chillerlan\PrototypeDOM\Node\PrototypeElement $node
132 132
 	 *
133
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeElement
133
+	 * @return PrototypeElementTrait
134 134
 	 */
135 135
 	public function insert_bottom(PrototypeElement $node):PrototypeElement{
136 136
 		$this->appendChild($this->importNode($node));
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\PrototypeDOM\Node;
14 14
 
15
-use chillerlan\PrototypeDOM\NodeList;
16
-
17 15
 trait PrototypeElementTrait{
18 16
 	use PrototypeTraversalTrait;
19 17
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 use chillerlan\PrototypeDOM\NodeList;
16 16
 
17
-trait PrototypeElementTrait{
17
+trait PrototypeElementTrait {
18 18
 	use PrototypeTraversalTrait;
19 19
 
20 20
 	/**
@@ -54,28 +54,28 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function insert($content):PrototypeElement{
56 56
 
57
-		if(!\is_array($content)){
57
+		if (!\is_array($content)) {
58 58
 
59
-			foreach($this->ownerDocument->toNodeList($content) as $node){
59
+			foreach ($this->ownerDocument->toNodeList($content) as $node) {
60 60
 				$this->insert_bottom($node);
61 61
 			}
62 62
 
63 63
 			return $this;
64 64
 		}
65 65
 
66
-		foreach(['before', 'after', 'top', 'bottom'] as $pos){
66
+		foreach (['before', 'after', 'top', 'bottom'] as $pos) {
67 67
 
68
-			if(!\array_key_exists($pos, $content)){
68
+			if (!\array_key_exists($pos, $content)) {
69 69
 				continue;
70 70
 			}
71 71
 
72 72
 			$nodes = $this->ownerDocument->toNodeList($content[$pos]);
73 73
 
74
-			if($pos === 'top' && $this->hasChildNodes() || $pos === 'after' && $this->nextSibling){
74
+			if ($pos === 'top' && $this->hasChildNodes() || $pos === 'after' && $this->nextSibling) {
75 75
 				$nodes->reverse();
76 76
 			}
77 77
 
78
-			foreach($nodes as $node){
78
+			foreach ($nodes as $node) {
79 79
 				\call_user_func_array([$this, 'insert_'.$pos], [$node]);
80 80
 			}
81 81
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function insert_before(PrototypeElement $node, PrototypeElement $refNode = null):PrototypeElement{
94 94
 
95
-		if($this->parentNode){
95
+		if ($this->parentNode) {
96 96
 			$this->parentNode->insertBefore($this->importNode($node), $refNode ?? $this);
97 97
 		}
98 98
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function insert_after(PrototypeElement $node):PrototypeElement{
108 108
 
109
-		if(!$this->nextSibling && $this->parentNode){
109
+		if (!$this->nextSibling && $this->parentNode) {
110 110
 			return $this->parentNode->insert_bottom($node); // @codeCoverageIgnore
111 111
 		}
112 112
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function insert_top(PrototypeElement $node):PrototypeElement{
122 122
 
123
-		if($this->hasChildNodes()){
123
+		if ($this->hasChildNodes()) {
124 124
 			return $this->firstChild->insert_before($node, $this->firstChild);
125 125
 		}
126 126
 
Please login to merge, or discard this patch.
src/Node/PrototypeHTMLElementTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@
 block discarded – undo
175 175
 	 * @param array $style
176 176
 	 * @param bool  $replace
177 177
 	 *
178
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeHTMLElement
178
+	 * @return PrototypeHTMLElementTrait
179 179
 	 */
180 180
 	public function setStyle(array $style, bool $replace = null):PrototypeHTMLElement{
181 181
 		$currentStyle = $this->getStyles();
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  * @property string $src
22 22
  * @property string $innerHTML
23 23
  */
24
-trait PrototypeHTMLElementTrait{
24
+trait PrototypeHTMLElementTrait {
25 25
 	use PrototypeElementTrait;
26 26
 
27 27
 	protected function magic_get_id():string{
28 28
 		return \trim($this->getAttribute('id'));
29 29
 	}
30 30
 
31
-	protected function magic_set_id(string $id){
31
+	protected function magic_set_id(string $id) {
32 32
 		return $this->setAttribute('id', $id);
33 33
 	}
34 34
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		return \trim($this->getAttribute('class'));
37 37
 	}
38 38
 
39
-	protected function magic_set_class(string $class){
39
+	protected function magic_set_class(string $class) {
40 40
 		return $this->setAttribute('class', $class);
41 41
 	}
42 42
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		return \trim($this->getAttribute('href'));
45 45
 	}
46 46
 
47
-	protected function magic_set_href(string $href){
47
+	protected function magic_set_href(string $href) {
48 48
 		return $this->setAttribute('href', $href);
49 49
 	}
50 50
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		return \trim($this->getAttribute('src'));
53 53
 	}
54 54
 
55
-	protected function magic_set_src(string $src){
55
+	protected function magic_set_src(string $src) {
56 56
 		return $this->setAttribute('src', $src);
57 57
 	}
58 58
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	public function identify(string $newID = null):string{
71 71
 		$oldID = $this->id;
72 72
 
73
-		if($newID !== null){
73
+		if ($newID !== null) {
74 74
 			$this->id = $newID;
75 75
 		}
76 76
 
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function classNames():array{
86 86
 
87
-		if(!$this->hasAttributes()){
87
+		if (!$this->hasAttributes()) {
88 88
 			return [];
89 89
 		}
90 90
 
91 91
 		$classnames        = \explode(' ', $this->class);
92 92
 		$currentClassnames = [];
93 93
 
94
-		foreach($classnames as $classname){
94
+		foreach ($classnames as $classname) {
95 95
 
96
-			if(empty($classname)){
96
+			if (empty($classname)) {
97 97
 				continue;
98 98
 			}
99 99
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public function toggleClassName(string $classname):PrototypeHTMLElement{
147 147
 
148
-		if($this->hasClassName($classname)){
148
+		if ($this->hasClassName($classname)) {
149 149
 			return $this->removeClassName($classname);
150 150
 		}
151 151
 
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @return null|string
161 161
 	 */
162
-	public function getStyle(string $property):?string{
162
+	public function getStyle(string $property): ?string{
163 163
 		$currentStyle = $this->getStyles();
164 164
 
165
-		if(\array_key_exists(\strtolower($property), $currentStyle)){
165
+		if (\array_key_exists(\strtolower($property), $currentStyle)) {
166 166
 			return $currentStyle[$property];
167 167
 		}
168 168
 
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	public function setStyle(array $style, bool $replace = null):PrototypeHTMLElement{
181 181
 		$currentStyle = $this->getStyles();
182 182
 
183
-		if($replace !== true){
183
+		if ($replace !== true) {
184 184
 			$style = \array_merge($currentStyle, $style);
185 185
 		}
186 186
 
187
-		foreach($style as $property => $value){
187
+		foreach ($style as $property => $value) {
188 188
 			$style[$property] = $property.': '.$value.';';
189 189
 		}
190 190
 
Please login to merge, or discard this patch.
src/Node/PrototypeNodeTrait.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	/**
101
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode
101
+	 * @return PrototypeNodeTrait
102 102
 	 */
103 103
 	public function purge():PrototypeNode{
104 104
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	/**
113 113
 	 * @link http://api.prototypejs.org/dom/Element/cleanWhitespace/
114 114
 	 *
115
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode
115
+	 * @return PrototypeNodeTrait
116 116
 	 */
117 117
 	public function cleanWhitespace():PrototypeNode{
118 118
 		$node = $this->firstChild;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * @property string                                $baseURI
33 33
  * @property string                                $textContent
34 34
  */
35
-trait PrototypeNodeTrait{
35
+trait PrototypeNodeTrait {
36 36
 
37 37
 	/**
38 38
 	 * @link http://api.prototypejs.org/dom/Element/recursivelyCollect/
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function remove():PrototypeNode{
76 76
 
77
-		if(!$this->parentNode){
77
+		if (!$this->parentNode) {
78 78
 			return $this;
79 79
 		}
80 80
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function replace(PrototypeNode $newnode):PrototypeNode{
92 92
 
93
-		if(!$this->parentNode){
93
+		if (!$this->parentNode) {
94 94
 			return $this;
95 95
 		}
96 96
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function purge():PrototypeNode{
104 104
 
105
-		while($this->hasChildNodes()){
105
+		while ($this->hasChildNodes()) {
106 106
 			$this->firstChild->remove();
107 107
 		}
108 108
 
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 	public function cleanWhitespace():PrototypeNode{
118 118
 		$node = $this->firstChild;
119 119
 
120
-		while($node){
120
+		while ($node) {
121 121
 			$nextNode = $node->nextSibling;
122 122
 
123
-			if($node->nodeType === \XML_TEXT_NODE && $node->empty()){
123
+			if ($node->nodeType === \XML_TEXT_NODE && $node->empty()) {
124 124
 				$node->remove();
125 125
 			}
126 126
 
Please login to merge, or discard this patch.
src/Node/PrototypeTraversalTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 	use PrototypeNodeTrait;
23 23
 
24 24
 	/**
25
-	 * @param        $selector
25
+	 * @param        string|null $selector
26 26
 	 * @param        $index
27 27
 	 * @param string $property
28 28
 	 * @param int    $nodeType https://secure.php.net/manual/dom.constants.php
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * @property \chillerlan\PrototypeDOM\Document $ownerDocument
20 20
  */
21
-trait PrototypeTraversalTrait{
21
+trait PrototypeTraversalTrait {
22 22
 	use PrototypeNodeTrait;
23 23
 
24 24
 	/**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|\DOMNode|null
31 31
 	 */
32
-	public function recursivelyFind($selector, int $index = null, string $property = null, int $nodeType = \XML_ELEMENT_NODE):?PrototypeTraversal{
32
+	public function recursivelyFind($selector, int $index = null, string $property = null, int $nodeType = \XML_ELEMENT_NODE): ?PrototypeTraversal{
33 33
 
34
-		if(\is_numeric($selector)){
34
+		if (\is_numeric($selector)) {
35 35
 			return $this->ownerDocument->recursivelyFind($this, $property, null, $selector, $nodeType);
36 36
 		}
37 37
 
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
70 70
 	 */
71
-	public function down($expression = null, int $index = null):?PrototypeTraversal{
71
+	public function down($expression = null, int $index = null): ?PrototypeTraversal{
72 72
 
73
-		if($expression === null && $index === null){
73
+		if ($expression === null && $index === null) {
74 74
 			return $this->firstDescendant();
75 75
 		}
76 76
 
77 77
 		$index = $index ?? 0;
78 78
 
79
-		if(\is_int($expression)){
79
+		if (\is_int($expression)) {
80 80
 			return $this->select(['*'])->item($expression);
81 81
 		}
82 82
 
83
-		if(\is_array($expression)){
83
+		if (\is_array($expression)) {
84 84
 			return $this->select($expression)->item($index);
85 85
 		}
86 86
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
97 97
 	 */
98
-	public function up($expression = null, int $index = null):?PrototypeTraversal{
98
+	public function up($expression = null, int $index = null): ?PrototypeTraversal{
99 99
 		return $this->recursivelyFind($expression, $index, 'parentNode');
100 100
 	}
101 101
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
109 109
 	 */
110
-	public function previous($expression = null, int $index = null):?PrototypeTraversal{
110
+	public function previous($expression = null, int $index = null): ?PrototypeTraversal{
111 111
 		return $this->recursivelyFind($expression, $index, 'previousSibling');
112 112
 	}
113 113
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
121 121
 	 */
122
-	public function next($expression = null, int $index = null):?PrototypeTraversal{
122
+	public function next($expression = null, int $index = null): ?PrototypeTraversal{
123 123
 		return $this->recursivelyFind($expression, $index, 'nextSibling');
124 124
 	}
125 125
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	public function childElements(int $nodeType = \XML_ELEMENT_NODE):NodeList{
134 134
 		$children = new NodeList;
135 135
 
136
-		if(!$this->hasChildNodes()){
136
+		if (!$this->hasChildNodes()) {
137 137
 			return $children;
138 138
 		}
139 139
 
140
-		foreach($this->childNodes as $child){
140
+		foreach ($this->childNodes as $child) {
141 141
 
142
-			if($child->nodeType === $nodeType){
142
+			if ($child->nodeType === $nodeType) {
143 143
 				$children[] = $child;
144 144
 			}
145 145
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
193 193
 	 */
194
-	public function firstDescendant():?PrototypeTraversal{
194
+	public function firstDescendant(): ?PrototypeTraversal{
195 195
 		return $this->descendants()->first();
196 196
 	}
197 197
 
Please login to merge, or discard this patch.
src/Node/CharacterData.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\PrototypeDOM\Node;
14 14
 
15
-class CharacterData extends \DOMCharacterData implements PrototypeElement{
15
+class CharacterData extends \DOMCharacterData implements PrototypeElement {
16 16
 	use PrototypeElementTrait;
17 17
 }
Please login to merge, or discard this patch.
src/Node/CdataSection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\PrototypeDOM\Node;
14 14
 
15
-class CdataSection extends \DOMCdataSection implements PrototypeNode{
15
+class CdataSection extends \DOMCdataSection implements PrototypeNode {
16 16
 	use PrototypeNodeTrait;
17 17
 }
Please login to merge, or discard this patch.
src/Node/ProcessingInstruction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\PrototypeDOM\Node;
14 14
 
15
-class ProcessingInstruction extends \DOMProcessingInstruction implements PrototypeNode{
15
+class ProcessingInstruction extends \DOMProcessingInstruction implements PrototypeNode {
16 16
 	use PrototypeNodeTrait;
17 17
 }
Please login to merge, or discard this patch.
src/Node/DocumentFragment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\PrototypeDOM\Node;
14 14
 
15
-class DocumentFragment extends \DOMDocumentFragment implements PrototypeElement{
15
+class DocumentFragment extends \DOMDocumentFragment implements PrototypeElement {
16 16
 	use PrototypeElementTrait;
17 17
 }
Please login to merge, or discard this patch.
src/Node/PrototypeTraversal.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use chillerlan\PrototypeDOM\NodeList;
16 16
 use DOMNode;
17 17
 
18
-interface PrototypeTraversal extends PrototypeNode{
18
+interface PrototypeTraversal extends PrototypeNode {
19 19
 
20 20
 	/**
21 21
 	 * @link http://api.prototypejs.org/dom/Element/select/
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
45 45
 	 */
46
-	public function down($expression = null, int $index = null):?PrototypeTraversal;
46
+	public function down($expression = null, int $index = null): ?PrototypeTraversal;
47 47
 
48 48
 	/**
49 49
 	 * @link http://api.prototypejs.org/dom/Element/up/
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
55 55
 	 */
56
-	public function up($expression = null, int $index = null):?PrototypeTraversal;
56
+	public function up($expression = null, int $index = null): ?PrototypeTraversal;
57 57
 
58 58
 	/**
59 59
 	 * @link http://api.prototypejs.org/dom/Element/previous/
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
65 65
 	 */
66
-	public function previous($expression = null, int $index = null):?PrototypeTraversal;
66
+	public function previous($expression = null, int $index = null): ?PrototypeTraversal;
67 67
 
68 68
 	/**
69 69
 	 * @link http://api.prototypejs.org/dom/Element/next/
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
75 75
 	 */
76
-	public function next($expression = null, int $index = null):?PrototypeTraversal;
76
+	public function next($expression = null, int $index = null): ?PrototypeTraversal;
77 77
 
78 78
 	/**
79 79
 	 * @link http://api.prototypejs.org/dom/Element/childElements/
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
121 121
 	 */
122
-	public function firstDescendant():?PrototypeTraversal;
122
+	public function firstDescendant(): ?PrototypeTraversal;
123 123
 
124 124
 	/**
125 125
 	 * @link http://api.prototypejs.org/dom/Element/previousSiblings/
Please login to merge, or discard this patch.