CallbackPromiseAdapter.php 886 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace React\Promise\PromiseAdapter;
  3. use React\Promise;
  4. class CallbackPromiseAdapter implements PromiseAdapterInterface
  5. {
  6. private $callbacks;
  7. public function __construct(array $callbacks)
  8. {
  9. $this->callbacks = $callbacks;
  10. }
  11. public function promise()
  12. {
  13. return call_user_func_array($this->callbacks['promise'], func_get_args());
  14. }
  15. public function resolve()
  16. {
  17. return call_user_func_array($this->callbacks['resolve'], func_get_args());
  18. }
  19. public function reject()
  20. {
  21. return call_user_func_array($this->callbacks['reject'], func_get_args());
  22. }
  23. public function notify()
  24. {
  25. return call_user_func_array($this->callbacks['notify'], func_get_args());
  26. }
  27. public function settle()
  28. {
  29. return call_user_func_array($this->callbacks['settle'], func_get_args());
  30. }
  31. }