@@ -16,43 +16,43 @@ |
||
16 | 16 | */ |
17 | 17 | class SharedCoffeeMaker extends CoffeeMaker |
18 | 18 | { |
19 | - /** |
|
20 | - * @return string |
|
21 | - */ |
|
22 | - public function type() |
|
23 | - { |
|
24 | - return CoffeeMaker::BREW_SHARED; |
|
25 | - } |
|
19 | + /** |
|
20 | + * @return string |
|
21 | + */ |
|
22 | + public function type() |
|
23 | + { |
|
24 | + return CoffeeMaker::BREW_SHARED; |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @param RecipeInterface $recipe |
|
30 | - * @param array $arguments |
|
31 | - * @return mixed |
|
32 | - */ |
|
33 | - public function brew(RecipeInterface $recipe, $arguments = array()) |
|
34 | - { |
|
35 | - $this->resolveClassAndFilepath($recipe); |
|
36 | - $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
37 | - $method = $this->resolveInstantiationMethod($reflector); |
|
38 | - switch ($method) { |
|
39 | - case 'instance': |
|
40 | - case 'new_instance': |
|
41 | - case 'new_instance_from_db': |
|
42 | - $service = call_user_func_array( |
|
43 | - array($reflector->getName(), $method), |
|
44 | - $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
45 | - ); |
|
46 | - break; |
|
47 | - case 'newInstance': |
|
48 | - $service = $reflector->newInstance(); |
|
49 | - break; |
|
50 | - case 'newInstanceArgs': |
|
51 | - default: |
|
52 | - $service = $reflector->newInstanceArgs( |
|
53 | - $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
54 | - ); |
|
55 | - } |
|
56 | - return $this->coffeePot()->addService($recipe->identifier(), $service); |
|
57 | - } |
|
28 | + /** |
|
29 | + * @param RecipeInterface $recipe |
|
30 | + * @param array $arguments |
|
31 | + * @return mixed |
|
32 | + */ |
|
33 | + public function brew(RecipeInterface $recipe, $arguments = array()) |
|
34 | + { |
|
35 | + $this->resolveClassAndFilepath($recipe); |
|
36 | + $reflector = $this->injector()->getReflectionClass($recipe->fqcn()); |
|
37 | + $method = $this->resolveInstantiationMethod($reflector); |
|
38 | + switch ($method) { |
|
39 | + case 'instance': |
|
40 | + case 'new_instance': |
|
41 | + case 'new_instance_from_db': |
|
42 | + $service = call_user_func_array( |
|
43 | + array($reflector->getName(), $method), |
|
44 | + $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
45 | + ); |
|
46 | + break; |
|
47 | + case 'newInstance': |
|
48 | + $service = $reflector->newInstance(); |
|
49 | + break; |
|
50 | + case 'newInstanceArgs': |
|
51 | + default: |
|
52 | + $service = $reflector->newInstanceArgs( |
|
53 | + $this->injector()->resolveDependencies($recipe, $reflector, $arguments) |
|
54 | + ); |
|
55 | + } |
|
56 | + return $this->coffeePot()->addService($recipe->identifier(), $service); |
|
57 | + } |
|
58 | 58 | } |
@@ -12,24 +12,24 @@ |
||
12 | 12 | */ |
13 | 13 | interface ContainerInterface |
14 | 14 | { |
15 | - /** |
|
16 | - * Finds an entry of the container by its identifier and returns it. |
|
17 | - * |
|
18 | - * @param string $id Identifier of the entry to look for. |
|
19 | - * @return mixed Entry. |
|
20 | - */ |
|
21 | - public function get($id); |
|
15 | + /** |
|
16 | + * Finds an entry of the container by its identifier and returns it. |
|
17 | + * |
|
18 | + * @param string $id Identifier of the entry to look for. |
|
19 | + * @return mixed Entry. |
|
20 | + */ |
|
21 | + public function get($id); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * Returns true if the container can return an entry for the given identifier. |
|
27 | - * Returns false otherwise. |
|
28 | - * `has($id)` returning true does not mean that `get($id)` will not throw an exception. |
|
29 | - * It does however mean that `get($id)` will not throw a `NotFoundException`. |
|
30 | - * |
|
31 | - * @param string $id Identifier of the entry to look for. |
|
32 | - * @return boolean |
|
33 | - */ |
|
34 | - public function has($id); |
|
25 | + /** |
|
26 | + * Returns true if the container can return an entry for the given identifier. |
|
27 | + * Returns false otherwise. |
|
28 | + * `has($id)` returning true does not mean that `get($id)` will not throw an exception. |
|
29 | + * It does however mean that `get($id)` will not throw a `NotFoundException`. |
|
30 | + * |
|
31 | + * @param string $id Identifier of the entry to look for. |
|
32 | + * @return boolean |
|
33 | + */ |
|
34 | + public function has($id); |
|
35 | 35 | } |
@@ -14,112 +14,112 @@ |
||
14 | 14 | */ |
15 | 15 | class CancelTicketLineItemCommand extends Command |
16 | 16 | { |
17 | - /** |
|
18 | - * @var \EE_Transaction $transaction |
|
19 | - */ |
|
20 | - private $transaction; |
|
21 | - |
|
22 | - /** |
|
23 | - * @var \EE_Ticket $ticket |
|
24 | - */ |
|
25 | - private $ticket; |
|
26 | - |
|
27 | - /** |
|
28 | - * @var \EE_Line_Item $ticket_line_item |
|
29 | - */ |
|
30 | - protected $ticket_line_item; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var int $quantity |
|
34 | - */ |
|
35 | - protected $quantity; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @param \EE_Registration $registration |
|
40 | - * @param int $quantity |
|
41 | - */ |
|
42 | - public static function fromRegistration(\EE_Registration $registration, $quantity = 1) |
|
43 | - { |
|
44 | - new self( |
|
45 | - $registration->transaction(), |
|
46 | - $registration->ticket(), |
|
47 | - 1, |
|
48 | - $registration->ticket_line_item() |
|
49 | - ); |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * @param \EE_Line_Item $ticket_line_item |
|
55 | - * @param int $quantity |
|
56 | - */ |
|
57 | - public static function fromTicketLineItem( |
|
58 | - \EE_Line_Item $ticket_line_item, |
|
59 | - $quantity = 1 |
|
60 | - ) { |
|
61 | - new self( |
|
62 | - $ticket_line_item->transaction(), |
|
63 | - $ticket_line_item->ticket(), |
|
64 | - $quantity, |
|
65 | - $ticket_line_item |
|
66 | - ); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * CancelTicketLineItemCommand constructor. |
|
72 | - * |
|
73 | - * @param \EE_Transaction $transaction |
|
74 | - * @param \EE_Ticket $ticket |
|
75 | - * @param int $quantity |
|
76 | - * @param \EE_Line_Item $ticket_line_item |
|
77 | - */ |
|
78 | - public function __construct( |
|
79 | - \EE_Transaction $transaction, |
|
80 | - \EE_Ticket $ticket, |
|
81 | - $quantity = 1, |
|
82 | - \EE_Line_Item $ticket_line_item = null |
|
83 | - ) { |
|
84 | - $this->transaction = $transaction; |
|
85 | - $this->ticket = $ticket; |
|
86 | - $this->quantity = min(1, absint($quantity)); |
|
87 | - $this->ticket_line_item = $ticket_line_item; |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return \EE_Transaction |
|
93 | - */ |
|
94 | - public function transaction() |
|
95 | - { |
|
96 | - return $this->transaction; |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @return \EE_Ticket |
|
102 | - */ |
|
103 | - public function ticket() |
|
104 | - { |
|
105 | - return $this->ticket; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @return \EE_Line_Item |
|
111 | - */ |
|
112 | - public function ticketLineItem() |
|
113 | - { |
|
114 | - return $this->ticket_line_item; |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - /** |
|
119 | - * @return int |
|
120 | - */ |
|
121 | - public function quantity() |
|
122 | - { |
|
123 | - return $this->quantity; |
|
124 | - } |
|
17 | + /** |
|
18 | + * @var \EE_Transaction $transaction |
|
19 | + */ |
|
20 | + private $transaction; |
|
21 | + |
|
22 | + /** |
|
23 | + * @var \EE_Ticket $ticket |
|
24 | + */ |
|
25 | + private $ticket; |
|
26 | + |
|
27 | + /** |
|
28 | + * @var \EE_Line_Item $ticket_line_item |
|
29 | + */ |
|
30 | + protected $ticket_line_item; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var int $quantity |
|
34 | + */ |
|
35 | + protected $quantity; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @param \EE_Registration $registration |
|
40 | + * @param int $quantity |
|
41 | + */ |
|
42 | + public static function fromRegistration(\EE_Registration $registration, $quantity = 1) |
|
43 | + { |
|
44 | + new self( |
|
45 | + $registration->transaction(), |
|
46 | + $registration->ticket(), |
|
47 | + 1, |
|
48 | + $registration->ticket_line_item() |
|
49 | + ); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * @param \EE_Line_Item $ticket_line_item |
|
55 | + * @param int $quantity |
|
56 | + */ |
|
57 | + public static function fromTicketLineItem( |
|
58 | + \EE_Line_Item $ticket_line_item, |
|
59 | + $quantity = 1 |
|
60 | + ) { |
|
61 | + new self( |
|
62 | + $ticket_line_item->transaction(), |
|
63 | + $ticket_line_item->ticket(), |
|
64 | + $quantity, |
|
65 | + $ticket_line_item |
|
66 | + ); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * CancelTicketLineItemCommand constructor. |
|
72 | + * |
|
73 | + * @param \EE_Transaction $transaction |
|
74 | + * @param \EE_Ticket $ticket |
|
75 | + * @param int $quantity |
|
76 | + * @param \EE_Line_Item $ticket_line_item |
|
77 | + */ |
|
78 | + public function __construct( |
|
79 | + \EE_Transaction $transaction, |
|
80 | + \EE_Ticket $ticket, |
|
81 | + $quantity = 1, |
|
82 | + \EE_Line_Item $ticket_line_item = null |
|
83 | + ) { |
|
84 | + $this->transaction = $transaction; |
|
85 | + $this->ticket = $ticket; |
|
86 | + $this->quantity = min(1, absint($quantity)); |
|
87 | + $this->ticket_line_item = $ticket_line_item; |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return \EE_Transaction |
|
93 | + */ |
|
94 | + public function transaction() |
|
95 | + { |
|
96 | + return $this->transaction; |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @return \EE_Ticket |
|
102 | + */ |
|
103 | + public function ticket() |
|
104 | + { |
|
105 | + return $this->ticket; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @return \EE_Line_Item |
|
111 | + */ |
|
112 | + public function ticketLineItem() |
|
113 | + { |
|
114 | + return $this->ticket_line_item; |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + /** |
|
119 | + * @return int |
|
120 | + */ |
|
121 | + public function quantity() |
|
122 | + { |
|
123 | + return $this->quantity; |
|
124 | + } |
|
125 | 125 | } |
@@ -14,77 +14,77 @@ |
||
14 | 14 | */ |
15 | 15 | class CreateTicketLineItemCommand extends Command |
16 | 16 | { |
17 | - /** |
|
18 | - * @var \EE_Transaction $transaction |
|
19 | - */ |
|
20 | - private $transaction; |
|
21 | - |
|
22 | - /** |
|
23 | - * @var \EE_Ticket $ticket |
|
24 | - */ |
|
25 | - private $ticket; |
|
26 | - |
|
27 | - /** |
|
28 | - * @var int $quantity |
|
29 | - */ |
|
30 | - private $quantity = 1; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var \EE_Line_Item $ticket_line_item |
|
34 | - */ |
|
35 | - protected $ticket_line_item; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * CreateTicketLineItemCommand constructor. |
|
40 | - * |
|
41 | - * @param \EE_Transaction $transaction |
|
42 | - * @param \EE_Ticket $ticket |
|
43 | - * @param int $quantity |
|
44 | - */ |
|
45 | - public function __construct( |
|
46 | - \EE_Transaction $transaction, |
|
47 | - \EE_Ticket $ticket, |
|
48 | - $quantity = 1 |
|
49 | - ) { |
|
50 | - $this->transaction = $transaction; |
|
51 | - $this->ticket = $ticket; |
|
52 | - $this->quantity = $quantity; |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @return \EE_Transaction |
|
58 | - */ |
|
59 | - public function transaction() |
|
60 | - { |
|
61 | - return $this->transaction; |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * @return \EE_Ticket |
|
67 | - */ |
|
68 | - public function ticket() |
|
69 | - { |
|
70 | - return $this->ticket; |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * @return int |
|
76 | - */ |
|
77 | - public function quantity() |
|
78 | - { |
|
79 | - return $this->quantity; |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * @return \EE_Line_Item |
|
85 | - */ |
|
86 | - public function ticketLineItem() |
|
87 | - { |
|
88 | - return $this->ticket_line_item; |
|
89 | - } |
|
17 | + /** |
|
18 | + * @var \EE_Transaction $transaction |
|
19 | + */ |
|
20 | + private $transaction; |
|
21 | + |
|
22 | + /** |
|
23 | + * @var \EE_Ticket $ticket |
|
24 | + */ |
|
25 | + private $ticket; |
|
26 | + |
|
27 | + /** |
|
28 | + * @var int $quantity |
|
29 | + */ |
|
30 | + private $quantity = 1; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var \EE_Line_Item $ticket_line_item |
|
34 | + */ |
|
35 | + protected $ticket_line_item; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * CreateTicketLineItemCommand constructor. |
|
40 | + * |
|
41 | + * @param \EE_Transaction $transaction |
|
42 | + * @param \EE_Ticket $ticket |
|
43 | + * @param int $quantity |
|
44 | + */ |
|
45 | + public function __construct( |
|
46 | + \EE_Transaction $transaction, |
|
47 | + \EE_Ticket $ticket, |
|
48 | + $quantity = 1 |
|
49 | + ) { |
|
50 | + $this->transaction = $transaction; |
|
51 | + $this->ticket = $ticket; |
|
52 | + $this->quantity = $quantity; |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @return \EE_Transaction |
|
58 | + */ |
|
59 | + public function transaction() |
|
60 | + { |
|
61 | + return $this->transaction; |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * @return \EE_Ticket |
|
67 | + */ |
|
68 | + public function ticket() |
|
69 | + { |
|
70 | + return $this->ticket; |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * @return int |
|
76 | + */ |
|
77 | + public function quantity() |
|
78 | + { |
|
79 | + return $this->quantity; |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * @return \EE_Line_Item |
|
85 | + */ |
|
86 | + public function ticketLineItem() |
|
87 | + { |
|
88 | + return $this->ticket_line_item; |
|
89 | + } |
|
90 | 90 | } |
@@ -14,53 +14,53 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class CompositeCommandHandler extends CommandHandler |
16 | 16 | { |
17 | - /** |
|
18 | - * @type CommandBusInterface $command_bus |
|
19 | - */ |
|
20 | - private $command_bus; |
|
17 | + /** |
|
18 | + * @type CommandBusInterface $command_bus |
|
19 | + */ |
|
20 | + private $command_bus; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @type CommandFactoryInterface $command_factory |
|
24 | - */ |
|
25 | - private $command_factory; |
|
22 | + /** |
|
23 | + * @type CommandFactoryInterface $command_factory |
|
24 | + */ |
|
25 | + private $command_factory; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * CompositeCommandHandler constructor. |
|
30 | - * |
|
31 | - * @param CommandBusInterface $command_bus |
|
32 | - * @param CommandFactoryInterface $command_factory |
|
33 | - */ |
|
34 | - public function __construct(CommandBusInterface $command_bus, CommandFactoryInterface $command_factory) |
|
35 | - { |
|
36 | - $this->command_bus = $command_bus; |
|
37 | - $this->command_factory = $command_factory; |
|
38 | - } |
|
28 | + /** |
|
29 | + * CompositeCommandHandler constructor. |
|
30 | + * |
|
31 | + * @param CommandBusInterface $command_bus |
|
32 | + * @param CommandFactoryInterface $command_factory |
|
33 | + */ |
|
34 | + public function __construct(CommandBusInterface $command_bus, CommandFactoryInterface $command_factory) |
|
35 | + { |
|
36 | + $this->command_bus = $command_bus; |
|
37 | + $this->command_factory = $command_factory; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @param CommandBusInterface $command_bus |
|
43 | - */ |
|
44 | - public function setCommandBus(CommandBusInterface $command_bus) |
|
45 | - { |
|
46 | - $this->command_bus = $command_bus; |
|
47 | - } |
|
41 | + /** |
|
42 | + * @param CommandBusInterface $command_bus |
|
43 | + */ |
|
44 | + public function setCommandBus(CommandBusInterface $command_bus) |
|
45 | + { |
|
46 | + $this->command_bus = $command_bus; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @return CommandBusInterface |
|
52 | - */ |
|
53 | - public function commandBus() |
|
54 | - { |
|
55 | - return $this->command_bus; |
|
56 | - } |
|
50 | + /** |
|
51 | + * @return CommandBusInterface |
|
52 | + */ |
|
53 | + public function commandBus() |
|
54 | + { |
|
55 | + return $this->command_bus; |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @return CommandFactoryInterface |
|
61 | - */ |
|
62 | - public function commandFactory() |
|
63 | - { |
|
64 | - return $this->command_factory; |
|
65 | - } |
|
59 | + /** |
|
60 | + * @return CommandFactoryInterface |
|
61 | + */ |
|
62 | + public function commandFactory() |
|
63 | + { |
|
64 | + return $this->command_factory; |
|
65 | + } |
|
66 | 66 | } |
@@ -14,35 +14,35 @@ |
||
14 | 14 | */ |
15 | 15 | class InvalidCommandBusMiddlewareException extends InvalidDataTypeException |
16 | 16 | { |
17 | - /** |
|
18 | - * @access public |
|
19 | - * @param mixed $command_bus_middleware_object |
|
20 | - * @param string $message |
|
21 | - * @param int $code |
|
22 | - * @param \Exception $previous |
|
23 | - */ |
|
24 | - public function __construct($command_bus_middleware_object, $message = '', $code = 0, \Exception $previous = null) |
|
25 | - { |
|
26 | - $command_bus_middleware = is_object($command_bus_middleware_object) |
|
27 | - ? get_class($command_bus_middleware_object) |
|
28 | - : gettype($command_bus_middleware_object); |
|
17 | + /** |
|
18 | + * @access public |
|
19 | + * @param mixed $command_bus_middleware_object |
|
20 | + * @param string $message |
|
21 | + * @param int $code |
|
22 | + * @param \Exception $previous |
|
23 | + */ |
|
24 | + public function __construct($command_bus_middleware_object, $message = '', $code = 0, \Exception $previous = null) |
|
25 | + { |
|
26 | + $command_bus_middleware = is_object($command_bus_middleware_object) |
|
27 | + ? get_class($command_bus_middleware_object) |
|
28 | + : gettype($command_bus_middleware_object); |
|
29 | 29 | |
30 | - if (empty($message)) { |
|
31 | - $message = sprintf( |
|
32 | - esc_html__( |
|
33 | - 'The supplied Command Bus Middleware "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
34 | - 'event_espresso' |
|
35 | - ), |
|
36 | - $command_bus_middleware |
|
37 | - ); |
|
38 | - } |
|
39 | - parent::__construct( |
|
40 | - '$command_bus_middleware', |
|
41 | - $command_bus_middleware, |
|
42 | - 'CommandBusMiddlewareInterface', |
|
43 | - $message, |
|
44 | - $code, |
|
45 | - $previous |
|
46 | - ); |
|
47 | - } |
|
30 | + if (empty($message)) { |
|
31 | + $message = sprintf( |
|
32 | + esc_html__( |
|
33 | + 'The supplied Command Bus Middleware "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
34 | + 'event_espresso' |
|
35 | + ), |
|
36 | + $command_bus_middleware |
|
37 | + ); |
|
38 | + } |
|
39 | + parent::__construct( |
|
40 | + '$command_bus_middleware', |
|
41 | + $command_bus_middleware, |
|
42 | + 'CommandBusMiddlewareInterface', |
|
43 | + $message, |
|
44 | + $code, |
|
45 | + $previous |
|
46 | + ); |
|
47 | + } |
|
48 | 48 | } |
@@ -23,37 +23,37 @@ |
||
23 | 23 | */ |
24 | 24 | class CapChecker implements CommandBusMiddlewareInterface |
25 | 25 | { |
26 | - /** |
|
27 | - * @type CapabilitiesCheckerInterface $capabilities_checker |
|
28 | - */ |
|
29 | - private $capabilities_checker; |
|
26 | + /** |
|
27 | + * @type CapabilitiesCheckerInterface $capabilities_checker |
|
28 | + */ |
|
29 | + private $capabilities_checker; |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * CapChecker constructor |
|
34 | - * |
|
35 | - * @param CapabilitiesCheckerInterface $capabilities_checker |
|
36 | - */ |
|
37 | - public function __construct(CapabilitiesCheckerInterface $capabilities_checker) |
|
38 | - { |
|
39 | - $this->capabilities_checker = $capabilities_checker; |
|
40 | - } |
|
32 | + /** |
|
33 | + * CapChecker constructor |
|
34 | + * |
|
35 | + * @param CapabilitiesCheckerInterface $capabilities_checker |
|
36 | + */ |
|
37 | + public function __construct(CapabilitiesCheckerInterface $capabilities_checker) |
|
38 | + { |
|
39 | + $this->capabilities_checker = $capabilities_checker; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @param CommandInterface $command |
|
45 | - * @param Closure $next |
|
46 | - * @return mixed |
|
47 | - * @throws InvalidClassException |
|
48 | - * @throws InsufficientPermissionsException |
|
49 | - */ |
|
50 | - public function handle(CommandInterface $command, Closure $next) |
|
51 | - { |
|
52 | - if ($command instanceof CommandRequiresCapCheckInterface) { |
|
53 | - $this->capabilities_checker->processCapCheck( |
|
54 | - $command->getCapCheck() |
|
55 | - ); |
|
56 | - } |
|
57 | - return $next($command); |
|
58 | - } |
|
43 | + /** |
|
44 | + * @param CommandInterface $command |
|
45 | + * @param Closure $next |
|
46 | + * @return mixed |
|
47 | + * @throws InvalidClassException |
|
48 | + * @throws InsufficientPermissionsException |
|
49 | + */ |
|
50 | + public function handle(CommandInterface $command, Closure $next) |
|
51 | + { |
|
52 | + if ($command instanceof CommandRequiresCapCheckInterface) { |
|
53 | + $this->capabilities_checker->processCapCheck( |
|
54 | + $command->getCapCheck() |
|
55 | + ); |
|
56 | + } |
|
57 | + return $next($command); |
|
58 | + } |
|
59 | 59 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | interface CommandBusMiddlewareInterface |
14 | 14 | { |
15 | - /** |
|
16 | - * @param CommandInterface $command |
|
17 | - * @param Closure $next |
|
18 | - * @return mixed |
|
19 | - */ |
|
20 | - public function handle(CommandInterface $command, Closure $next); |
|
15 | + /** |
|
16 | + * @param CommandInterface $command |
|
17 | + * @param Closure $next |
|
18 | + * @return mixed |
|
19 | + */ |
|
20 | + public function handle(CommandInterface $command, Closure $next); |
|
21 | 21 | } |
@@ -14,22 +14,22 @@ |
||
14 | 14 | */ |
15 | 15 | class AddActionHook implements CommandBusMiddlewareInterface |
16 | 16 | { |
17 | - /** |
|
18 | - * @param CommandInterface $command |
|
19 | - * @param Closure $next |
|
20 | - * @return mixed |
|
21 | - */ |
|
22 | - public function handle(CommandInterface $command, Closure $next) |
|
23 | - { |
|
24 | - do_action( |
|
25 | - 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__before', |
|
26 | - $command |
|
27 | - ); |
|
28 | - $results = $next($command); |
|
29 | - do_action( |
|
30 | - 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__after', |
|
31 | - $command |
|
32 | - ); |
|
33 | - return $results; |
|
34 | - } |
|
17 | + /** |
|
18 | + * @param CommandInterface $command |
|
19 | + * @param Closure $next |
|
20 | + * @return mixed |
|
21 | + */ |
|
22 | + public function handle(CommandInterface $command, Closure $next) |
|
23 | + { |
|
24 | + do_action( |
|
25 | + 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__before', |
|
26 | + $command |
|
27 | + ); |
|
28 | + $results = $next($command); |
|
29 | + do_action( |
|
30 | + 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__after', |
|
31 | + $command |
|
32 | + ); |
|
33 | + return $results; |
|
34 | + } |
|
35 | 35 | } |