@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public static function strictArrayIntersect(array $arr1, array $arr2): array |
| 60 | 60 | { |
| 61 | - $arr = array_filter($arr1, function ($val1) use ($arr2) { |
|
| 61 | + $arr = array_filter($arr1, function($val1) use ($arr2) { |
|
| 62 | 62 | return in_array($val1, $arr2, true); |
| 63 | 63 | }); |
| 64 | 64 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public static function strictArrayDiff(array $arr1, array $arr2): array |
| 77 | 77 | { |
| 78 | - $arr = array_filter($arr1, function ($val1) use ($arr2) { |
|
| 78 | + $arr = array_filter($arr1, function($val1) use ($arr2) { |
|
| 79 | 79 | return !in_array($val1, $arr2, true); |
| 80 | 80 | }); |
| 81 | 81 | |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $content = $this->contentResolve($content); |
| 24 | 24 | |
| 25 | - return $this->each(function (HtmlNode $node, $index) use ($content) { |
|
| 26 | - $content->each(function (DOMNode $newNode) use ($node, $index) { |
|
| 25 | + return $this->each(function(HtmlNode $node, $index) use ($content) { |
|
| 26 | + $content->each(function(DOMNode $newNode) use ($node, $index) { |
|
| 27 | 27 | $newNode = $this->newNode($newNode, $index); |
| 28 | 28 | $node->before($newNode); |
| 29 | 29 | }); |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $content = $this->contentResolve($content); |
| 57 | 57 | |
| 58 | - return $this->each(function (HtmlNode $node, $index) use ($content) { |
|
| 59 | - $content->each(function (DOMNode $newNode) use ($node, $index) { |
|
| 58 | + return $this->each(function(HtmlNode $node, $index) use ($content) { |
|
| 59 | + $content->each(function(DOMNode $newNode) use ($node, $index) { |
|
| 60 | 60 | $newNode = $this->newNode($newNode, $index); |
| 61 | 61 | $node->after($newNode); |
| 62 | 62 | }, true); |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $content = $this->contentResolve($content); |
| 90 | 90 | |
| 91 | - return $this->each(function (HtmlNode $node, $index) use ($content) { |
|
| 92 | - $content->each(function (DOMNode $newNode) use ($node, $index) { |
|
| 91 | + return $this->each(function(HtmlNode $node, $index) use ($content) { |
|
| 92 | + $content->each(function(DOMNode $newNode) use ($node, $index) { |
|
| 93 | 93 | $newNode = $this->newNode($newNode, $index); |
| 94 | 94 | $node->append($newNode); |
| 95 | 95 | }); |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $content = $this->contentResolve($content); |
| 123 | 123 | |
| 124 | - return $this->each(function (HtmlNode $node, $index) use ($content) { |
|
| 125 | - $content->each(function (DOMNode $newNode) use ($node, $index) { |
|
| 124 | + return $this->each(function(HtmlNode $node, $index) use ($content) { |
|
| 125 | + $content->each(function(DOMNode $newNode) use ($node, $index) { |
|
| 126 | 126 | $newNode = $this->newNode($newNode, $index); |
| 127 | 127 | $node->prepend($newNode); |
| 128 | 128 | }, true); |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | public function replaceWith($content) |
| 154 | 154 | { |
| 155 | 155 | $content = $this->contentResolve($content); |
| 156 | - return $this->each(function (DOMNode $node, $index) use ($content) { |
|
| 156 | + return $this->each(function(DOMNode $node, $index) use ($content) { |
|
| 157 | 157 | if (!$node->parentNode) { |
| 158 | 158 | return; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $len = $content->count(); |
| 162 | 162 | $content->each( |
| 163 | - function (DOMNode $newNode) use ($node, $index, $len) { |
|
| 163 | + function(DOMNode $newNode) use ($node, $index, $len) { |
|
| 164 | 164 | $newNode = $this->newNode($newNode, $index); |
| 165 | 165 | |
| 166 | 166 | if ($len === 1) { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | return $this; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - return $this->each(function (DOMNode $node, $index) use ($newNode) { |
|
| 211 | + return $this->each(function(DOMNode $node, $index) use ($newNode) { |
|
| 212 | 212 | $newNode = $this->newNode($newNode, $index); |
| 213 | 213 | |
| 214 | 214 | $nodes = $this->xpathQuery('descendant::*[last()]', $newNode); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | return $this; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - return $this->each(function (DOMNode $node, $index) use ($newNode) { |
|
| 241 | + return $this->each(function(DOMNode $node, $index) use ($newNode) { |
|
| 242 | 242 | $newNode = $this->newNode($newNode, $index); |
| 243 | 243 | |
| 244 | 244 | $nodes = $this->xpathQuery('descendant::*[last()]', $newNode); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | $newNode = $content[0]; |
| 274 | - $this->each(function (DOMNode $node, $index) use ($newNode) { |
|
| 274 | + $this->each(function(DOMNode $node, $index) use ($newNode) { |
|
| 275 | 275 | if ($index === 0) { |
| 276 | 276 | $this->resolve($node)->wrap($newNode); |
| 277 | 277 | } else { |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function unwrapSelf() |
| 305 | 305 | { |
| 306 | - return $this->each(function (HtmlNode $node) { |
|
| 306 | + return $this->each(function(HtmlNode $node) { |
|
| 307 | 307 | $node->unwrapSelf(); |
| 308 | 308 | }); |
| 309 | 309 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function outerHtml() |
| 47 | 47 | { |
| 48 | - return $this->mapFirst(function (HtmlNode $node) { |
|
| 48 | + return $this->mapFirst(function(HtmlNode $node) { |
|
| 49 | 49 | return $node->outerHtml(); |
| 50 | 50 | }); |
| 51 | 51 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getHtml() |
| 76 | 76 | { |
| 77 | - return $this->mapFirst(function (HtmlNode $node) { |
|
| 77 | + return $this->mapFirst(function(HtmlNode $node) { |
|
| 78 | 78 | return $node->getHtml(); |
| 79 | 79 | }); |
| 80 | 80 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function getText() |
| 124 | 124 | { |
| 125 | - return $this->mapFirst(function (HtmlNode $node) { |
|
| 125 | + return $this->mapFirst(function(HtmlNode $node) { |
|
| 126 | 126 | return $node->getText(); |
| 127 | 127 | }); |
| 128 | 128 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function setText(string $text) |
| 138 | 138 | { |
| 139 | - return $this->each(function (HtmlNode $node) use ($text) { |
|
| 139 | + return $this->each(function(HtmlNode $node) use ($text) { |
|
| 140 | 140 | $node->setText($text); |
| 141 | 141 | }); |
| 142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function empty() |
| 150 | 150 | { |
| 151 | - return $this->each(function (HtmlNode $node) { |
|
| 151 | + return $this->each(function(HtmlNode $node) { |
|
| 152 | 152 | $node->empty(); |
| 153 | 153 | }); |
| 154 | 154 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | if (!is_null($selector)) { |
| 167 | 167 | $this->filter($selector)->remove(); |
| 168 | 168 | } else { |
| 169 | - $this->each(function (HtmlNode $node) { |
|
| 169 | + $this->each(function(HtmlNode $node) { |
|
| 170 | 170 | $node->remove(); |
| 171 | 171 | }); |
| 172 | 172 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function getVal() |
| 200 | 200 | { |
| 201 | - return $this->mapFirst(function (HtmlElement $node) { |
|
| 201 | + return $this->mapFirst(function(HtmlElement $node) { |
|
| 202 | 202 | return $node->getVal(); |
| 203 | 203 | }); |
| 204 | 204 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function setVal(string $value) |
| 214 | 214 | { |
| 215 | - return $this->each(function (HtmlElement $node) use ($value) { |
|
| 215 | + return $this->each(function(HtmlElement $node) use ($value) { |
|
| 216 | 216 | $node->setVal($value); |
| 217 | 217 | }); |
| 218 | 218 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function addClass(string $className) |
| 228 | 228 | { |
| 229 | - return $this->each(function (HtmlElement $node) use ($className) { |
|
| 229 | + return $this->each(function(HtmlElement $node) use ($className) { |
|
| 230 | 230 | $node->addClass($className); |
| 231 | 231 | }); |
| 232 | 232 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | public function hasClass(string $className) |
| 242 | 242 | { |
| 243 | 243 | return $this->mapAnyTrue( |
| 244 | - function (HtmlElement $node) use ($className) { |
|
| 244 | + function(HtmlElement $node) use ($className) { |
|
| 245 | 245 | return $node->hasClass($className); |
| 246 | 246 | } |
| 247 | 247 | ); |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function removeClass(?string $className = null) |
| 259 | 259 | { |
| 260 | - return $this->each(function (HtmlElement $node) use ($className) { |
|
| 260 | + return $this->each(function(HtmlElement $node) use ($className) { |
|
| 261 | 261 | $node->removeClass($className); |
| 262 | 262 | }); |
| 263 | 263 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | public function toggleClass(string $className, ?bool $state = null) |
| 275 | 275 | { |
| 276 | - return $this->each(function (HtmlElement $node) use ($className, $state) { |
|
| 276 | + return $this->each(function(HtmlElement $node) use ($className, $state) { |
|
| 277 | 277 | $node->toggleClass($className, $state); |
| 278 | 278 | }); |
| 279 | 279 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | public function getCss(string $name) |
| 315 | 315 | { |
| 316 | - return $this->mapFirst(function (HtmlElement $node) use ($name) { |
|
| 316 | + return $this->mapFirst(function(HtmlElement $node) use ($name) { |
|
| 317 | 317 | return $node->getCss($name); |
| 318 | 318 | }); |
| 319 | 319 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function setCss(string $name, ?string $value) |
| 330 | 330 | { |
| 331 | - return $this->each(function (HtmlElement $node) use ($name, $value) { |
|
| 331 | + return $this->each(function(HtmlElement $node) use ($name, $value) { |
|
| 332 | 332 | $node->setCss($name, $value); |
| 333 | 333 | }); |
| 334 | 334 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | public function removeCss(string $name) |
| 344 | 344 | { |
| 345 | - return $this->each(function (HtmlElement $node) use ($name) { |
|
| 345 | + return $this->each(function(HtmlElement $node) use ($name) { |
|
| 346 | 346 | $node->removeCss($name); |
| 347 | 347 | }); |
| 348 | 348 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function getAttr(string $name) |
| 46 | 46 | { |
| 47 | - return $this->mapFirst(function (HtmlElement $node) use ($name) { |
|
| 47 | + return $this->mapFirst(function(HtmlElement $node) use ($name) { |
|
| 48 | 48 | return $node->getAttr($name); |
| 49 | 49 | }); |
| 50 | 50 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function setAttr(string $name, string $value) |
| 61 | 61 | { |
| 62 | - return $this->each(function (HtmlElement $node) use ($name, $value) { |
|
| 62 | + return $this->each(function(HtmlElement $node) use ($name, $value) { |
|
| 63 | 63 | $node->setAttr($name, $value); |
| 64 | 64 | }); |
| 65 | 65 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function removeAttr(string $attributeName) |
| 75 | 75 | { |
| 76 | - return $this->each(function (HtmlElement $node) use ($attributeName) { |
|
| 76 | + return $this->each(function(HtmlElement $node) use ($attributeName) { |
|
| 77 | 77 | $node->removeAttr($attributeName); |
| 78 | 78 | }); |
| 79 | 79 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function removeAllAttrs($except = []) |
| 89 | 89 | { |
| 90 | - return $this->each(function (HtmlElement $node) use ($except) { |
|
| 90 | + return $this->each(function(HtmlElement $node) use ($except) { |
|
| 91 | 91 | $node->removeAllAttrs($except); |
| 92 | 92 | }); |
| 93 | 93 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function hasAttr(string $attributeName) |
| 103 | 103 | { |
| 104 | 104 | return $this->mapAnyTrue( |
| 105 | - function (HtmlElement $node) use ($attributeName) { |
|
| 105 | + function(HtmlElement $node) use ($attributeName) { |
|
| 106 | 106 | return $node->hasAttr($attributeName); |
| 107 | 107 | } |
| 108 | 108 | ); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | public function data($name, $value = null) |
| 149 | 149 | { |
| 150 | 150 | if (is_array($name)) { |
| 151 | - array_walk($name, function ($val, $key) { |
|
| 151 | + array_walk($name, function($val, $key) { |
|
| 152 | 152 | $this->data($key, $val); |
| 153 | 153 | }); |
| 154 | 154 | |