1
0
mirror of https://github.com/danog/amp.git synced 2024-12-11 08:59:46 +01:00
amp/lib/Internal/PrivatePromise.php
Aaron Piotrowski 0eceb48fad
Refactor internal traits as classes
Trait tests should test Deferred and Emitter instead, will update with other tests.
2020-09-26 23:14:17 -05:00

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);
}
}