1
0
mirror of https://github.com/danog/amp.git synced 2024-12-02 17:37:50 +01:00
amp/lib/Internal/PrivateStream.php

27 lines
628 B
PHP
Raw Normal View History

<?php
2016-08-16 06:46:26 +02:00
2016-05-27 01:20:05 +02:00
namespace Amp\Internal;
use Amp\CallableMaker;
2017-01-04 02:10:27 +01:00
use Amp\Stream;
2016-05-27 01:20:05 +02:00
/**
2017-01-04 02:10:27 +01:00
* An stream that cannot externally emit values. Used by Emitter in development mode.
2016-06-01 18:37:12 +02:00
*
* @internal
2016-05-27 01:20:05 +02:00
*/
2017-01-04 02:10:27 +01:00
final class PrivateStream implements Stream {
use CallableMaker, Producer;
2016-05-27 01:20:05 +02:00
/**
2017-01-04 02:10:27 +01:00
* @param callable(callable $emit, callable $complete, callable $fail): void $producer
2016-05-27 01:20:05 +02:00
*/
2017-01-04 02:10:27 +01:00
public function __construct(callable $producer) {
$producer(
$this->callableFromInstanceMethod("emit"),
$this->callableFromInstanceMethod("resolve"),
$this->callableFromInstanceMethod("fail")
);
2016-05-27 01:20:05 +02:00
}
}