22 lines
392 B
PHP
22 lines
392 B
PHP
|
<?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)();
|
||
|
}
|
||
|
}
|