mirror of
https://github.com/danog/amp.git
synced 2025-01-23 05:41:25 +01:00
27 lines
638 B
PHP
27 lines
638 B
PHP
<?php
|
|
|
|
namespace Amp\Internal;
|
|
|
|
use Amp\CallableMaker;
|
|
use Amp\Iterator;
|
|
|
|
/**
|
|
* An iterator that cannot externally emit values. Used by Emitter in development mode.
|
|
*
|
|
* @internal
|
|
*/
|
|
final class PrivateIterator implements Iterator {
|
|
use CallableMaker, Producer;
|
|
|
|
/**
|
|
* @param callable (callable $emit, callable $complete, callable $fail): void $producer
|
|
*/
|
|
public function __construct(callable $producer) {
|
|
$producer(
|
|
$this->callableFromInstanceMethod("emit"),
|
|
$this->callableFromInstanceMethod("complete"),
|
|
$this->callableFromInstanceMethod("fail")
|
|
);
|
|
}
|
|
}
|