1
0
mirror of https://github.com/danog/amp.git synced 2024-12-03 18:07:57 +01:00
amp/lib/Internal/PrivatePromise.php

26 lines
567 B
PHP
Raw Normal View History

<?php
2016-08-16 06:46:26 +02:00
2016-05-24 05:48:28 +02:00
namespace Amp\Internal;
2016-05-21 16:44:52 +02:00
use Amp\CallableMaker;
use Amp\Promise;
2016-05-21 16:44:52 +02:00
/**
2016-11-14 20:59:21 +01:00
* An promise that cannot be externally resolved. Used by Deferred in development mode.
2016-06-01 19:18:11 +02:00
*
* @internal
2016-05-21 16:44:52 +02:00
*/
2016-11-14 20:59:21 +01:00
final class PrivatePromise implements Promise {
use CallableMaker, Placeholder;
2016-05-21 16:44:52 +02:00
/**
* @param callable (callable $resolve, callable $reject): void $resolver
2016-05-21 16:44:52 +02:00
*/
public function __construct(callable $resolver) {
$resolver(
$this->callableFromInstanceMethod("resolve"),
$this->callableFromInstanceMethod("fail")
);
2016-05-21 16:44:52 +02:00
}
}