@@ -168,7 +168,7 @@ |
||
| 168 | 168 | /** |
| 169 | 169 | * @param int $offset |
| 170 | 170 | * |
| 171 | - * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null |
|
| 171 | + * @return Node\Element|null |
|
| 172 | 172 | */ |
| 173 | 173 | public function offsetGet($offset){ |
| 174 | 174 | return $this->item($offset); |
@@ -12,7 +12,10 @@ |
||
| 12 | 12 | |
| 13 | 13 | namespace chillerlan\PrototypeDOM; |
| 14 | 14 | |
| 15 | -use ArrayAccess, Countable, DOMNodeList, Iterator; |
|
| 15 | +use ArrayAccess; |
|
| 16 | +use Countable; |
|
| 17 | +use DOMNodeList; |
|
| 18 | +use Iterator; |
|
| 16 | 19 | use chillerlan\PrototypeDOM\Node\PrototypeNode; |
| 17 | 20 | use chillerlan\PrototypeDOM\Traits\{EnumerableTrait, Magic}; |
| 18 | 21 | |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @throws \Exception |
| 41 | 41 | */ |
| 42 | - public function __construct(DOMNodeList $nodes = null){ |
|
| 42 | + public function __construct(DOMNodeList $nodes = null) { |
|
| 43 | 43 | |
| 44 | - if(!is_null($nodes)){ |
|
| 44 | + if (!is_null($nodes)) { |
|
| 45 | 45 | $this->array = iterator_to_array($nodes); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function match(PrototypeNode $node):bool{ |
| 73 | 73 | |
| 74 | - foreach($this->array as $element){ |
|
| 74 | + foreach ($this->array as $element) { |
|
| 75 | 75 | |
| 76 | - if($element->isSameNode($node)){ |
|
| 76 | + if ($element->isSameNode($node)) { |
|
| 77 | 77 | return true; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /** |
| 120 | 120 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
| 121 | 121 | */ |
| 122 | - public function current(){ |
|
| 122 | + public function current() { |
|
| 123 | 123 | return $this->array[$this->offset]; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | /** |
| 141 | 141 | * @return void |
| 142 | 142 | */ |
| 143 | - public function next(){ |
|
| 143 | + public function next() { |
|
| 144 | 144 | $this->offset++; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | - public function rewind(){ |
|
| 150 | + public function rewind() { |
|
| 151 | 151 | $this->offset = 0; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null |
| 172 | 172 | */ |
| 173 | - public function offsetGet($offset){ |
|
| 173 | + public function offsetGet($offset) { |
|
| 174 | 174 | return $this->item($offset); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return void |
| 182 | 182 | */ |
| 183 | - public function offsetSet($offset, $value){ |
|
| 183 | + public function offsetSet($offset, $value) { |
|
| 184 | 184 | |
| 185 | - if($value instanceof PrototypeNode){ |
|
| 185 | + if ($value instanceof PrototypeNode) { |
|
| 186 | 186 | |
| 187 | - if(is_int($offset)){ |
|
| 187 | + if (is_int($offset)) { |
|
| 188 | 188 | $this->array[$offset] = $value; |
| 189 | 189 | } |
| 190 | - else{ |
|
| 190 | + else { |
|
| 191 | 191 | $this->array[] = $value; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @return void |
| 202 | 202 | */ |
| 203 | - public function offsetUnset($offset){ |
|
| 203 | + public function offsetUnset($offset) { |
|
| 204 | 204 | unset($this->array[$offset]); |
| 205 | 205 | } |
| 206 | 206 | |
@@ -186,8 +186,7 @@ |
||
| 186 | 186 | |
| 187 | 187 | if(is_int($offset)){ |
| 188 | 188 | $this->array[$offset] = $value; |
| 189 | - } |
|
| 190 | - else{ |
|
| 189 | + } else{ |
|
| 191 | 190 | $this->array[] = $value; |
| 192 | 191 | } |
| 193 | 192 | |
@@ -31,9 +31,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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)); |
@@ -14,7 +14,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -168,8 +168,7 @@ |
||
| 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 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | * @link http://api.prototypejs.org/language/Enumerable/prototype/collect/ |
| 52 | 52 | * @link http://api.prototypejs.org/language/Enumerable/prototype/map/ |
| 53 | 53 | * |
| 54 | - * @param $callback |
|
| 54 | + * @param callable $callback |
|
| 55 | 55 | * |
| 56 | 56 | * @return array |
| 57 | 57 | * @throws \Exception |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Trait EnumerableTrait |
| 16 | 16 | */ |
| 17 | -trait EnumerableTrait{ |
|
| 17 | +trait EnumerableTrait { |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @link http://api.prototypejs.org/language/Enumerable/prototype/each/ |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return $this |
| 25 | 25 | */ |
| 26 | - public function each($callback){ |
|
| 26 | + public function each($callback) { |
|
| 27 | 27 | $this->map($callback); |
| 28 | 28 | |
| 29 | 29 | return $this; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return \chillerlan\PrototypeDOM\Node\Element|null |
| 36 | 36 | */ |
| 37 | - public function first(){ |
|
| 37 | + public function first() { |
|
| 38 | 38 | return $this->item(0); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return \chillerlan\PrototypeDOM\Node\Element|null |
| 45 | 45 | */ |
| 46 | - public function last(){ |
|
| 46 | + public function last() { |
|
| 47 | 47 | return $this->item($this->count() - 1); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function map($callback):array { |
| 60 | 60 | |
| 61 | - if(!is_callable($callback)){ |
|
| 61 | + if (!is_callable($callback)) { |
|
| 62 | 62 | throw new \Exception('invalid callback'); // @codeCoverageIgnore |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $return = []; |
| 66 | 66 | |
| 67 | - foreach($this->array as $index => $element){ |
|
| 67 | + foreach ($this->array as $index => $element) { |
|
| 68 | 68 | $return[$index] = call_user_func_array($callback, [$element, $index]); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return $this |
| 89 | 89 | */ |
| 90 | - public function reverse(){ |
|
| 90 | + public function reverse() { |
|
| 91 | 91 | $this->array = array_reverse($this->array); |
| 92 | 92 | $this->rewind(); |
| 93 | 93 | |
@@ -158,7 +158,7 @@ |
||
| 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(); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @property string $class |
| 20 | 20 | * @property string $innerHTML |
| 21 | 21 | */ |
| 22 | -trait HTMLElementTrait{ |
|
| 22 | +trait HTMLElementTrait { |
|
| 23 | 23 | use Magic, ElementTrait; |
| 24 | 24 | |
| 25 | 25 | protected function magic_get_id():string { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function identify(string $newID = null):string { |
| 53 | 53 | $oldID = $this->id; |
| 54 | 54 | |
| 55 | - if(!is_null($newID)){ |
|
| 55 | + if (!is_null($newID)) { |
|
| 56 | 56 | $this->id = $newID; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | public function classNames():array{ |
| 68 | 68 | $currentClassnames = []; |
| 69 | 69 | |
| 70 | - if($this->hasAttributes()){ |
|
| 70 | + if ($this->hasAttributes()) { |
|
| 71 | 71 | $classnames = explode(' ', $this->class); |
| 72 | 72 | |
| 73 | - if(!empty($classnames)){ |
|
| 73 | + if (!empty($classnames)) { |
|
| 74 | 74 | |
| 75 | - foreach($classnames as $classname){ |
|
| 75 | + foreach ($classnames as $classname) { |
|
| 76 | 76 | |
| 77 | - if(empty($classname)){ |
|
| 77 | + if (empty($classname)) { |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return null|string |
| 144 | 144 | */ |
| 145 | - public function getStyle(string $property){ |
|
| 145 | + public function getStyle(string $property) { |
|
| 146 | 146 | $currentStyle = $this->getStyles(); |
| 147 | 147 | |
| 148 | - if(array_key_exists(strtolower($property), $currentStyle)){ |
|
| 148 | + if (array_key_exists(strtolower($property), $currentStyle)) { |
|
| 149 | 149 | return $currentStyle[$property]; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | public function setStyle(array $style, bool $replace = false):PrototypeHTMLElement{ |
| 164 | 164 | $currentStyle = $this->getStyles(); |
| 165 | 165 | |
| 166 | - if(!$replace){ |
|
| 166 | + if (!$replace) { |
|
| 167 | 167 | $style = array_merge($currentStyle, $style); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - foreach($style as $property => $value){ |
|
| 170 | + foreach ($style as $property => $value) { |
|
| 171 | 171 | $style[$property] = $property.': '.$value.';'; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -102,7 +102,7 @@ discard block |
||
| 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 |
||
| 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; |
@@ -33,7 +33,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -19,8 +19,8 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -15,7 +15,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -75,8 +75,7 @@ |
||
| 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 | |
@@ -15,6 +15,6 @@ |
||
| 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 | } |
@@ -15,6 +15,6 @@ |
||
| 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 | } |
@@ -15,6 +15,6 @@ |
||
| 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 | } |