@@ -500,9 +500,20 @@ $doc->find('div').removeClass('first');
500500self substituteWith(string|NodeList|\DOMNode|callable $input)
501501```
502502
503+ Replace each node in the current set with the contents provided.
504+
503505##### Example
504506
505507``` php
508+ $doc = (new Document())->html('<p ><b >Hello</b > <b >World!</b ></p >');
509+ echo $doc->find('b')->substituteWith(function($node) {
510+ return '<em >' . $node->text() . '</em >';
511+ });
512+ ```
513+
514+ * Result:*
515+ ``` html
516+ <p ><em >Hello</em > <em >World!</em ></p >
506517```
507518
508519---
@@ -513,9 +524,33 @@ self substituteWith(string|NodeList|\DOMNode|callable $input)
513524string|self text([string|NodeList|\DOMNode|callable $input = null])
514525```
515526
516- ##### Example
527+ Get the text contents of the current set.
528+
529+ ##### Example (get)
517530
518531``` php
532+ $doc = (new Document())->html('<div class =" text" >Hello World!</div >');
533+ echo $doc->find('.text')->text();
534+ ```
535+
536+ * Result:*
537+ ``` html
538+ <div class =" second" ></div >
539+ ```
540+
541+ Set the text contents for current set.
542+
543+ ##### Example (set)
544+
545+ ``` php
546+ $doc = (new Document())->html('<div class =" text" ><string >The quick brown</strong > fox <em >jumps over the lazy dog</em ></div >');
547+ $doc->find('.text')->text('Hello World!');
548+ echo $doc->html();
549+ ```
550+
551+ * Result:*
552+ ``` html
553+ <div class =" text" >Hello World!</div >
519554```
520555
521556---
@@ -1092,6 +1127,8 @@ $slicedNodes = $nodes->slice(1, 3);
10921127int count()
10931128```
10941129
1130+ Return number of nodes in the current set
1131+
10951132##### Example
10961133
10971134``` php
@@ -1108,6 +1145,8 @@ echo $nodes->count();
11081145self each(callable $function)
11091146```
11101147
1148+ Iterate through for each item in the existing set via callback
1149+
11111150##### Example
11121151
11131152``` php
0 commit comments