@@ -26,43 +26,43 @@ |
||
26 | 26 | class CreateTransactionCommandHandler extends CommandHandler |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * @param CommandInterface|CreateTransactionCommand $command |
|
31 | - * @return mixed |
|
32 | - * @throws EE_Error |
|
33 | - * @throws InvalidEntityException |
|
34 | - * @throws InvalidDataTypeException |
|
35 | - * @throws InvalidInterfaceException |
|
36 | - * @throws InvalidArgumentException |
|
37 | - * @throws ReflectionException |
|
38 | - * @throws RuntimeException |
|
39 | - */ |
|
40 | - public function handle(CommandInterface $command) |
|
41 | - { |
|
42 | - $transaction_details = $command->transactionDetails(); |
|
43 | - $cart_total = null; |
|
44 | - if ($command->checkout() instanceof EE_Checkout) { |
|
45 | - // ensure cart totals have been calculated |
|
46 | - $command->checkout()->cart->get_grand_total()->recalculate_total_including_taxes(); |
|
47 | - // grab the cart grand total |
|
48 | - $cart_total = $command->checkout()->cart->get_cart_grand_total(); |
|
49 | - $transaction_details['TXN_reg_steps'] = $command->checkout()->initialize_txn_reg_steps_array(); |
|
50 | - $transaction_details['TXN_total'] = $cart_total > 0 ? $cart_total : 0; |
|
51 | - } |
|
52 | - // create new TXN and save it so it has an ID |
|
53 | - $transaction = EE_Transaction::new_instance($transaction_details); |
|
54 | - if (! $transaction instanceof EE_Transaction) { |
|
55 | - throw new InvalidEntityException(get_class($transaction), 'EE_Transaction'); |
|
56 | - } |
|
57 | - $transaction->save(); |
|
58 | - // ensure grand total line item created |
|
59 | - $cart_total = $cart_total instanceof EE_Line_Item |
|
60 | - ? $cart_total |
|
61 | - : EEH_Line_Item::create_total_line_item($transaction); |
|
62 | - if (! $cart_total instanceof EE_Line_Item) { |
|
63 | - throw new InvalidEntityException(get_class($cart_total), 'EE_Line_Item'); |
|
64 | - } |
|
65 | - $cart_total->save_this_and_descendants_to_txn($transaction->ID()); |
|
66 | - return $transaction; |
|
67 | - } |
|
29 | + /** |
|
30 | + * @param CommandInterface|CreateTransactionCommand $command |
|
31 | + * @return mixed |
|
32 | + * @throws EE_Error |
|
33 | + * @throws InvalidEntityException |
|
34 | + * @throws InvalidDataTypeException |
|
35 | + * @throws InvalidInterfaceException |
|
36 | + * @throws InvalidArgumentException |
|
37 | + * @throws ReflectionException |
|
38 | + * @throws RuntimeException |
|
39 | + */ |
|
40 | + public function handle(CommandInterface $command) |
|
41 | + { |
|
42 | + $transaction_details = $command->transactionDetails(); |
|
43 | + $cart_total = null; |
|
44 | + if ($command->checkout() instanceof EE_Checkout) { |
|
45 | + // ensure cart totals have been calculated |
|
46 | + $command->checkout()->cart->get_grand_total()->recalculate_total_including_taxes(); |
|
47 | + // grab the cart grand total |
|
48 | + $cart_total = $command->checkout()->cart->get_cart_grand_total(); |
|
49 | + $transaction_details['TXN_reg_steps'] = $command->checkout()->initialize_txn_reg_steps_array(); |
|
50 | + $transaction_details['TXN_total'] = $cart_total > 0 ? $cart_total : 0; |
|
51 | + } |
|
52 | + // create new TXN and save it so it has an ID |
|
53 | + $transaction = EE_Transaction::new_instance($transaction_details); |
|
54 | + if (! $transaction instanceof EE_Transaction) { |
|
55 | + throw new InvalidEntityException(get_class($transaction), 'EE_Transaction'); |
|
56 | + } |
|
57 | + $transaction->save(); |
|
58 | + // ensure grand total line item created |
|
59 | + $cart_total = $cart_total instanceof EE_Line_Item |
|
60 | + ? $cart_total |
|
61 | + : EEH_Line_Item::create_total_line_item($transaction); |
|
62 | + if (! $cart_total instanceof EE_Line_Item) { |
|
63 | + throw new InvalidEntityException(get_class($cart_total), 'EE_Line_Item'); |
|
64 | + } |
|
65 | + $cart_total->save_this_and_descendants_to_txn($transaction->ID()); |
|
66 | + return $transaction; |
|
67 | + } |
|
68 | 68 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | // create new TXN and save it so it has an ID |
53 | 53 | $transaction = EE_Transaction::new_instance($transaction_details); |
54 | - if (! $transaction instanceof EE_Transaction) { |
|
54 | + if ( ! $transaction instanceof EE_Transaction) { |
|
55 | 55 | throw new InvalidEntityException(get_class($transaction), 'EE_Transaction'); |
56 | 56 | } |
57 | 57 | $transaction->save(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $cart_total = $cart_total instanceof EE_Line_Item |
60 | 60 | ? $cart_total |
61 | 61 | : EEH_Line_Item::create_total_line_item($transaction); |
62 | - if (! $cart_total instanceof EE_Line_Item) { |
|
62 | + if ( ! $cart_total instanceof EE_Line_Item) { |
|
63 | 63 | throw new InvalidEntityException(get_class($cart_total), 'EE_Line_Item'); |
64 | 64 | } |
65 | 65 | $cart_total->save_this_and_descendants_to_txn($transaction->ID()); |
@@ -10,26 +10,26 @@ |
||
10 | 10 | interface CommandHandlerManagerInterface |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * !!! IMPORTANT !!! |
|
15 | - * If overriding the default CommandHandler for a Command, |
|
16 | - * be sure to also override CommandHandler::verify(), |
|
17 | - * or else an Exception will be thrown when the CommandBus |
|
18 | - * attempts to verify that the incoming Command matches the Handler |
|
19 | - * |
|
20 | - * @param CommandHandlerInterface $command_handler |
|
21 | - * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
22 | - * @return void |
|
23 | - * @throws InvalidCommandHandlerException |
|
24 | - */ |
|
25 | - public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
13 | + /** |
|
14 | + * !!! IMPORTANT !!! |
|
15 | + * If overriding the default CommandHandler for a Command, |
|
16 | + * be sure to also override CommandHandler::verify(), |
|
17 | + * or else an Exception will be thrown when the CommandBus |
|
18 | + * attempts to verify that the incoming Command matches the Handler |
|
19 | + * |
|
20 | + * @param CommandHandlerInterface $command_handler |
|
21 | + * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
22 | + * @return void |
|
23 | + * @throws InvalidCommandHandlerException |
|
24 | + */ |
|
25 | + public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @param CommandInterface $command |
|
31 | - * @param CommandBusInterface $command_bus |
|
32 | - * @return mixed |
|
33 | - */ |
|
34 | - public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
29 | + /** |
|
30 | + * @param CommandInterface $command |
|
31 | + * @param CommandBusInterface $command_bus |
|
32 | + * @return mixed |
|
33 | + */ |
|
34 | + public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
35 | 35 | } |
@@ -23,36 +23,36 @@ |
||
23 | 23 | { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
28 | - */ |
|
29 | - private $cancel_ticket_line_item_service; |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * Command constructor |
|
34 | - * |
|
35 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
36 | - */ |
|
37 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
38 | - { |
|
39 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @param CommandInterface|CancelTicketLineItemCommand $command |
|
45 | - * @return mixed |
|
46 | - * @throws InvalidEntityException |
|
47 | - * @throws RuntimeException |
|
48 | - */ |
|
49 | - public function handle(CommandInterface $command) |
|
50 | - { |
|
51 | - return $this->cancel_ticket_line_item_service->cancel( |
|
52 | - $command->transaction(), |
|
53 | - $command->ticket(), |
|
54 | - $command->quantity(), |
|
55 | - $command->ticketLineItem() |
|
56 | - ); |
|
57 | - } |
|
26 | + /** |
|
27 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
28 | + */ |
|
29 | + private $cancel_ticket_line_item_service; |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * Command constructor |
|
34 | + * |
|
35 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
36 | + */ |
|
37 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
38 | + { |
|
39 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @param CommandInterface|CancelTicketLineItemCommand $command |
|
45 | + * @return mixed |
|
46 | + * @throws InvalidEntityException |
|
47 | + * @throws RuntimeException |
|
48 | + */ |
|
49 | + public function handle(CommandInterface $command) |
|
50 | + { |
|
51 | + return $this->cancel_ticket_line_item_service->cancel( |
|
52 | + $command->transaction(), |
|
53 | + $command->ticket(), |
|
54 | + $command->quantity(), |
|
55 | + $command->ticketLineItem() |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | } |
@@ -22,37 +22,37 @@ |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * @var CreateTicketLineItemService $factory |
|
27 | - */ |
|
28 | - private $factory; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * Command constructor |
|
33 | - * |
|
34 | - * @param CreateTicketLineItemService $factory |
|
35 | - */ |
|
36 | - public function __construct(CreateTicketLineItemService $factory) |
|
37 | - { |
|
38 | - $this->factory = $factory; |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @param CommandInterface|CreateTicketLineItemCommand $command |
|
44 | - * @return EE_Line_Item |
|
45 | - * @throws InvalidEntityException |
|
46 | - * @throws UnexpectedEntityException |
|
47 | - * @throws EE_Error |
|
48 | - */ |
|
49 | - public function handle(CommandInterface $command) |
|
50 | - { |
|
51 | - // create new line item for ticket |
|
52 | - return $this->factory->create( |
|
53 | - $command->transaction(), |
|
54 | - $command->ticket(), |
|
55 | - $command->quantity() |
|
56 | - ); |
|
57 | - } |
|
25 | + /** |
|
26 | + * @var CreateTicketLineItemService $factory |
|
27 | + */ |
|
28 | + private $factory; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * Command constructor |
|
33 | + * |
|
34 | + * @param CreateTicketLineItemService $factory |
|
35 | + */ |
|
36 | + public function __construct(CreateTicketLineItemService $factory) |
|
37 | + { |
|
38 | + $this->factory = $factory; |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @param CommandInterface|CreateTicketLineItemCommand $command |
|
44 | + * @return EE_Line_Item |
|
45 | + * @throws InvalidEntityException |
|
46 | + * @throws UnexpectedEntityException |
|
47 | + * @throws EE_Error |
|
48 | + */ |
|
49 | + public function handle(CommandInterface $command) |
|
50 | + { |
|
51 | + // create new line item for ticket |
|
52 | + return $this->factory->create( |
|
53 | + $command->transaction(), |
|
54 | + $command->ticket(), |
|
55 | + $command->quantity() |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | } |
@@ -21,42 +21,42 @@ |
||
21 | 21 | class CreateRegistrationCommandHandler extends CommandHandler |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var CreateRegistrationService $registration_service |
|
26 | - */ |
|
27 | - private $registration_service; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * Command constructor |
|
32 | - * |
|
33 | - * @param CreateRegistrationService $registration_service |
|
34 | - */ |
|
35 | - public function __construct(CreateRegistrationService $registration_service) |
|
36 | - { |
|
37 | - $this->registration_service = $registration_service; |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * @param CommandInterface|CreateRegistrationCommand $command |
|
43 | - * @return mixed |
|
44 | - * @throws OutOfRangeException |
|
45 | - * @throws UnexpectedEntityException |
|
46 | - * @throws EE_Error |
|
47 | - * @throws InvalidEntityException |
|
48 | - */ |
|
49 | - public function handle(CommandInterface $command) |
|
50 | - { |
|
51 | - // now create a new registration for the ticket |
|
52 | - return $this->registration_service->create( |
|
53 | - $command->ticket()->get_related_event(), |
|
54 | - $command->transaction(), |
|
55 | - $command->ticket(), |
|
56 | - $command->ticketLineItem(), |
|
57 | - $command->regCount(), |
|
58 | - $command->regGroupSize(), |
|
59 | - $command->regStatus() |
|
60 | - ); |
|
61 | - } |
|
24 | + /** |
|
25 | + * @var CreateRegistrationService $registration_service |
|
26 | + */ |
|
27 | + private $registration_service; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * Command constructor |
|
32 | + * |
|
33 | + * @param CreateRegistrationService $registration_service |
|
34 | + */ |
|
35 | + public function __construct(CreateRegistrationService $registration_service) |
|
36 | + { |
|
37 | + $this->registration_service = $registration_service; |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * @param CommandInterface|CreateRegistrationCommand $command |
|
43 | + * @return mixed |
|
44 | + * @throws OutOfRangeException |
|
45 | + * @throws UnexpectedEntityException |
|
46 | + * @throws EE_Error |
|
47 | + * @throws InvalidEntityException |
|
48 | + */ |
|
49 | + public function handle(CommandInterface $command) |
|
50 | + { |
|
51 | + // now create a new registration for the ticket |
|
52 | + return $this->registration_service->create( |
|
53 | + $command->ticket()->get_related_event(), |
|
54 | + $command->transaction(), |
|
55 | + $command->ticket(), |
|
56 | + $command->ticketLineItem(), |
|
57 | + $command->regCount(), |
|
58 | + $command->regGroupSize(), |
|
59 | + $command->regStatus() |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | } |
@@ -19,31 +19,31 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * @var UpdateRegistrationService $update_registration_service |
|
24 | - */ |
|
25 | - private $update_registration_service; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * Command constructor |
|
30 | - * |
|
31 | - * @param UpdateRegistrationService $update_registration_service |
|
32 | - */ |
|
33 | - public function __construct( |
|
34 | - UpdateRegistrationService $update_registration_service |
|
35 | - ) { |
|
36 | - $this->update_registration_service = $update_registration_service; |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command |
|
42 | - * @return boolean |
|
43 | - * @throws InvalidEntityException |
|
44 | - */ |
|
45 | - public function handle(CommandInterface $command) |
|
46 | - { |
|
47 | - return $this->update_registration_service->updateRegistrationAndTransaction($command->registration()); |
|
48 | - } |
|
22 | + /** |
|
23 | + * @var UpdateRegistrationService $update_registration_service |
|
24 | + */ |
|
25 | + private $update_registration_service; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * Command constructor |
|
30 | + * |
|
31 | + * @param UpdateRegistrationService $update_registration_service |
|
32 | + */ |
|
33 | + public function __construct( |
|
34 | + UpdateRegistrationService $update_registration_service |
|
35 | + ) { |
|
36 | + $this->update_registration_service = $update_registration_service; |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command |
|
42 | + * @return boolean |
|
43 | + * @throws InvalidEntityException |
|
44 | + */ |
|
45 | + public function handle(CommandInterface $command) |
|
46 | + { |
|
47 | + return $this->update_registration_service->updateRegistrationAndTransaction($command->registration()); |
|
48 | + } |
|
49 | 49 | } |
@@ -23,35 +23,35 @@ |
||
23 | 23 | { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @var CopyRegistrationService $copy_registration_service |
|
28 | - */ |
|
29 | - private $copy_registration_service; |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * Command constructor |
|
34 | - * |
|
35 | - * @param CopyRegistrationService $copy_registration_service |
|
36 | - */ |
|
37 | - public function __construct(CopyRegistrationService $copy_registration_service) |
|
38 | - { |
|
39 | - $this->copy_registration_service = $copy_registration_service; |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @param CommandInterface|CopyRegistrationPaymentsCommand $command |
|
45 | - * @return boolean |
|
46 | - * @throws EE_Error |
|
47 | - * @throws UnexpectedEntityException |
|
48 | - * @throws RuntimeException |
|
49 | - */ |
|
50 | - public function handle(CommandInterface $command) |
|
51 | - { |
|
52 | - return $this->copy_registration_service->copyPaymentDetails( |
|
53 | - $command->targetRegistration(), |
|
54 | - $command->registrationToCopy() |
|
55 | - ); |
|
56 | - } |
|
26 | + /** |
|
27 | + * @var CopyRegistrationService $copy_registration_service |
|
28 | + */ |
|
29 | + private $copy_registration_service; |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * Command constructor |
|
34 | + * |
|
35 | + * @param CopyRegistrationService $copy_registration_service |
|
36 | + */ |
|
37 | + public function __construct(CopyRegistrationService $copy_registration_service) |
|
38 | + { |
|
39 | + $this->copy_registration_service = $copy_registration_service; |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @param CommandInterface|CopyRegistrationPaymentsCommand $command |
|
45 | + * @return boolean |
|
46 | + * @throws EE_Error |
|
47 | + * @throws UnexpectedEntityException |
|
48 | + * @throws RuntimeException |
|
49 | + */ |
|
50 | + public function handle(CommandInterface $command) |
|
51 | + { |
|
52 | + return $this->copy_registration_service->copyPaymentDetails( |
|
53 | + $command->targetRegistration(), |
|
54 | + $command->registrationToCopy() |
|
55 | + ); |
|
56 | + } |
|
57 | 57 | } |
@@ -28,43 +28,43 @@ |
||
28 | 28 | { |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
33 | - */ |
|
34 | - private $cancel_ticket_line_item_service; |
|
31 | + /** |
|
32 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
33 | + */ |
|
34 | + private $cancel_ticket_line_item_service; |
|
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 | - /** |
|
49 | - * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command |
|
50 | - * @return boolean |
|
51 | - * @throws DomainException |
|
52 | - * @throws EE_Error |
|
53 | - * @throws EntityNotFoundException |
|
54 | - * @throws InvalidDataTypeException |
|
55 | - * @throws InvalidInterfaceException |
|
56 | - * @throws UnexpectedEntityException |
|
57 | - * @throws InvalidArgumentException |
|
58 | - * @throws ReflectionException |
|
59 | - * @throws RuntimeException |
|
60 | - */ |
|
61 | - public function handle(CommandInterface $command) |
|
62 | - { |
|
63 | - $registration = $command->registration(); |
|
64 | - $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
65 | - // cancel original registration |
|
66 | - $registration->set_status(EEM_Registration::status_id_cancelled); |
|
67 | - $registration->save(); |
|
68 | - return true; |
|
69 | - } |
|
48 | + /** |
|
49 | + * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command |
|
50 | + * @return boolean |
|
51 | + * @throws DomainException |
|
52 | + * @throws EE_Error |
|
53 | + * @throws EntityNotFoundException |
|
54 | + * @throws InvalidDataTypeException |
|
55 | + * @throws InvalidInterfaceException |
|
56 | + * @throws UnexpectedEntityException |
|
57 | + * @throws InvalidArgumentException |
|
58 | + * @throws ReflectionException |
|
59 | + * @throws RuntimeException |
|
60 | + */ |
|
61 | + public function handle(CommandInterface $command) |
|
62 | + { |
|
63 | + $registration = $command->registration(); |
|
64 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
65 | + // cancel original registration |
|
66 | + $registration->set_status(EEM_Registration::status_id_cancelled); |
|
67 | + $registration->save(); |
|
68 | + return true; |
|
69 | + } |
|
70 | 70 | } |
@@ -24,37 +24,37 @@ |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @var CopyRegistrationService $copy_registration_service |
|
29 | - */ |
|
30 | - private $copy_registration_service; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Command constructor |
|
35 | - * |
|
36 | - * @param CopyRegistrationService $copy_registration_service |
|
37 | - */ |
|
38 | - public function __construct(CopyRegistrationService $copy_registration_service) |
|
39 | - { |
|
40 | - $this->copy_registration_service = $copy_registration_service; |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * @param CommandInterface|CopyRegistrationDetailsCommand $command |
|
46 | - * @return boolean |
|
47 | - * @throws InvalidEntityException |
|
48 | - * @throws EE_Error |
|
49 | - * @throws EntityNotFoundException |
|
50 | - * @throws UnexpectedEntityException |
|
51 | - * @throws RuntimeException |
|
52 | - */ |
|
53 | - public function handle(CommandInterface $command) |
|
54 | - { |
|
55 | - return $this->copy_registration_service->copyRegistrationDetails( |
|
56 | - $command->targetRegistration(), |
|
57 | - $command->registrationToCopy() |
|
58 | - ); |
|
59 | - } |
|
27 | + /** |
|
28 | + * @var CopyRegistrationService $copy_registration_service |
|
29 | + */ |
|
30 | + private $copy_registration_service; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Command constructor |
|
35 | + * |
|
36 | + * @param CopyRegistrationService $copy_registration_service |
|
37 | + */ |
|
38 | + public function __construct(CopyRegistrationService $copy_registration_service) |
|
39 | + { |
|
40 | + $this->copy_registration_service = $copy_registration_service; |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * @param CommandInterface|CopyRegistrationDetailsCommand $command |
|
46 | + * @return boolean |
|
47 | + * @throws InvalidEntityException |
|
48 | + * @throws EE_Error |
|
49 | + * @throws EntityNotFoundException |
|
50 | + * @throws UnexpectedEntityException |
|
51 | + * @throws RuntimeException |
|
52 | + */ |
|
53 | + public function handle(CommandInterface $command) |
|
54 | + { |
|
55 | + return $this->copy_registration_service->copyRegistrationDetails( |
|
56 | + $command->targetRegistration(), |
|
57 | + $command->registrationToCopy() |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | } |