Completed
Branch master (9cf31c)
by smiley
04:10 queued 02:05
created
src/Traits/ElementTrait.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * @link http://api.prototypejs.org/dom/Element/update/
33 33
 	 *
34
-	 * @param string|\DOMNode|\DOMNodeList $content
34
+	 * @param string $content
35 35
 	 *
36
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeElement
36
+	 * @return ElementTrait
37 37
 	 */
38 38
 	public function update($content):PrototypeElement{
39 39
 		$this->purge();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param string|array|\DOMNode|\DOMNodeList $content
55 55
 	 *
56
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeElement
56
+	 * @return ElementTrait
57 57
 	 */
58 58
 	public function insert($content):PrototypeElement{
59 59
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param \chillerlan\PrototypeDOM\Node\PrototypeElement      $node
91 91
 	 * @param \chillerlan\PrototypeDOM\Node\PrototypeElement|null $refNode
92 92
 	 *
93
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeElement
93
+	 * @return ElementTrait
94 94
 	 */
95 95
 	public function insert_before(PrototypeElement $node, PrototypeElement $refNode = null):PrototypeElement{
96 96
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	/**
127 127
 	 * @param \chillerlan\PrototypeDOM\Node\PrototypeElement $node
128 128
 	 *
129
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeElement
129
+	 * @return ElementTrait
130 130
 	 */
131 131
 	public function insert_bottom(PrototypeElement $node):PrototypeElement{
132 132
 		$this->appendChild($this->_importNode($node));
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 use chillerlan\PrototypeDOM\Node\PrototypeElement;
16 16
 
17
-trait ElementTrait{
17
+trait ElementTrait {
18 18
 	use TraversalTrait;
19 19
 
20 20
 	/**
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function insert($content):PrototypeElement{
59 59
 
60
-		if(is_array($content)){
60
+		if (is_array($content)) {
61 61
 
62
-			foreach(['before', 'after', 'top', 'bottom'] as $pos){
62
+			foreach (['before', 'after', 'top', 'bottom'] as $pos) {
63 63
 
64
-				if(array_key_exists($pos, $content)){
64
+				if (array_key_exists($pos, $content)) {
65 65
 					$nodes = $this->ownerDocument->_toNodeList($content[$pos]);
66 66
 
67
-					if($pos === 'top' && $this->hasChildNodes() || $pos === 'after' && $this->nextSibling){
67
+					if ($pos === 'top' && $this->hasChildNodes() || $pos === 'after' && $this->nextSibling) {
68 68
 						$nodes->reverse();
69 69
 					}
70 70
 
71
-					foreach($nodes as $node){
71
+					foreach ($nodes as $node) {
72 72
 						call_user_func_array([$this, 'insert_'.$pos], [$node]);
73 73
 					}
74 74
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 			}
78 78
 
79 79
 		}
80
-		else{
81
-			foreach($this->ownerDocument->_toNodeList($content) as $node){
80
+		else {
81
+			foreach ($this->ownerDocument->_toNodeList($content) as $node) {
82 82
 				$this->insert_bottom($node);
83 83
 			}
84 84
 		}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function insert_before(PrototypeElement $node, PrototypeElement $refNode = null):PrototypeElement{
96 96
 
97
-		if($this->parentNode){
97
+		if ($this->parentNode) {
98 98
 			$this->parentNode->insertBefore($this->_importNode($node), $refNode ?? $this);
99 99
 		}
100 100
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,8 +168,7 @@
 block discarded – undo
168 168
 
169 169
 			}
170 170
 
171
-		}
172
-		else{
171
+		} else{
173 172
 			foreach($this->ownerDocument->_toNodeList($content) as $node){
174 173
 				$this->insert_bottom($node);
175 174
 			}
Please login to merge, or discard this patch.
src/Traits/HTMLElementTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@
 block discarded – undo
158 158
 	 * @param array $style
159 159
 	 * @param bool  $replace
160 160
 	 *
161
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeHTMLElement
161
+	 * @return HTMLElementTrait
162 162
 	 */
163 163
 	public function setStyle(array $style, bool $replace = false):PrototypeHTMLElement{
164 164
 		$currentStyle = $this->getStyles();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @property string $src
22 22
  * @property string $innerHTML
23 23
  */
24
-trait HTMLElementTrait{
24
+trait HTMLElementTrait {
25 25
 	use Magic, ElementTrait;
26 26
 
27 27
 	protected function magic_get_id():string {
@@ -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(!is_null($newID)){
73
+		if (!is_null($newID)) {
74 74
 			$this->id = $newID;
75 75
 		}
76 76
 
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 	public function classNames():array{
86 86
 		$currentClassnames = [];
87 87
 
88
-		if($this->hasAttributes()){
88
+		if ($this->hasAttributes()) {
89 89
 			$classnames = explode(' ', $this->class);
90 90
 
91
-			if(!empty($classnames)){
91
+			if (!empty($classnames)) {
92 92
 
93
-				foreach($classnames as $classname){
93
+				foreach ($classnames as $classname) {
94 94
 
95
-					if(empty($classname)){
95
+					if (empty($classname)) {
96 96
 						continue;
97 97
 					}
98 98
 
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return null|string
162 162
 	 */
163
-	public function getStyle(string $property){
163
+	public function getStyle(string $property) {
164 164
 		$currentStyle = $this->getStyles();
165 165
 
166
-		if(array_key_exists(strtolower($property), $currentStyle)){
166
+		if (array_key_exists(strtolower($property), $currentStyle)) {
167 167
 			return $currentStyle[$property];
168 168
 		}
169 169
 
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 	public function setStyle(array $style, bool $replace = false):PrototypeHTMLElement{
182 182
 		$currentStyle = $this->getStyles();
183 183
 
184
-		if(!$replace){
184
+		if (!$replace) {
185 185
 			$style = array_merge($currentStyle, $style);
186 186
 		}
187 187
 
188
-		foreach($style as $property => $value){
188
+		foreach ($style as $property => $value) {
189 189
 			$style[$property] = $property.': '.$value.';';
190 190
 		}
191 191
 
Please login to merge, or discard this patch.
src/Traits/NodeTrait.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	}
103 103
 
104 104
 	/**
105
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode
105
+	 * @return NodeTrait
106 106
 	 */
107 107
 	public function purge():PrototypeNode{
108 108
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	/**
117 117
 	 * @link http://api.prototypejs.org/dom/Element/cleanWhitespace/
118 118
 	 *
119
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode
119
+	 * @return NodeTrait
120 120
 	 */
121 121
 	public function cleanWhitespace():PrototypeNode{
122 122
 		$node = $this->firstChild;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * @property string $baseURI
34 34
  * @property string $textContent
35 35
  */
36
-trait NodeTrait{
36
+trait NodeTrait {
37 37
 
38 38
 	/**
39 39
 	 * @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/Traits/TraversalTrait.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	use  NodeTrait;
20 20
 
21 21
 	/**
22
-	 * @param        $selector
23
-	 * @param        $index
22
+	 * @param        string|null $selector
23
+	 * @param        null|integer $index
24 24
 	 * @param string $property
25 25
 	 * @param int    $nodeType
26 26
 	 *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param null $expression
65 65
 	 * @param int  $index
66 66
 	 *
67
-	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null
67
+	 * @return \chillerlan\PrototypeDOM\Node\Element|null
68 68
 	 */
69 69
 	public function down($expression = null, int $index = null){
70 70
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use chillerlan\PrototypeDOM\Node\PrototypeNode;
16 16
 use chillerlan\PrototypeDOM\NodeList;
17 17
 
18
-trait TraversalTrait{
18
+trait TraversalTrait {
19 19
 	use  NodeTrait;
20 20
 
21 21
 	/**
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null
28 28
 	 */
29
-	public function _recursivelyFind($selector, $index, string $property, int $nodeType = XML_ELEMENT_NODE){
29
+	public function _recursivelyFind($selector, $index, string $property, int $nodeType = XML_ELEMENT_NODE) {
30 30
 
31
-		if(is_numeric($selector)){
31
+		if (is_numeric($selector)) {
32 32
 			$index    = $selector;
33 33
 			$selector = null;
34 34
 		}
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null
68 68
 	 */
69
-	public function down($expression = null, int $index = null){
69
+	public function down($expression = null, int $index = null) {
70 70
 
71
-		if(count(func_get_args()) === 0){
71
+		if (count(func_get_args()) === 0) {
72 72
 			return $this->firstDescendant();
73 73
 		}
74 74
 
75
-		if(is_int($expression)){
75
+		if (is_int($expression)) {
76 76
 			$index      = $expression;
77 77
 			$expression = '*';
78 78
 		}
79
-		else{
79
+		else {
80 80
 			$index = $index ?? 0;
81 81
 		}
82 82
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null
93 93
 	 */
94
-	public function up($expression = null, int $index = null){
94
+	public function up($expression = null, int $index = null) {
95 95
 		return $this->_recursivelyFind($expression, $index, 'parentNode');
96 96
 	}
97 97
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null
105 105
 	 */
106
-	public function previous($expression = null, int $index = null){
106
+	public function previous($expression = null, int $index = null) {
107 107
 		return $this->_recursivelyFind($expression, $index, 'previousSibling');
108 108
 	}
109 109
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null
117 117
 	 */
118
-	public function next($expression = null, int $index = null){
118
+	public function next($expression = null, int $index = null) {
119 119
 		return $this->_recursivelyFind($expression, $index, 'nextSibling');
120 120
 	}
121 121
 
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	public function childElements(int $nodeType = XML_ELEMENT_NODE):NodeList{
130 130
 		$children = new NodeList;
131 131
 
132
-		if($this->hasChildNodes()){
132
+		if ($this->hasChildNodes()) {
133 133
 
134
-			foreach($this->childNodes as $child){
134
+			foreach ($this->childNodes as $child) {
135 135
 
136
-				if($child->nodeType === $nodeType){
136
+				if ($child->nodeType === $nodeType) {
137 137
 					$children[] = $child;
138 138
 				}
139 139
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return \chillerlan\PrototypeDOM\Node\Element|null
189 189
 	 */
190
-	public function firstDescendant(){
190
+	public function firstDescendant() {
191 191
 		return $this->descendants()->first();
192 192
 	}
193 193
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@
 block discarded – undo
75 75
 		if(is_int($expression)){
76 76
 			$index      = $expression;
77 77
 			$expression = '*';
78
-		}
79
-		else{
78
+		} else{
80 79
 			$index = $index ?? 0;
81 80
 		}
82 81
 
Please login to merge, or discard this patch.
src/Node/Text.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 use DOMText;
16 16
 use chillerlan\PrototypeDOM\Traits\ElementTrait;
17 17
 
18
-class Text extends DOMText implements PrototypeElement{
18
+class Text extends DOMText implements PrototypeElement {
19 19
 	use ElementTrait;
20 20
 }
Please login to merge, or discard this patch.
src/Node/DocumentType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 use chillerlan\PrototypeDOM\Traits\NodeTrait;
16 16
 use DOMDocumentType;
17 17
 
18
-class DocumentType extends DOMDocumentType implements PrototypeNode{
18
+class DocumentType extends DOMDocumentType implements PrototypeNode {
19 19
 	use NodeTrait;
20 20
 }
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
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 use DOMCharacterData;
16 16
 use chillerlan\PrototypeDOM\Traits\ElementTrait;
17 17
 
18
-class CharacterData extends DOMCharacterData implements PrototypeElement{
18
+class CharacterData extends DOMCharacterData implements PrototypeElement {
19 19
 	use ElementTrait;
20 20
 }
Please login to merge, or discard this patch.
src/Node/PrototypeTraversal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\PrototypeDOM\NodeList;
16 16
 
17
-interface PrototypeTraversal extends PrototypeNode{
17
+interface PrototypeTraversal extends PrototypeNode {
18 18
 
19 19
 	/**
20 20
 	 * @link http://api.prototypejs.org/dom/Element/select/
Please login to merge, or discard this patch.
src/Node/Attr.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 use chillerlan\PrototypeDOM\Traits\NodeTrait;
16 16
 use DOMAttr;
17 17
 
18
-class Attr extends DOMAttr implements PrototypeNode{
18
+class Attr extends DOMAttr implements PrototypeNode {
19 19
 	use NodeTrait;
20 20
 }
Please login to merge, or discard this patch.