| 1 |
<?php |
| 2 |
namespace GuzzleHttp\Promise\Tests; |
| 3 |
|
| 4 |
use GuzzleHttp\Promise\Promise; |
| 5 |
use GuzzleHttp\Promise\PromiseInterface; |
| 6 |
|
| 7 |
class NotPromiseInstance extends Thennable implements PromiseInterface |
| 8 |
{ |
| 9 |
private $nextPromise = null; |
| 10 |
|
| 11 |
public function __construct() |
| 12 |
{ |
| 13 |
$this->nextPromise = new Promise(); |
| 14 |
} |
| 15 |
|
| 16 |
public function then(callable $res = null, callable $rej = null) |
| 17 |
{ |
| 18 |
return $this->nextPromise->then($res, $rej); |
| 19 |
} |
| 20 |
|
| 21 |
public function otherwise(callable $onRejected) |
| 22 |
{ |
| 23 |
return $this->then($onRejected); |
| 24 |
} |
| 25 |
|
| 26 |
public function resolve($value) |
| 27 |
{ |
| 28 |
$this->nextPromise->resolve($value); |
| 29 |
} |
| 30 |
|
| 31 |
public function reject($reason) |
| 32 |
{ |
| 33 |
$this->nextPromise->reject($reason); |
| 34 |
} |
| 35 |
|
| 36 |
public function wait($unwrap = true, $defaultResolution = null) |
| 37 |
{ |
| 38 |
|
| 39 |
} |
| 40 |
|
| 41 |
public function cancel() |
| 42 |
{ |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
public function getState() |
| 47 |
{ |
| 48 |
return $this->nextPromise->getState(); |
| 49 |
} |
| 50 |
} |
| 51 |
|