mirror of
https://github.com/danog/amp.git
synced 2024-12-11 08:59:46 +01:00
0eceb48fad
Trait tests should test Deferred and Emitter instead, will update with other tests.
25 lines
540 B
PHP
25 lines
540 B
PHP
<?php
|
|
|
|
namespace Amp\Internal;
|
|
|
|
use Amp\Promise;
|
|
|
|
/**
|
|
* Wraps a Placeholder instance that has public methods to resolve and fail the promise into an object that only allows
|
|
* access to the public API methods.
|
|
*/
|
|
final class PrivatePromise implements Promise
|
|
{
|
|
private Placeholder $placeholder;
|
|
|
|
public function __construct(Placeholder $placeholder)
|
|
{
|
|
$this->placeholder = $placeholder;
|
|
}
|
|
|
|
public function onResolve(callable $onResolved): void
|
|
{
|
|
$this->placeholder->onResolve($onResolved);
|
|
}
|
|
}
|