DigiComp.FluidRenderFunctions/Classes/Utils/GeneratorClosureIterator.php

22 lines
392 B
PHP
Raw Normal View History

2024-06-01 23:15:35 +02:00
<?php
namespace DigiComp\FluidRenderFunctions\Utils;
class GeneratorClosureIterator implements \IteratorAggregate
{
private \Closure $closure;
/**
* @param \Closure $closure
*/
public function __construct(\Closure $closure)
{
$this->closure = $closure;
}
public function getIterator(): \Generator
{
return ($this->closure)();
}
}