1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace EventEspresso\core\services\commands; |
4
|
|
|
|
5
|
|
|
if (! defined('EVENT_ESPRESSO_VERSION')) { |
6
|
|
|
exit('No direct script access allowed'); |
7
|
|
|
} |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class CompositeCommandHandler |
13
|
|
|
* abstract parent class for CommandHandlers |
14
|
|
|
* that can create additional Command objects |
15
|
|
|
* and pass them to the Command Bus for processing |
16
|
|
|
* |
17
|
|
|
* @package Event Espresso |
18
|
|
|
* @author Brent Christensen |
19
|
|
|
* @since 4.9.38 |
20
|
|
|
*/ |
21
|
|
|
abstract class CompositeCommandHandler extends CommandHandler |
22
|
|
|
{ |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @type CommandBusInterface $command_bus |
26
|
|
|
*/ |
27
|
|
|
private $command_bus; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @type CommandFactoryInterface $command_factory |
31
|
|
|
*/ |
32
|
|
|
private $command_factory; |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* CompositeCommandHandler constructor. |
38
|
|
|
* |
39
|
|
|
* @param CommandBusInterface $command_bus |
40
|
|
|
* @param CommandFactoryInterface $command_factory |
41
|
|
|
*/ |
42
|
|
|
public function __construct(CommandBusInterface $command_bus, CommandFactoryInterface $command_factory) |
43
|
|
|
{ |
44
|
|
|
$this->command_bus = $command_bus; |
45
|
|
|
$this->command_factory = $command_factory; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param CommandBusInterface $command_bus |
52
|
|
|
*/ |
53
|
|
|
public function setCommandBus(CommandBusInterface $command_bus) |
54
|
|
|
{ |
55
|
|
|
$this->command_bus = $command_bus; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return CommandBusInterface |
62
|
|
|
*/ |
63
|
|
|
public function commandBus() |
64
|
|
|
{ |
65
|
|
|
return $this->command_bus; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return CommandFactoryInterface |
72
|
|
|
*/ |
73
|
|
|
public function commandFactory() |
74
|
|
|
{ |
75
|
|
|
return $this->command_factory; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
|
79
|
|
|
|
80
|
|
|
} |
81
|
|
|
// End of file CompositeCommandHandler.php |
82
|
|
|
// Location: core/services/commands/CompositeCommandHandler.php |