Dispatcher.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace Illuminate\Contracts\Bus;
  3. interface Dispatcher
  4. {
  5. /**
  6. * Dispatch a command to its appropriate handler.
  7. *
  8. * @param mixed $command
  9. * @return mixed
  10. */
  11. public function dispatch($command);
  12. /**
  13. * Dispatch a command to its appropriate handler in the current process.
  14. *
  15. * Queueable jobs will be dispatched to the "sync" queue.
  16. *
  17. * @param mixed $command
  18. * @param mixed $handler
  19. * @return mixed
  20. */
  21. public function dispatchSync($command, $handler = null);
  22. /**
  23. * Dispatch a command to its appropriate handler in the current process.
  24. *
  25. * @param mixed $command
  26. * @param mixed $handler
  27. * @return mixed
  28. */
  29. public function dispatchNow($command, $handler = null);
  30. /**
  31. * Determine if the given command has a handler.
  32. *
  33. * @param mixed $command
  34. * @return bool
  35. */
  36. public function hasCommandHandler($command);
  37. /**
  38. * Retrieve the handler for a command.
  39. *
  40. * @param mixed $command
  41. * @return bool|mixed
  42. */
  43. public function getCommandHandler($command);
  44. /**
  45. * Set the pipes commands should be piped through before dispatching.
  46. *
  47. * @param array $pipes
  48. * @return $this
  49. */
  50. public function pipeThrough(array $pipes);
  51. /**
  52. * Map a command to a handler.
  53. *
  54. * @param array $map
  55. * @return $this
  56. */
  57. public function map(array $map);
  58. }