Passed
Push — master ( 0d4bed...8e4c14 )
by smiley
03:55
created
src/Node/PrototypeElement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  * @property bool   $schemaTypeInfo
17 17
  * @property string $tagName
18 18
  */
19
-interface PrototypeElement extends PrototypeTraversal{
19
+interface PrototypeElement extends PrototypeTraversal {
20 20
 
21 21
 	/**
22 22
 	 * @link http://api.prototypejs.org/dom/Element/wrap/
Please login to merge, or discard this patch.
src/Node/PrototypeHTMLElement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * @property string $href
20 20
  * @property string $src
21 21
  */
22
-interface PrototypeHTMLElement extends PrototypeElement{
22
+interface PrototypeHTMLElement extends PrototypeElement {
23 23
 
24 24
 	/**
25 25
 	 * http://api.prototypejs.org/dom/Element/identify/
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return null|string
82 82
 	 */
83
-	public function getStyle(string $property):?string;
83
+	public function getStyle(string $property): ?string;
84 84
 
85 85
 	/**
86 86
 	 * @link http://api.prototypejs.org/dom/Element/setStyle/
Please login to merge, or discard this patch.
src/Node/PrototypeNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
  * @property string                                $baseURI
33 33
  * @property string                                $textContent
34 34
  */
35
-interface PrototypeNode{
35
+interface PrototypeNode {
36 36
 
37 37
 	/**
38 38
 	 * @link http://api.prototypejs.org/dom/Element/recursivelyCollect/
Please login to merge, or discard this patch.
src/Node/PrototypeElementTrait.php 2 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.
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 function array_key_exists, call_user_func_array, is_array;
16 16
 
17
-trait PrototypeElementTrait{
17
+trait PrototypeElementTrait {
18 18
 
19 19
 	use PrototypeTraversalTrait;
20 20
 
@@ -55,28 +55,28 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function insert($content):PrototypeElement{
57 57
 
58
-		if(!is_array($content)){
58
+		if (!is_array($content)) {
59 59
 
60
-			foreach($this->ownerDocument->toNodeList($content) as $node){
60
+			foreach ($this->ownerDocument->toNodeList($content) as $node) {
61 61
 				$this->insert_bottom($node);
62 62
 			}
63 63
 
64 64
 			return $this;
65 65
 		}
66 66
 
67
-		foreach(['before', 'after', 'top', 'bottom'] as $pos){
67
+		foreach (['before', 'after', 'top', 'bottom'] as $pos) {
68 68
 
69
-			if(!array_key_exists($pos, $content)){
69
+			if (!array_key_exists($pos, $content)) {
70 70
 				continue;
71 71
 			}
72 72
 
73 73
 			$nodes = $this->ownerDocument->toNodeList($content[$pos]);
74 74
 
75
-			if($pos === 'top' && $this->hasChildNodes() || $pos === 'after' && $this->nextSibling){
75
+			if ($pos === 'top' && $this->hasChildNodes() || $pos === 'after' && $this->nextSibling) {
76 76
 				$nodes->reverse();
77 77
 			}
78 78
 
79
-			foreach($nodes as $node){
79
+			foreach ($nodes as $node) {
80 80
 				call_user_func_array([$this, 'insert_'.$pos], [$node]);
81 81
 			}
82 82
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function insert_before(PrototypeElement $node, PrototypeElement $refNode = null):PrototypeElement{
95 95
 
96
-		if($this->parentNode){
96
+		if ($this->parentNode) {
97 97
 			$this->parentNode->insertBefore($this->importNode($node), $refNode ?? $this);
98 98
 		}
99 99
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function insert_after(PrototypeElement $node):PrototypeElement{
109 109
 
110
-		if(!$this->nextSibling && $this->parentNode){
110
+		if (!$this->nextSibling && $this->parentNode) {
111 111
 			return $this->parentNode->insert_bottom($node); // @codeCoverageIgnore
112 112
 		}
113 113
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function insert_top(PrototypeElement $node):PrototypeElement{
123 123
 
124
-		if($this->hasChildNodes()){
124
+		if ($this->hasChildNodes()) {
125 125
 			return $this->firstChild->insert_before($node, $this->firstChild);
126 126
 		}
127 127
 
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
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
  * @property string $src
24 24
  * @property string $innerHTML
25 25
  */
26
-trait PrototypeHTMLElementTrait{
26
+trait PrototypeHTMLElementTrait {
27 27
 	use Magic, PrototypeElementTrait;
28 28
 
29 29
 	protected function magic_get_id():string{
30 30
 		return trim($this->getAttribute('id'));
31 31
 	}
32 32
 
33
-	protected function magic_set_id(string $id){
33
+	protected function magic_set_id(string $id) {
34 34
 		return $this->setAttribute('id', $id);
35 35
 	}
36 36
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		return trim($this->getAttribute('class'));
39 39
 	}
40 40
 
41
-	protected function magic_set_class(string $class){
41
+	protected function magic_set_class(string $class) {
42 42
 		return $this->setAttribute('class', $class);
43 43
 	}
44 44
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		return trim($this->getAttribute('href'));
47 47
 	}
48 48
 
49
-	protected function magic_set_href(string $href){
49
+	protected function magic_set_href(string $href) {
50 50
 		return $this->setAttribute('href', $href);
51 51
 	}
52 52
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		return trim($this->getAttribute('src'));
55 55
 	}
56 56
 
57
-	protected function magic_set_src(string $src){
57
+	protected function magic_set_src(string $src) {
58 58
 		return $this->setAttribute('src', $src);
59 59
 	}
60 60
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function identify(string $newID = null):string{
73 73
 		$oldID = $this->id;
74 74
 
75
-		if($newID !== null){
75
+		if ($newID !== null) {
76 76
 			$this->id = $newID;
77 77
 		}
78 78
 
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function classNames():array{
88 88
 
89
-		if(!$this->hasAttributes()){
89
+		if (!$this->hasAttributes()) {
90 90
 			return [];
91 91
 		}
92 92
 
93 93
 		$classnames        = explode(' ', $this->class);
94 94
 		$currentClassnames = [];
95 95
 
96
-		foreach($classnames as $classname){
96
+		foreach ($classnames as $classname) {
97 97
 			$classname = trim($classname);
98 98
 
99
-			if(!empty($classname)){
99
+			if (!empty($classname)) {
100 100
 				$currentClassnames[] = $classname;
101 101
 			}
102 102
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function toggleClassName(string $classname):PrototypeHTMLElement{
149 149
 
150
-		if($this->hasClassName($classname)){
150
+		if ($this->hasClassName($classname)) {
151 151
 			return $this->removeClassName($classname);
152 152
 		}
153 153
 
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return null|string
163 163
 	 */
164
-	public function getStyle(string $property):?string{
164
+	public function getStyle(string $property): ?string{
165 165
 		$currentStyle = $this->getStyles();
166 166
 
167
-		if(array_key_exists(strtolower($property), $currentStyle)){
167
+		if (array_key_exists(strtolower($property), $currentStyle)) {
168 168
 			return $currentStyle[$property];
169 169
 		}
170 170
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	public function setStyle(array $style, bool $replace = null):PrototypeHTMLElement{
183 183
 		$currentStyle = $this->getStyles();
184 184
 
185
-		if($replace !== true){
185
+		if ($replace !== true) {
186 186
 			$style = array_merge($currentStyle, $style);
187 187
 		}
188 188
 
189
-		foreach($style as $property => $value){
189
+		foreach ($style as $property => $value) {
190 190
 			$style[$property] = $property.': '.$value.';';
191 191
 		}
192 192
 
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
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  * @property string                                $baseURI
37 37
  * @property string                                $textContent
38 38
  */
39
-trait PrototypeNodeTrait{
39
+trait PrototypeNodeTrait {
40 40
 
41 41
 	/**
42 42
 	 * @link http://api.prototypejs.org/dom/Element/recursivelyCollect/
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function remove():PrototypeNode{
80 80
 
81
-		if(!$this->parentNode){
81
+		if (!$this->parentNode) {
82 82
 			return $this;
83 83
 		}
84 84
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function replace(PrototypeNode $newnode):PrototypeNode{
96 96
 
97
-		if(!$this->parentNode){
97
+		if (!$this->parentNode) {
98 98
 			return $this;
99 99
 		}
100 100
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function purge():PrototypeNode{
108 108
 
109
-		while($this->hasChildNodes()){
109
+		while ($this->hasChildNodes()) {
110 110
 			$this->firstChild->remove();
111 111
 		}
112 112
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	public function cleanWhitespace():PrototypeNode{
122 122
 		$node = $this->firstChild;
123 123
 
124
-		while($node){
124
+		while ($node) {
125 125
 			$nextNode = $node->nextSibling;
126 126
 
127
-			if($node->nodeType === XML_TEXT_NODE && $node->empty()){
127
+			if ($node->nodeType === XML_TEXT_NODE && $node->empty()) {
128 128
 				$node->remove();
129 129
 			}
130 130
 
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
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * @property \chillerlan\PrototypeDOM\Document $ownerDocument
24 24
  */
25
-trait PrototypeTraversalTrait{
25
+trait PrototypeTraversalTrait {
26 26
 
27 27
 	use PrototypeNodeTrait;
28 28
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|\DOMNode|null
36 36
 	 */
37
-	public function recursivelyFind($selector, int $index = null, string $property = null, int $nodeType = XML_ELEMENT_NODE):?PrototypeTraversal{
37
+	public function recursivelyFind($selector, int $index = null, string $property = null, int $nodeType = XML_ELEMENT_NODE): ?PrototypeTraversal{
38 38
 
39
-		if(is_numeric($selector)){
39
+		if (is_numeric($selector)) {
40 40
 			return $this->ownerDocument->recursivelyFind($this, $property, null, $selector, $nodeType);
41 41
 		}
42 42
 
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
75 75
 	 */
76
-	public function down($expression = null, int $index = null):?PrototypeTraversal{
76
+	public function down($expression = null, int $index = null): ?PrototypeTraversal{
77 77
 
78
-		if($expression === null && $index === null){
78
+		if ($expression === null && $index === null) {
79 79
 			return $this->firstDescendant();
80 80
 		}
81 81
 
82 82
 		$index = $index ?? 0;
83 83
 
84
-		if(is_int($expression)){
84
+		if (is_int($expression)) {
85 85
 			return $this->select(['*'])->item($expression);
86 86
 		}
87 87
 
88
-		if(is_array($expression)){
88
+		if (is_array($expression)) {
89 89
 			return $this->select($expression)->item($index);
90 90
 		}
91 91
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
102 102
 	 */
103
-	public function up($expression = null, int $index = null):?PrototypeTraversal{
103
+	public function up($expression = null, int $index = null): ?PrototypeTraversal{
104 104
 		return $this->recursivelyFind($expression, $index, 'parentNode');
105 105
 	}
106 106
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
114 114
 	 */
115
-	public function previous($expression = null, int $index = null):?PrototypeTraversal{
115
+	public function previous($expression = null, int $index = null): ?PrototypeTraversal{
116 116
 		return $this->recursivelyFind($expression, $index, 'previousSibling');
117 117
 	}
118 118
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
126 126
 	 */
127
-	public function next($expression = null, int $index = null):?PrototypeTraversal{
127
+	public function next($expression = null, int $index = null): ?PrototypeTraversal{
128 128
 		return $this->recursivelyFind($expression, $index, 'nextSibling');
129 129
 	}
130 130
 
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 		$nodeType = $nodeType ?? XML_ELEMENT_NODE;
140 140
 		$children = new NodeList;
141 141
 
142
-		if(!$this->hasChildNodes()){
142
+		if (!$this->hasChildNodes()) {
143 143
 			return $children;
144 144
 		}
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
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null
199 199
 	 */
200
-	public function firstDescendant():?PrototypeTraversal{
200
+	public function firstDescendant(): ?PrototypeTraversal{
201 201
 		return $this->descendants()->first();
202 202
 	}
203 203
 
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.