Thennable.php 449 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace GuzzleHttp\Promise\Tests;
  3. use GuzzleHttp\Promise\Promise;
  4. class Thennable
  5. {
  6. private $nextPromise = null;
  7. public function __construct()
  8. {
  9. $this->nextPromise = new Promise();
  10. }
  11. public function then(callable $res = null, callable $rej = null)
  12. {
  13. return $this->nextPromise->then($res, $rej);
  14. }
  15. public function resolve($value)
  16. {
  17. $this->nextPromise->resolve($value);
  18. }
  19. }