1
0
mirror of https://github.com/danog/amp.git synced 2024-12-03 09:57:51 +01:00
amp/lib/Internal/PrivateStream.php
2017-01-07 12:24:40 -06:00

27 lines
628 B
PHP

<?php
namespace Amp\Internal;
use Amp\CallableMaker;
use Amp\Stream;
/**
* An stream that cannot externally emit values. Used by Emitter in development mode.
*
* @internal
*/
final class PrivateStream implements Stream {
use CallableMaker, Producer;
/**
* @param callable(callable $emit, callable $complete, callable $fail): void $producer
*/
public function __construct(callable $producer) {
$producer(
$this->callableFromInstanceMethod("emit"),
$this->callableFromInstanceMethod("resolve"),
$this->callableFromInstanceMethod("fail")
);
}
}