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