FluidXml\FluidXml::each PHP Method

each() public method

public each ( callable $fn )
$fn callable
    public function each(callable $fn)
    {
        return $this->context()->each($fn);
    }

Usage Example

Beispiel #1
0
         $actual = $r[0]->nodeName;
         $expected = 'g';
         \assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.each', function () {
     it('should be fluid', function () {
         assert_is_fluid('each', function () {
         });
     });
     it('should iterate the nodes inside the context', function () {
         $xml = new FluidXml();
         $xml->each(function ($i, $n) {
             assert_is_a($this, FluidContext::class);
             assert_is_a($n, \DOMNode::class);
             $actual = $i;
             $expected = 0;
             \assert($actual === $expected, __($actual, $expected));
         });
         function eachassert($cx, $i, $n)
         {
             assert_is_a($cx, FluidContext::class);
             assert_is_a($n, \DOMNode::class);
             $actual = $i;
             $expected = 0;
             \assert($actual === $expected, __($actual, $expected));
         }
         $xml->each('eachassert');
         $xml->appendChild('child1')->appendChild('child2');
         $nodes = [];
         $index = 0;
All Usage Examples Of FluidXml\FluidXml::each