1 | <?php |
||
13 | class Executer implements ExecuterContract |
||
14 | { |
||
15 | /** |
||
16 | * The command bus instance. |
||
17 | * |
||
18 | * @var \League\Tactician\CommandBus |
||
19 | */ |
||
20 | protected $bus; |
||
21 | |||
22 | /** |
||
23 | * Create a new command bus executer. |
||
24 | * |
||
25 | * @param \League\Tactician\CommandBus $bus |
||
26 | */ |
||
27 | public function __construct(CommandBus $bus) |
||
31 | |||
32 | /** |
||
33 | * Executes a command in the command bus. |
||
34 | * |
||
35 | * @param object $command |
||
36 | * @return mixed |
||
37 | */ |
||
38 | public function execute($command) |
||
42 | |||
43 | /** |
||
44 | * Marshal a command from the given class name and execute it in the command bus. |
||
45 | * |
||
46 | * @param string $command |
||
47 | * @param ArrayAccess $source |
||
48 | * @param array $extras |
||
49 | * @return mixed |
||
50 | */ |
||
51 | public function executeFrom($command, ArrayAccess $source, array $extras = []) |
||
55 | |||
56 | /** |
||
57 | * Marshal a command from the given class name and execute it in the command bus. |
||
58 | * |
||
59 | * @param string $command |
||
60 | * @param array $array |
||
61 | * @return mixed |
||
62 | */ |
||
63 | public function executeFromArray($command, array $array) |
||
67 | |||
68 | /** |
||
69 | * Marshal a command from the given array accessible object. |
||
70 | * |
||
71 | * @param string $command |
||
72 | * @param ArrayAccess $source |
||
73 | * @param array $extras |
||
74 | * @return object |
||
75 | */ |
||
76 | protected function marshal($command, ArrayAccess $source, array $extras = []) |
||
89 | |||
90 | /** |
||
91 | * Marshal a command from the given array. |
||
92 | * |
||
93 | * @param string $command |
||
94 | * @param array $array |
||
95 | * @return object |
||
96 | */ |
||
97 | protected function marshalFromArray($command, array $array) |
||
101 | |||
102 | /** |
||
103 | * Get a parameter value for a marshalled command. |
||
104 | * |
||
105 | * @param string $command |
||
106 | * @param ArrayAccess $source |
||
107 | * @param ReflectionParameter $parameter |
||
108 | * @param array $extras |
||
109 | * @return mixed |
||
110 | * |
||
111 | * @throws Exceptions\CanNotMapParameterValue |
||
112 | */ |
||
113 | protected function getParameterValueForCommand( |
||
133 | } |
||
134 |