@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\services\commands\CommandInterface; |
5 | 5 | |
6 | 6 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
7 | - exit('No direct script access allowed'); |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | interface CommandBusMiddlewareInterface |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @param CommandInterface $command |
|
22 | - * @param \Closure $next |
|
23 | - * @return mixed |
|
24 | - */ |
|
25 | - public function handle(CommandInterface $command, \Closure $next); |
|
20 | + /** |
|
21 | + * @param CommandInterface $command |
|
22 | + * @param \Closure $next |
|
23 | + * @return mixed |
|
24 | + */ |
|
25 | + public function handle(CommandInterface $command, \Closure $next); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | // End of file CommandBusMiddlewareInterface.php |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use EventEspresso\core\services\commands\middleware\InvalidCommandBusMiddlewareException; |
7 | 7 | |
8 | 8 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
9 | - exit('No direct script access allowed'); |
|
9 | + exit('No direct script access allowed'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | |
@@ -55,73 +55,73 @@ discard block |
||
55 | 55 | class CommandBus implements CommandBusInterface |
56 | 56 | { |
57 | 57 | |
58 | - /** |
|
59 | - * @type CommandHandlerManagerInterface $command_handler_manager |
|
60 | - */ |
|
61 | - private $command_handler_manager; |
|
62 | - |
|
63 | - /** |
|
64 | - * @type CommandBusMiddlewareInterface[] $command_bus_middleware |
|
65 | - */ |
|
66 | - private $command_bus_middleware; |
|
67 | - |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * CommandBus constructor |
|
72 | - * |
|
73 | - * @param CommandHandlerManagerInterface $command_handler_manager |
|
74 | - * @param CommandBusMiddlewareInterface[] $command_bus_middleware |
|
75 | - */ |
|
76 | - public function __construct( |
|
77 | - CommandHandlerManagerInterface $command_handler_manager, |
|
78 | - $command_bus_middleware = array() |
|
79 | - ) { |
|
80 | - $this->command_handler_manager = $command_handler_manager; |
|
81 | - $this->command_bus_middleware = is_array($command_bus_middleware) |
|
82 | - ? $command_bus_middleware |
|
83 | - : array($command_bus_middleware); |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @return CommandHandlerManagerInterface |
|
90 | - */ |
|
91 | - public function getCommandHandlerManager() |
|
92 | - { |
|
93 | - return $this->command_handler_manager; |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
100 | - * @return mixed |
|
101 | - */ |
|
102 | - public function execute($command) |
|
103 | - { |
|
104 | - if ( ! $command instanceof CommandInterface) { |
|
105 | - throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface'); |
|
106 | - } |
|
107 | - // expose the command to any CommandBus middleware classes |
|
108 | - // so that they can execute their logic on the command |
|
109 | - $middleware = function ($command) { |
|
110 | - // do nothing, just need an empty shell to pass along as the last middleware |
|
111 | - }; |
|
112 | - while ($command_bus_middleware = array_pop($this->command_bus_middleware)) { |
|
113 | - if ( ! $command_bus_middleware instanceof CommandBusMiddlewareInterface) { |
|
114 | - throw new InvalidCommandBusMiddlewareException($command_bus_middleware); |
|
115 | - } |
|
116 | - $middleware = function ($command) use ($command_bus_middleware, $middleware) { |
|
117 | - return $command_bus_middleware->handle($command, $middleware); |
|
118 | - }; |
|
119 | - $middleware($command, $middleware); |
|
120 | - } |
|
121 | - return $this->command_handler_manager |
|
122 | - ->getCommandHandler($command) |
|
123 | - ->handle($command); |
|
124 | - } |
|
58 | + /** |
|
59 | + * @type CommandHandlerManagerInterface $command_handler_manager |
|
60 | + */ |
|
61 | + private $command_handler_manager; |
|
62 | + |
|
63 | + /** |
|
64 | + * @type CommandBusMiddlewareInterface[] $command_bus_middleware |
|
65 | + */ |
|
66 | + private $command_bus_middleware; |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * CommandBus constructor |
|
72 | + * |
|
73 | + * @param CommandHandlerManagerInterface $command_handler_manager |
|
74 | + * @param CommandBusMiddlewareInterface[] $command_bus_middleware |
|
75 | + */ |
|
76 | + public function __construct( |
|
77 | + CommandHandlerManagerInterface $command_handler_manager, |
|
78 | + $command_bus_middleware = array() |
|
79 | + ) { |
|
80 | + $this->command_handler_manager = $command_handler_manager; |
|
81 | + $this->command_bus_middleware = is_array($command_bus_middleware) |
|
82 | + ? $command_bus_middleware |
|
83 | + : array($command_bus_middleware); |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @return CommandHandlerManagerInterface |
|
90 | + */ |
|
91 | + public function getCommandHandlerManager() |
|
92 | + { |
|
93 | + return $this->command_handler_manager; |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
100 | + * @return mixed |
|
101 | + */ |
|
102 | + public function execute($command) |
|
103 | + { |
|
104 | + if ( ! $command instanceof CommandInterface) { |
|
105 | + throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface'); |
|
106 | + } |
|
107 | + // expose the command to any CommandBus middleware classes |
|
108 | + // so that they can execute their logic on the command |
|
109 | + $middleware = function ($command) { |
|
110 | + // do nothing, just need an empty shell to pass along as the last middleware |
|
111 | + }; |
|
112 | + while ($command_bus_middleware = array_pop($this->command_bus_middleware)) { |
|
113 | + if ( ! $command_bus_middleware instanceof CommandBusMiddlewareInterface) { |
|
114 | + throw new InvalidCommandBusMiddlewareException($command_bus_middleware); |
|
115 | + } |
|
116 | + $middleware = function ($command) use ($command_bus_middleware, $middleware) { |
|
117 | + return $command_bus_middleware->handle($command, $middleware); |
|
118 | + }; |
|
119 | + $middleware($command, $middleware); |
|
120 | + } |
|
121 | + return $this->command_handler_manager |
|
122 | + ->getCommandHandler($command) |
|
123 | + ->handle($command); |
|
124 | + } |
|
125 | 125 | |
126 | 126 | |
127 | 127 | } |
@@ -102,18 +102,18 @@ |
||
102 | 102 | public function execute($command) |
103 | 103 | { |
104 | 104 | if ( ! $command instanceof CommandInterface) { |
105 | - throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface'); |
|
105 | + throw new InvalidDataTypeException(__METHOD__.'( $command )', $command, 'CommandInterface'); |
|
106 | 106 | } |
107 | 107 | // expose the command to any CommandBus middleware classes |
108 | 108 | // so that they can execute their logic on the command |
109 | - $middleware = function ($command) { |
|
109 | + $middleware = function($command) { |
|
110 | 110 | // do nothing, just need an empty shell to pass along as the last middleware |
111 | 111 | }; |
112 | 112 | while ($command_bus_middleware = array_pop($this->command_bus_middleware)) { |
113 | 113 | if ( ! $command_bus_middleware instanceof CommandBusMiddlewareInterface) { |
114 | 114 | throw new InvalidCommandBusMiddlewareException($command_bus_middleware); |
115 | 115 | } |
116 | - $middleware = function ($command) use ($command_bus_middleware, $middleware) { |
|
116 | + $middleware = function($command) use ($command_bus_middleware, $middleware) { |
|
117 | 117 | return $command_bus_middleware->handle($command, $middleware); |
118 | 118 | }; |
119 | 119 | $middleware($command, $middleware); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * Class EE_Line_Item_Filter_Collection |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use EventEspresso\core\services\commands\CommandHandler; |
7 | 7 | use EventEspresso\core\services\commands\CommandInterface; |
8 | 8 | |
9 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
10 | - exit( 'No direct script access allowed' ); |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | * @param \EventEspresso\core\services\commands\CommandInterface $command |
47 | 47 | * @return \EE_Line_Item |
48 | 48 | */ |
49 | - public function handle( CommandInterface $command ) { |
|
49 | + public function handle(CommandInterface $command) { |
|
50 | 50 | /** @var CreateTicketLineItemCommand $command */ |
51 | - if ( ! $command instanceof CreateTicketLineItemCommand ) { |
|
52 | - throw new InvalidEntityException( get_class( $command ), 'CreateTicketLineItemCommand' ); |
|
51 | + if ( ! $command instanceof CreateTicketLineItemCommand) { |
|
52 | + throw new InvalidEntityException(get_class($command), 'CreateTicketLineItemCommand'); |
|
53 | 53 | } |
54 | 54 | // create new line item for ticket |
55 | 55 | return $this->factory->create( |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\services\commands\Command; |
5 | 5 | |
6 | 6 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
7 | - exit('No direct script access allowed'); |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -21,121 +21,121 @@ discard block |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * @var \EE_Transaction $transaction |
|
26 | - */ |
|
27 | - private $transaction; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var \EE_Ticket $ticket |
|
31 | - */ |
|
32 | - private $ticket; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var \EE_Line_Item $ticket_line_item |
|
36 | - */ |
|
37 | - protected $ticket_line_item; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var int $quantity |
|
41 | - */ |
|
42 | - protected $quantity; |
|
43 | - |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @param \EE_Registration $registration |
|
48 | - * @param int $quantity |
|
49 | - */ |
|
50 | - public static function fromRegistration(\EE_Registration $registration, $quantity = 1) |
|
51 | - { |
|
52 | - new self( |
|
53 | - $registration->transaction(), |
|
54 | - $registration->ticket(), |
|
55 | - 1, |
|
56 | - $registration->ticket_line_item() |
|
57 | - ); |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * @param \EE_Line_Item $ticket_line_item |
|
64 | - * @param int $quantity |
|
65 | - */ |
|
66 | - public static function fromTicketLineItem( |
|
67 | - \EE_Line_Item $ticket_line_item, |
|
68 | - $quantity = 1 |
|
69 | - ) { |
|
70 | - new self( |
|
71 | - $ticket_line_item->transaction(), |
|
72 | - $ticket_line_item->ticket(), |
|
73 | - $quantity, |
|
74 | - $ticket_line_item |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * CancelTicketLineItemCommand constructor. |
|
82 | - * |
|
83 | - * @param \EE_Transaction $transaction |
|
84 | - * @param \EE_Ticket $ticket |
|
85 | - * @param int $quantity |
|
86 | - * @param \EE_Line_Item $ticket_line_item |
|
87 | - */ |
|
88 | - public function __construct( |
|
89 | - \EE_Transaction $transaction, |
|
90 | - \EE_Ticket $ticket, |
|
91 | - $quantity = 1, |
|
92 | - \EE_Line_Item $ticket_line_item = null |
|
93 | - ) { |
|
94 | - $this->transaction = $transaction; |
|
95 | - $this->ticket = $ticket; |
|
96 | - $this->quantity = min(1, absint($quantity)); |
|
97 | - $this->ticket_line_item = $ticket_line_item; |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * @return \EE_Transaction |
|
104 | - */ |
|
105 | - public function transaction() |
|
106 | - { |
|
107 | - return $this->transaction; |
|
108 | - } |
|
109 | - |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * @return \EE_Ticket |
|
114 | - */ |
|
115 | - public function ticket() |
|
116 | - { |
|
117 | - return $this->ticket; |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @return \EE_Line_Item |
|
124 | - */ |
|
125 | - public function ticketLineItem() |
|
126 | - { |
|
127 | - return $this->ticket_line_item; |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - |
|
132 | - /** |
|
133 | - * @return int |
|
134 | - */ |
|
135 | - public function quantity() |
|
136 | - { |
|
137 | - return $this->quantity; |
|
138 | - } |
|
24 | + /** |
|
25 | + * @var \EE_Transaction $transaction |
|
26 | + */ |
|
27 | + private $transaction; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var \EE_Ticket $ticket |
|
31 | + */ |
|
32 | + private $ticket; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var \EE_Line_Item $ticket_line_item |
|
36 | + */ |
|
37 | + protected $ticket_line_item; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var int $quantity |
|
41 | + */ |
|
42 | + protected $quantity; |
|
43 | + |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @param \EE_Registration $registration |
|
48 | + * @param int $quantity |
|
49 | + */ |
|
50 | + public static function fromRegistration(\EE_Registration $registration, $quantity = 1) |
|
51 | + { |
|
52 | + new self( |
|
53 | + $registration->transaction(), |
|
54 | + $registration->ticket(), |
|
55 | + 1, |
|
56 | + $registration->ticket_line_item() |
|
57 | + ); |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * @param \EE_Line_Item $ticket_line_item |
|
64 | + * @param int $quantity |
|
65 | + */ |
|
66 | + public static function fromTicketLineItem( |
|
67 | + \EE_Line_Item $ticket_line_item, |
|
68 | + $quantity = 1 |
|
69 | + ) { |
|
70 | + new self( |
|
71 | + $ticket_line_item->transaction(), |
|
72 | + $ticket_line_item->ticket(), |
|
73 | + $quantity, |
|
74 | + $ticket_line_item |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * CancelTicketLineItemCommand constructor. |
|
82 | + * |
|
83 | + * @param \EE_Transaction $transaction |
|
84 | + * @param \EE_Ticket $ticket |
|
85 | + * @param int $quantity |
|
86 | + * @param \EE_Line_Item $ticket_line_item |
|
87 | + */ |
|
88 | + public function __construct( |
|
89 | + \EE_Transaction $transaction, |
|
90 | + \EE_Ticket $ticket, |
|
91 | + $quantity = 1, |
|
92 | + \EE_Line_Item $ticket_line_item = null |
|
93 | + ) { |
|
94 | + $this->transaction = $transaction; |
|
95 | + $this->ticket = $ticket; |
|
96 | + $this->quantity = min(1, absint($quantity)); |
|
97 | + $this->ticket_line_item = $ticket_line_item; |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * @return \EE_Transaction |
|
104 | + */ |
|
105 | + public function transaction() |
|
106 | + { |
|
107 | + return $this->transaction; |
|
108 | + } |
|
109 | + |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * @return \EE_Ticket |
|
114 | + */ |
|
115 | + public function ticket() |
|
116 | + { |
|
117 | + return $this->ticket; |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @return \EE_Line_Item |
|
124 | + */ |
|
125 | + public function ticketLineItem() |
|
126 | + { |
|
127 | + return $this->ticket_line_item; |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + |
|
132 | + /** |
|
133 | + * @return int |
|
134 | + */ |
|
135 | + public function quantity() |
|
136 | + { |
|
137 | + return $this->quantity; |
|
138 | + } |
|
139 | 139 | |
140 | 140 | |
141 | 141 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\services\commands\CommandInterface; |
8 | 8 | |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -27,42 +27,42 @@ discard block |
||
27 | 27 | { |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
32 | - */ |
|
33 | - private $cancel_ticket_line_item_service; |
|
30 | + /** |
|
31 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
32 | + */ |
|
33 | + private $cancel_ticket_line_item_service; |
|
34 | 34 | |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * Command constructor |
|
39 | - * |
|
40 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
41 | - */ |
|
42 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
43 | - { |
|
44 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
45 | - } |
|
37 | + /** |
|
38 | + * Command constructor |
|
39 | + * |
|
40 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
41 | + */ |
|
42 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
43 | + { |
|
44 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
51 | - * @return mixed |
|
52 | - */ |
|
53 | - public function handle(CommandInterface $command) |
|
54 | - { |
|
55 | - /** @var CancelTicketLineItemCommand $command */ |
|
56 | - if ( ! $command instanceof CancelTicketLineItemCommand) { |
|
57 | - throw new InvalidEntityException(get_class($command), 'CancelTicketLineItemCommand'); |
|
58 | - } |
|
59 | - return $this->cancel_ticket_line_item_service->cancel( |
|
60 | - $command->transaction(), |
|
61 | - $command->ticket(), |
|
62 | - $command->quantity(), |
|
63 | - $command->ticketLineItem() |
|
64 | - ); |
|
65 | - } |
|
49 | + /** |
|
50 | + * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
51 | + * @return mixed |
|
52 | + */ |
|
53 | + public function handle(CommandInterface $command) |
|
54 | + { |
|
55 | + /** @var CancelTicketLineItemCommand $command */ |
|
56 | + if ( ! $command instanceof CancelTicketLineItemCommand) { |
|
57 | + throw new InvalidEntityException(get_class($command), 'CancelTicketLineItemCommand'); |
|
58 | + } |
|
59 | + return $this->cancel_ticket_line_item_service->cancel( |
|
60 | + $command->transaction(), |
|
61 | + $command->ticket(), |
|
62 | + $command->quantity(), |
|
63 | + $command->ticketLineItem() |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | 68 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\services\commands\CommandInterface; |
8 | 8 | |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -25,40 +25,40 @@ discard block |
||
25 | 25 | { |
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @var CopyRegistrationService $copy_registration_service |
|
30 | - */ |
|
31 | - private $copy_registration_service; |
|
28 | + /** |
|
29 | + * @var CopyRegistrationService $copy_registration_service |
|
30 | + */ |
|
31 | + private $copy_registration_service; |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Command constructor |
|
37 | - * |
|
38 | - * @param CopyRegistrationService $copy_registration_service |
|
39 | - */ |
|
40 | - public function __construct(CopyRegistrationService $copy_registration_service) |
|
41 | - { |
|
42 | - $this->copy_registration_service = $copy_registration_service; |
|
43 | - } |
|
35 | + /** |
|
36 | + * Command constructor |
|
37 | + * |
|
38 | + * @param CopyRegistrationService $copy_registration_service |
|
39 | + */ |
|
40 | + public function __construct(CopyRegistrationService $copy_registration_service) |
|
41 | + { |
|
42 | + $this->copy_registration_service = $copy_registration_service; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
49 | - * @return boolean |
|
50 | - */ |
|
51 | - public function handle(CommandInterface $command) |
|
52 | - { |
|
53 | - /** @var CopyRegistrationDetailsCommand $command */ |
|
54 | - if ( ! $command instanceof CopyRegistrationDetailsCommand) { |
|
55 | - throw new InvalidEntityException(get_class($command), 'CopyRegistrationDetailsCommand'); |
|
56 | - } |
|
57 | - return $this->copy_registration_service->copyRegistrationDetails( |
|
58 | - $command->targetRegistration(), |
|
59 | - $command->registrationToCopy() |
|
60 | - ); |
|
61 | - } |
|
47 | + /** |
|
48 | + * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
49 | + * @return boolean |
|
50 | + */ |
|
51 | + public function handle(CommandInterface $command) |
|
52 | + { |
|
53 | + /** @var CopyRegistrationDetailsCommand $command */ |
|
54 | + if ( ! $command instanceof CopyRegistrationDetailsCommand) { |
|
55 | + throw new InvalidEntityException(get_class($command), 'CopyRegistrationDetailsCommand'); |
|
56 | + } |
|
57 | + return $this->copy_registration_service->copyRegistrationDetails( |
|
58 | + $command->targetRegistration(), |
|
59 | + $command->registrationToCopy() |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | 64 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\services\commands\CommandInterface; |
8 | 8 | |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -24,42 +24,42 @@ discard block |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
29 | - */ |
|
30 | - private $cancel_ticket_line_item_service; |
|
31 | - |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * Command constructor |
|
36 | - * |
|
37 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
38 | - */ |
|
39 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
40 | - { |
|
41 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
42 | - } |
|
43 | - |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
48 | - * @return boolean |
|
49 | - */ |
|
50 | - public function handle(CommandInterface $command) |
|
51 | - { |
|
52 | - /** @var CancelRegistrationAndTicketLineItemCommand $command */ |
|
53 | - if ( ! $command instanceof CancelRegistrationAndTicketLineItemCommand) { |
|
54 | - throw new InvalidEntityException(get_class($command), 'CancelRegistrationAndTicketLineItemCommand'); |
|
55 | - } |
|
56 | - $registration = $command->registration(); |
|
57 | - $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
58 | - // cancel original registration |
|
59 | - $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
60 | - $registration->save(); |
|
61 | - return true; |
|
62 | - } |
|
27 | + /** |
|
28 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
29 | + */ |
|
30 | + private $cancel_ticket_line_item_service; |
|
31 | + |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * Command constructor |
|
36 | + * |
|
37 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
38 | + */ |
|
39 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
40 | + { |
|
41 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
42 | + } |
|
43 | + |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
48 | + * @return boolean |
|
49 | + */ |
|
50 | + public function handle(CommandInterface $command) |
|
51 | + { |
|
52 | + /** @var CancelRegistrationAndTicketLineItemCommand $command */ |
|
53 | + if ( ! $command instanceof CancelRegistrationAndTicketLineItemCommand) { |
|
54 | + throw new InvalidEntityException(get_class($command), 'CancelRegistrationAndTicketLineItemCommand'); |
|
55 | + } |
|
56 | + $registration = $command->registration(); |
|
57 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
58 | + // cancel original registration |
|
59 | + $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
60 | + $registration->save(); |
|
61 | + return true; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | 65 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\services\commands\CommandInterface; |
8 | 8 | |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -23,45 +23,45 @@ discard block |
||
23 | 23 | class CreateRegistrationCommandHandler extends CommandHandler |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var CreateRegistrationService $registration_service |
|
28 | - */ |
|
29 | - private $registration_service; |
|
26 | + /** |
|
27 | + * @var CreateRegistrationService $registration_service |
|
28 | + */ |
|
29 | + private $registration_service; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * Command constructor |
|
35 | - * |
|
36 | - * @param CreateRegistrationService $registration_service |
|
37 | - */ |
|
38 | - public function __construct(CreateRegistrationService $registration_service) |
|
39 | - { |
|
40 | - $this->registration_service = $registration_service; |
|
41 | - } |
|
33 | + /** |
|
34 | + * Command constructor |
|
35 | + * |
|
36 | + * @param CreateRegistrationService $registration_service |
|
37 | + */ |
|
38 | + public function __construct(CreateRegistrationService $registration_service) |
|
39 | + { |
|
40 | + $this->registration_service = $registration_service; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @param CommandInterface $command |
|
47 | - * @return mixed |
|
48 | - */ |
|
49 | - public function handle(CommandInterface $command) |
|
50 | - { |
|
51 | - /** @var CreateRegistrationCommand $command */ |
|
52 | - if ( ! $command instanceof CreateRegistrationCommand) { |
|
53 | - throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand'); |
|
54 | - } |
|
55 | - // now create a new registration for the ticket |
|
56 | - return $this->registration_service->create( |
|
57 | - $command->ticket()->get_related_event(), |
|
58 | - $command->transaction(), |
|
59 | - $command->ticket(), |
|
60 | - $command->ticketLineItem(), |
|
61 | - $command->regCount(), |
|
62 | - $command->regGroupSize() |
|
63 | - ); |
|
64 | - } |
|
45 | + /** |
|
46 | + * @param CommandInterface $command |
|
47 | + * @return mixed |
|
48 | + */ |
|
49 | + public function handle(CommandInterface $command) |
|
50 | + { |
|
51 | + /** @var CreateRegistrationCommand $command */ |
|
52 | + if ( ! $command instanceof CreateRegistrationCommand) { |
|
53 | + throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand'); |
|
54 | + } |
|
55 | + // now create a new registration for the ticket |
|
56 | + return $this->registration_service->create( |
|
57 | + $command->ticket()->get_related_event(), |
|
58 | + $command->transaction(), |
|
59 | + $command->ticket(), |
|
60 | + $command->ticketLineItem(), |
|
61 | + $command->regCount(), |
|
62 | + $command->regGroupSize() |
|
63 | + ); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | 67 |