mirror of
https://github.com/danog/amp.git
synced 2024-12-12 09:29:45 +01:00
d48e6bd5d2
More PHP 7.1 to 8 types added.
25 lines
508 B
PHP
25 lines
508 B
PHP
<?php
|
|
|
|
namespace Amp\Internal;
|
|
|
|
use Amp\Promise;
|
|
|
|
/**
|
|
* Wraps a Promise 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 Promise $promise;
|
|
|
|
public function __construct(Promise $promise)
|
|
{
|
|
$this->promise = $promise;
|
|
}
|
|
|
|
public function onResolve(callable $onResolved): void
|
|
{
|
|
$this->promise->onResolve($onResolved);
|
|
}
|
|
}
|