NotPromiseInstance.php 961 B

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