Amp\Internal\Producer trait Producer

Trait used by Iterator implementations. Do not use this trait in your code, instead compose your class from one of the available classes implementing \Amp\Iterator.

Note that it is the responsibility of the user of this trait to ensure that listeners have a chance to listen first before emitting values.

Summary

Properties

Methods

Properties

$complete — private Amp\Promise|null $complete
No documentation.
$values — private array $values = []
No documentation.
$backPressure — private Amp\Deferred[] $backPressure = []
No documentation.
$position — private int $position = -1
No documentation.
$waiting — private Amp\Deferred|null $waiting
No documentation.
$resolutionTrace — private null|array $resolutionTrace
No documentation.

Methods

advance — public function advance(): Amp\Promise

{@inheritdoc}

getCurrent — public function getCurrent()

{@inheritdoc}

emit — private function emit(mixed $value): Amp\Promise

Emits a value from the iterator. The returned promise is resolved with the emitted value once all listeners have been invoked.

Type Parameter Description Default Value
mixed $value No documentation. none
complete — private function complete()

Completes the iterator.

fail — private function fail(Throwable $exception)
No documentation.
Type Parameter Description Default Value
Throwable $exception No documentation. none