@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function outerHtml() |
46 | 46 | { |
47 | - return $this->mapFirst(function (HtmlNode $node) { |
|
47 | + return $this->mapFirst(function(HtmlNode $node) { |
|
48 | 48 | return $node->outerHtml(); |
49 | 49 | }); |
50 | 50 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getHtml() |
75 | 75 | { |
76 | - return $this->mapFirst(function (HtmlNode $node) { |
|
76 | + return $this->mapFirst(function(HtmlNode $node) { |
|
77 | 77 | return $node->getHtml(); |
78 | 78 | }); |
79 | 79 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getText() |
123 | 123 | { |
124 | - return $this->mapFirst(function (HtmlNode $node) { |
|
124 | + return $this->mapFirst(function(HtmlNode $node) { |
|
125 | 125 | return $node->getText(); |
126 | 126 | }); |
127 | 127 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function setText(string $text) |
137 | 137 | { |
138 | - return $this->each(function (HtmlNode $node) use ($text) { |
|
138 | + return $this->each(function(HtmlNode $node) use ($text) { |
|
139 | 139 | $node->setText($text); |
140 | 140 | }); |
141 | 141 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getAttr(string $name) |
177 | 177 | { |
178 | - return $this->mapFirst(function (HtmlElement $node) use ($name) { |
|
178 | + return $this->mapFirst(function(HtmlElement $node) use ($name) { |
|
179 | 179 | return $node->getAttr($name); |
180 | 180 | }); |
181 | 181 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function setAttr(string $name, string $value) |
192 | 192 | { |
193 | - return $this->each(function (HtmlElement $node) use ($name, $value) { |
|
193 | + return $this->each(function(HtmlElement $node) use ($name, $value) { |
|
194 | 194 | $node->setAttr($name, $value); |
195 | 195 | }); |
196 | 196 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function removeAttr(string $attributeName) |
206 | 206 | { |
207 | - return $this->each(function (HtmlElement $node) use ($attributeName) { |
|
207 | + return $this->each(function(HtmlElement $node) use ($attributeName) { |
|
208 | 208 | $node->removeAttr($attributeName); |
209 | 209 | }); |
210 | 210 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function removeAllAttrs($except = []) |
220 | 220 | { |
221 | - return $this->each(function (HtmlElement $node) use ($except) { |
|
221 | + return $this->each(function(HtmlElement $node) use ($except) { |
|
222 | 222 | $node->removeAllAttrs($except); |
223 | 223 | }); |
224 | 224 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | public function hasAttr(string $attributeName) |
234 | 234 | { |
235 | 235 | return $this->mapAnyTrue( |
236 | - function (HtmlElement $node) use ($attributeName) { |
|
236 | + function(HtmlElement $node) use ($attributeName) { |
|
237 | 237 | return $node->hasAttr($attributeName); |
238 | 238 | } |
239 | 239 | ); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | public function data($name, $value = null) |
280 | 280 | { |
281 | 281 | if (is_array($name)) { |
282 | - array_walk($name, function ($val, $key) { |
|
282 | + array_walk($name, function($val, $key) { |
|
283 | 283 | $this->data($key, $val); |
284 | 284 | }); |
285 | 285 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function empty() |
340 | 340 | { |
341 | - return $this->each(function (HtmlNode $node) { |
|
341 | + return $this->each(function(HtmlNode $node) { |
|
342 | 342 | $node->empty(); |
343 | 343 | }); |
344 | 344 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | if (!is_null($selector)) { |
357 | 357 | $this->filter($selector)->remove(); |
358 | 358 | } else { |
359 | - $this->each(function (HtmlNode $node) { |
|
359 | + $this->each(function(HtmlNode $node) { |
|
360 | 360 | $node->remove(); |
361 | 361 | }); |
362 | 362 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | public function getVal() |
390 | 390 | { |
391 | - return $this->mapFirst(function (HtmlElement $node) { |
|
391 | + return $this->mapFirst(function(HtmlElement $node) { |
|
392 | 392 | return $node->getVal(); |
393 | 393 | }); |
394 | 394 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function setVal(string $value) |
404 | 404 | { |
405 | - return $this->each(function (HtmlElement $node) use ($value) { |
|
405 | + return $this->each(function(HtmlElement $node) use ($value) { |
|
406 | 406 | $node->setVal($value); |
407 | 407 | }); |
408 | 408 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function addClass(string $className) |
418 | 418 | { |
419 | - return $this->each(function (HtmlElement $node) use ($className) { |
|
419 | + return $this->each(function(HtmlElement $node) use ($className) { |
|
420 | 420 | $node->addClass($className); |
421 | 421 | }); |
422 | 422 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | public function hasClass(string $className) |
432 | 432 | { |
433 | 433 | return $this->mapAnyTrue( |
434 | - function (HtmlElement $node) use ($className) { |
|
434 | + function(HtmlElement $node) use ($className) { |
|
435 | 435 | return $node->hasClass($className); |
436 | 436 | } |
437 | 437 | ); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public function removeClass(?string $className = null) |
449 | 449 | { |
450 | - return $this->each(function (HtmlElement $node) use ($className) { |
|
450 | + return $this->each(function(HtmlElement $node) use ($className) { |
|
451 | 451 | $node->removeClass($className); |
452 | 452 | }); |
453 | 453 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function toggleClass(string $className, ?bool $state = null) |
465 | 465 | { |
466 | - return $this->each(function (HtmlElement $node) use ($className, $state) { |
|
466 | + return $this->each(function(HtmlElement $node) use ($className, $state) { |
|
467 | 467 | $node->toggleClass($className, $state); |
468 | 468 | }); |
469 | 469 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | */ |
505 | 505 | public function getCss(string $name) |
506 | 506 | { |
507 | - return $this->mapFirst(function (HtmlElement $node) use ($name) { |
|
507 | + return $this->mapFirst(function(HtmlElement $node) use ($name) { |
|
508 | 508 | return $node->getCss($name); |
509 | 509 | }); |
510 | 510 | } |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | */ |
520 | 520 | public function setCss(string $name, ?string $value) |
521 | 521 | { |
522 | - return $this->each(function (HtmlElement $node) use ($name, $value) { |
|
522 | + return $this->each(function(HtmlElement $node) use ($name, $value) { |
|
523 | 523 | $node->setCss($name, $value); |
524 | 524 | }); |
525 | 525 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | */ |
534 | 534 | public function removeCss(string $name) |
535 | 535 | { |
536 | - return $this->each(function (HtmlElement $node) use ($name) { |
|
536 | + return $this->each(function(HtmlElement $node) use ($name) { |
|
537 | 537 | $node->removeCss($name); |
538 | 538 | }); |
539 | 539 | } |
@@ -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 | } |