Completed
Branch scrutinizer (fe02ae)
by Thomas
02:13
created
src/HtmlQuery.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
     {
550 550
         $content = $this->contentResolve($content);
551 551
 
552
-        return $this->each(function (HtmlNode $node, $index) use ($content) {
553
-            $content->each(function (DOMNode $newNode) use ($node, $index) {
552
+        return $this->each(function(HtmlNode $node, $index) use ($content) {
553
+            $content->each(function(DOMNode $newNode) use ($node, $index) {
554 554
                 $newNode = $this->newNode($newNode, $index);
555 555
                 $node->before($newNode);
556 556
             });
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
     {
583 583
         $content = $this->contentResolve($content);
584 584
 
585
-        return $this->each(function (HtmlNode $node, $index) use ($content) {
586
-            $content->each(function (DOMNode $newNode) use ($node, $index) {
585
+        return $this->each(function(HtmlNode $node, $index) use ($content) {
586
+            $content->each(function(DOMNode $newNode) use ($node, $index) {
587 587
                 $newNode = $this->newNode($newNode, $index);
588 588
                 $node->after($newNode);
589 589
             }, true);
@@ -615,8 +615,8 @@  discard block
 block discarded – undo
615 615
     {
616 616
         $content = $this->contentResolve($content);
617 617
 
618
-        return $this->each(function (HtmlNode $node, $index) use ($content) {
619
-            $content->each(function (DOMNode $newNode) use ($node, $index) {
618
+        return $this->each(function(HtmlNode $node, $index) use ($content) {
619
+            $content->each(function(DOMNode $newNode) use ($node, $index) {
620 620
                 $newNode = $this->newNode($newNode, $index);
621 621
                 $node->append($newNode);
622 622
             });
@@ -648,8 +648,8 @@  discard block
 block discarded – undo
648 648
     {
649 649
         $content = $this->contentResolve($content);
650 650
 
651
-        return $this->each(function (HtmlNode $node, $index) use ($content) {
652
-            $content->each(function (DOMNode $newNode) use ($node, $index) {
651
+        return $this->each(function(HtmlNode $node, $index) use ($content) {
652
+            $content->each(function(DOMNode $newNode) use ($node, $index) {
653 653
                 $newNode = $this->newNode($newNode, $index);
654 654
                 $node->prepend($newNode);
655 655
             }, true);
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
     public function replaceWith($content)
681 681
     {
682 682
         $content = $this->contentResolve($content);
683
-        return $this->each(function (DOMNode $node, $index) use ($content) {
683
+        return $this->each(function(DOMNode $node, $index) use ($content) {
684 684
             if (!$node->parentNode) {
685 685
                 return;
686 686
             }
687 687
 
688 688
             $len = $content->count();
689 689
             $content->each(
690
-                function (DOMNode $newNode) use ($node, $index, $len) {
690
+                function(DOMNode $newNode) use ($node, $index, $len) {
691 691
                     $newNode = $this->newNode($newNode, $index);
692 692
 
693 693
                     if ($len === 1) {
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
             return $this;
736 736
         }
737 737
 
738
-        return $this->each(function (DOMNode $node, $index) use ($newNode) {
738
+        return $this->each(function(DOMNode $node, $index) use ($newNode) {
739 739
             $newNode = $this->newNode($newNode, $index);
740 740
 
741 741
             $nodes = $this->xpathQuery('descendant::*[last()]', $newNode);
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             return $this;
766 766
         }
767 767
 
768
-        return $this->each(function (DOMNode $node, $index) use ($newNode) {
768
+        return $this->each(function(DOMNode $node, $index) use ($newNode) {
769 769
             $newNode = $this->newNode($newNode, $index);
770 770
 
771 771
             $nodes = $this->xpathQuery('descendant::*[last()]', $newNode);
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
         }
799 799
 
800 800
         $newNode = $content[0];
801
-        $this->each(function (DOMNode $node, $index) use ($newNode) {
801
+        $this->each(function(DOMNode $node, $index) use ($newNode) {
802 802
             if ($index === 0) {
803 803
                 $this->resolve($node)->wrap($newNode);
804 804
             } else {
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
      */
831 831
     public function unwrapSelf()
832 832
     {
833
-        return $this->each(function (HtmlNode $node) {
833
+        return $this->each(function(HtmlNode $node) {
834 834
             $node->unwrapSelf();
835 835
         });
836 836
     }
Please login to merge, or discard this patch.