mirror of
https://github.com/danog/amp.git
synced 2024-11-30 04:29:08 +01:00
Unresolved -> PrivatePlaceholder
This commit is contained in:
parent
953c4612e6
commit
68719d8023
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Amp;
|
||||
|
||||
class Pause extends Unresolved {
|
||||
class Pause extends PrivatePlaceholder {
|
||||
public function __construct(int $millisecondTimeout, Reactor $reactor = null) {
|
||||
if ($millisecondTimeout < 1) {
|
||||
throw new \DomainException(
|
||||
|
@ -6,6 +6,6 @@ namespace Amp;
|
||||
* A placeholder value that will be resolved at some point in the future by
|
||||
* the Promisor that created it.
|
||||
*/
|
||||
class Unresolved implements Promise {
|
||||
class PrivatePlaceholder implements Promise {
|
||||
use Placeholder;
|
||||
}
|
@ -13,16 +13,16 @@ trait PrivatePromisor {
|
||||
private $promise;
|
||||
|
||||
public function __construct() {
|
||||
$unresolved = new Unresolved;
|
||||
$placeholder = new PrivatePlaceholder;
|
||||
$resolver = function(\Exception $error = null, $result = null) {
|
||||
$this->resolve($error, $result); // bound to private Unresolved::resolve()
|
||||
$this->resolve($error, $result); // bound to private PrivatePlaceholder::resolve()
|
||||
};
|
||||
$updater = function($progress) {
|
||||
$this->update($progress); // bound to private Unresolved::update()
|
||||
$this->update($progress); // bound to private PrivatePlaceholder::update()
|
||||
};
|
||||
$this->resolver = $resolver->bindTo($unresolved, $unresolved);
|
||||
$this->updater = $updater->bindTo($unresolved, $unresolved);
|
||||
$this->promise = $unresolved;
|
||||
$this->resolver = $resolver->bindTo($placeholder, $placeholder);
|
||||
$this->updater = $updater->bindTo($placeholder, $placeholder);
|
||||
$this->promise = $placeholder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user