1
0
mirror of https://github.com/danog/amp.git synced 2025-01-23 05:41:25 +01:00
amp/lib/Internal/PrivateStream.php

27 lines
628 B
PHP
Raw Normal View History

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