本文整理汇总了PHP中Generator::infinite方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::infinite方法的具体用法?PHP Generator::infinite怎么用?PHP Generator::infinite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator::infinite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: infinite
/**
* creates an infinite sequence
*
* Warning: calling terminal operations on an infinite sequence result in
* endless loops trying to calculate the terminal value. Before calling a
* terminal operation the sequence should be limited via limit().
* Alternatively you can iterate over the sequence itself and stop the
* iteration when required.
*
*
* @param $seed $seed initial value
* @param callable $operation operation which takes a value and generates a new one
* @return \stubbles\sequence\Sequence
*/
public static function infinite($seed, callable $operation) : self
{
return new self(Generator::infinite($seed, $operation));
}