@@ -16,29 +16,29 @@ |
||
| 16 | 16 | { |
| 17 | 17 | |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var \EE_Registration $registration |
|
| 21 | - */ |
|
| 22 | - private $registration; |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * CancelRegistrationAndTicketLineItemCommand constructor. |
|
| 27 | - * |
|
| 28 | - * @param \EE_Registration $registration |
|
| 29 | - */ |
|
| 30 | - public function __construct( |
|
| 31 | - \EE_Registration $registration |
|
| 32 | - ) { |
|
| 33 | - $this->registration = $registration; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @return \EE_Registration |
|
| 39 | - */ |
|
| 40 | - public function registration() |
|
| 41 | - { |
|
| 42 | - return $this->registration; |
|
| 43 | - } |
|
| 19 | + /** |
|
| 20 | + * @var \EE_Registration $registration |
|
| 21 | + */ |
|
| 22 | + private $registration; |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * CancelRegistrationAndTicketLineItemCommand constructor. |
|
| 27 | + * |
|
| 28 | + * @param \EE_Registration $registration |
|
| 29 | + */ |
|
| 30 | + public function __construct( |
|
| 31 | + \EE_Registration $registration |
|
| 32 | + ) { |
|
| 33 | + $this->registration = $registration; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @return \EE_Registration |
|
| 39 | + */ |
|
| 40 | + public function registration() |
|
| 41 | + { |
|
| 42 | + return $this->registration; |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -16,48 +16,48 @@ |
||
| 16 | 16 | { |
| 17 | 17 | |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var \EE_Registration $target_registration |
|
| 21 | - */ |
|
| 22 | - private $target_registration; |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var \EE_Registration $registration_to_copy |
|
| 27 | - */ |
|
| 28 | - private $registration_to_copy; |
|
| 29 | - |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * CopyRegistrationDetailsCommand constructor. |
|
| 33 | - * |
|
| 34 | - * @param \EE_Registration $target_registration |
|
| 35 | - * @param \EE_Registration $registration_to_copy |
|
| 36 | - * v |
|
| 37 | - */ |
|
| 38 | - public function __construct( |
|
| 39 | - \EE_Registration $target_registration, |
|
| 40 | - \EE_Registration $registration_to_copy |
|
| 41 | - ) { |
|
| 42 | - $this->target_registration = $target_registration; |
|
| 43 | - $this->registration_to_copy = $registration_to_copy; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @return \EE_Registration |
|
| 49 | - */ |
|
| 50 | - public function targetRegistration() |
|
| 51 | - { |
|
| 52 | - return $this->target_registration; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * @return \EE_Registration |
|
| 58 | - */ |
|
| 59 | - public function registrationToCopy() |
|
| 60 | - { |
|
| 61 | - return $this->registration_to_copy; |
|
| 62 | - } |
|
| 19 | + /** |
|
| 20 | + * @var \EE_Registration $target_registration |
|
| 21 | + */ |
|
| 22 | + private $target_registration; |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var \EE_Registration $registration_to_copy |
|
| 27 | + */ |
|
| 28 | + private $registration_to_copy; |
|
| 29 | + |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * CopyRegistrationDetailsCommand constructor. |
|
| 33 | + * |
|
| 34 | + * @param \EE_Registration $target_registration |
|
| 35 | + * @param \EE_Registration $registration_to_copy |
|
| 36 | + * v |
|
| 37 | + */ |
|
| 38 | + public function __construct( |
|
| 39 | + \EE_Registration $target_registration, |
|
| 40 | + \EE_Registration $registration_to_copy |
|
| 41 | + ) { |
|
| 42 | + $this->target_registration = $target_registration; |
|
| 43 | + $this->registration_to_copy = $registration_to_copy; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @return \EE_Registration |
|
| 49 | + */ |
|
| 50 | + public function targetRegistration() |
|
| 51 | + { |
|
| 52 | + return $this->target_registration; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @return \EE_Registration |
|
| 58 | + */ |
|
| 59 | + public function registrationToCopy() |
|
| 60 | + { |
|
| 61 | + return $this->registration_to_copy; |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ) { |
| 80 | 80 | // grab the related ticket object for this line_item |
| 81 | 81 | $this->ticket = $ticket_line_item->ticket(); |
| 82 | - if (! $this->ticket instanceof EE_Ticket) { |
|
| 82 | + if ( ! $this->ticket instanceof EE_Ticket) { |
|
| 83 | 83 | throw new InvalidEntityException( |
| 84 | 84 | is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
| 85 | 85 | 'EE_Ticket', |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function getCapCheck() |
| 105 | 105 | { |
| 106 | - if (! $this->cap_check instanceof CapCheckInterface) { |
|
| 106 | + if ( ! $this->cap_check instanceof CapCheckInterface) { |
|
| 107 | 107 | return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
| 108 | 108 | } |
| 109 | 109 | return $this->cap_check; |
@@ -24,151 +24,151 @@ |
||
| 24 | 24 | class CreateRegistrationCommand extends Command implements CommandRequiresCapCheckInterface |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var EE_Transaction $transaction |
|
| 29 | - */ |
|
| 30 | - private $transaction; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var EE_Ticket $ticket |
|
| 34 | - */ |
|
| 35 | - private $ticket; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var EE_Line_Item $ticket_line_item |
|
| 39 | - */ |
|
| 40 | - private $ticket_line_item; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var int $reg_count |
|
| 44 | - */ |
|
| 45 | - private $reg_count; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @var int $reg_group_size |
|
| 49 | - */ |
|
| 50 | - private $reg_group_size; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @var string $reg_status |
|
| 54 | - */ |
|
| 55 | - private $reg_status; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * @var EE_Registration $registration |
|
| 59 | - */ |
|
| 60 | - protected $registration; |
|
| 61 | - |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * CreateRegistrationCommand constructor. |
|
| 65 | - * |
|
| 66 | - * @param EE_Transaction $transaction |
|
| 67 | - * @param EE_Line_Item $ticket_line_item |
|
| 68 | - * @param int $reg_count |
|
| 69 | - * @param int $reg_group_size |
|
| 70 | - * @param string $reg_status |
|
| 71 | - * @throws InvalidEntityException |
|
| 72 | - */ |
|
| 73 | - public function __construct( |
|
| 74 | - EE_Transaction $transaction, |
|
| 75 | - EE_Line_Item $ticket_line_item, |
|
| 76 | - $reg_count = 1, |
|
| 77 | - $reg_group_size = 0, |
|
| 78 | - $reg_status = EEM_Registration::status_id_incomplete |
|
| 79 | - ) { |
|
| 80 | - // grab the related ticket object for this line_item |
|
| 81 | - $this->ticket = $ticket_line_item->ticket(); |
|
| 82 | - if (! $this->ticket instanceof EE_Ticket) { |
|
| 83 | - throw new InvalidEntityException( |
|
| 84 | - is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
|
| 85 | - 'EE_Ticket', |
|
| 86 | - sprintf( |
|
| 87 | - esc_html__('Line item %s did not contain a valid ticket', 'event_espresso'), |
|
| 88 | - $ticket_line_item->ID() |
|
| 89 | - ) |
|
| 90 | - ); |
|
| 91 | - } |
|
| 92 | - $this->transaction = $transaction; |
|
| 93 | - $this->ticket_line_item = $ticket_line_item; |
|
| 94 | - $this->reg_count = absint($reg_count); |
|
| 95 | - $this->reg_group_size = absint($reg_group_size); |
|
| 96 | - $this->reg_status = $reg_status; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface |
|
| 102 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
| 103 | - */ |
|
| 104 | - public function getCapCheck() |
|
| 105 | - { |
|
| 106 | - if (! $this->cap_check instanceof CapCheckInterface) { |
|
| 107 | - return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
|
| 108 | - } |
|
| 109 | - return $this->cap_check; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * @return EE_Transaction |
|
| 115 | - */ |
|
| 116 | - public function transaction() |
|
| 117 | - { |
|
| 118 | - return $this->transaction; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * @return EE_Ticket |
|
| 124 | - */ |
|
| 125 | - public function ticket() |
|
| 126 | - { |
|
| 127 | - return $this->ticket; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * @return EE_Line_Item |
|
| 133 | - */ |
|
| 134 | - public function ticketLineItem() |
|
| 135 | - { |
|
| 136 | - return $this->ticket_line_item; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * @return int |
|
| 142 | - */ |
|
| 143 | - public function regCount() |
|
| 144 | - { |
|
| 145 | - return $this->reg_count; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * @return int |
|
| 151 | - */ |
|
| 152 | - public function regGroupSize() |
|
| 153 | - { |
|
| 154 | - return $this->reg_group_size; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * @return string |
|
| 160 | - */ |
|
| 161 | - public function regStatus() |
|
| 162 | - { |
|
| 163 | - return $this->reg_status; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * @return EE_Registration |
|
| 169 | - */ |
|
| 170 | - public function registration() |
|
| 171 | - { |
|
| 172 | - return $this->registration; |
|
| 173 | - } |
|
| 27 | + /** |
|
| 28 | + * @var EE_Transaction $transaction |
|
| 29 | + */ |
|
| 30 | + private $transaction; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var EE_Ticket $ticket |
|
| 34 | + */ |
|
| 35 | + private $ticket; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var EE_Line_Item $ticket_line_item |
|
| 39 | + */ |
|
| 40 | + private $ticket_line_item; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var int $reg_count |
|
| 44 | + */ |
|
| 45 | + private $reg_count; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @var int $reg_group_size |
|
| 49 | + */ |
|
| 50 | + private $reg_group_size; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @var string $reg_status |
|
| 54 | + */ |
|
| 55 | + private $reg_status; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @var EE_Registration $registration |
|
| 59 | + */ |
|
| 60 | + protected $registration; |
|
| 61 | + |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * CreateRegistrationCommand constructor. |
|
| 65 | + * |
|
| 66 | + * @param EE_Transaction $transaction |
|
| 67 | + * @param EE_Line_Item $ticket_line_item |
|
| 68 | + * @param int $reg_count |
|
| 69 | + * @param int $reg_group_size |
|
| 70 | + * @param string $reg_status |
|
| 71 | + * @throws InvalidEntityException |
|
| 72 | + */ |
|
| 73 | + public function __construct( |
|
| 74 | + EE_Transaction $transaction, |
|
| 75 | + EE_Line_Item $ticket_line_item, |
|
| 76 | + $reg_count = 1, |
|
| 77 | + $reg_group_size = 0, |
|
| 78 | + $reg_status = EEM_Registration::status_id_incomplete |
|
| 79 | + ) { |
|
| 80 | + // grab the related ticket object for this line_item |
|
| 81 | + $this->ticket = $ticket_line_item->ticket(); |
|
| 82 | + if (! $this->ticket instanceof EE_Ticket) { |
|
| 83 | + throw new InvalidEntityException( |
|
| 84 | + is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
|
| 85 | + 'EE_Ticket', |
|
| 86 | + sprintf( |
|
| 87 | + esc_html__('Line item %s did not contain a valid ticket', 'event_espresso'), |
|
| 88 | + $ticket_line_item->ID() |
|
| 89 | + ) |
|
| 90 | + ); |
|
| 91 | + } |
|
| 92 | + $this->transaction = $transaction; |
|
| 93 | + $this->ticket_line_item = $ticket_line_item; |
|
| 94 | + $this->reg_count = absint($reg_count); |
|
| 95 | + $this->reg_group_size = absint($reg_group_size); |
|
| 96 | + $this->reg_status = $reg_status; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface |
|
| 102 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
| 103 | + */ |
|
| 104 | + public function getCapCheck() |
|
| 105 | + { |
|
| 106 | + if (! $this->cap_check instanceof CapCheckInterface) { |
|
| 107 | + return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
|
| 108 | + } |
|
| 109 | + return $this->cap_check; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * @return EE_Transaction |
|
| 115 | + */ |
|
| 116 | + public function transaction() |
|
| 117 | + { |
|
| 118 | + return $this->transaction; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * @return EE_Ticket |
|
| 124 | + */ |
|
| 125 | + public function ticket() |
|
| 126 | + { |
|
| 127 | + return $this->ticket; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * @return EE_Line_Item |
|
| 133 | + */ |
|
| 134 | + public function ticketLineItem() |
|
| 135 | + { |
|
| 136 | + return $this->ticket_line_item; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @return int |
|
| 142 | + */ |
|
| 143 | + public function regCount() |
|
| 144 | + { |
|
| 145 | + return $this->reg_count; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @return int |
|
| 151 | + */ |
|
| 152 | + public function regGroupSize() |
|
| 153 | + { |
|
| 154 | + return $this->reg_group_size; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * @return string |
|
| 160 | + */ |
|
| 161 | + public function regStatus() |
|
| 162 | + { |
|
| 163 | + return $this->reg_status; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * @return EE_Registration |
|
| 169 | + */ |
|
| 170 | + public function registration() |
|
| 171 | + { |
|
| 172 | + return $this->registration; |
|
| 173 | + } |
|
| 174 | 174 | } |
@@ -15,22 +15,22 @@ |
||
| 15 | 15 | class AddActionHook implements CommandBusMiddlewareInterface |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @param CommandInterface $command |
|
| 20 | - * @param Closure $next |
|
| 21 | - * @return mixed |
|
| 22 | - */ |
|
| 23 | - public function handle(CommandInterface $command, Closure $next) |
|
| 24 | - { |
|
| 25 | - do_action( |
|
| 26 | - 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__before', |
|
| 27 | - $command |
|
| 28 | - ); |
|
| 29 | - $results = $next($command); |
|
| 30 | - do_action( |
|
| 31 | - 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__after', |
|
| 32 | - $command |
|
| 33 | - ); |
|
| 34 | - return $results; |
|
| 35 | - } |
|
| 18 | + /** |
|
| 19 | + * @param CommandInterface $command |
|
| 20 | + * @param Closure $next |
|
| 21 | + * @return mixed |
|
| 22 | + */ |
|
| 23 | + public function handle(CommandInterface $command, Closure $next) |
|
| 24 | + { |
|
| 25 | + do_action( |
|
| 26 | + 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__before', |
|
| 27 | + $command |
|
| 28 | + ); |
|
| 29 | + $results = $next($command); |
|
| 30 | + do_action( |
|
| 31 | + 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__after', |
|
| 32 | + $command |
|
| 33 | + ); |
|
| 34 | + return $results; |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -24,37 +24,37 @@ |
||
| 24 | 24 | class CapChecker implements CommandBusMiddlewareInterface |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @type CapabilitiesCheckerInterface $capabilities_checker |
|
| 29 | - */ |
|
| 30 | - private $capabilities_checker; |
|
| 31 | - |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * CapChecker constructor |
|
| 35 | - * |
|
| 36 | - * @param CapabilitiesCheckerInterface $capabilities_checker |
|
| 37 | - */ |
|
| 38 | - public function __construct(CapabilitiesCheckerInterface $capabilities_checker) |
|
| 39 | - { |
|
| 40 | - $this->capabilities_checker = $capabilities_checker; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @param CommandInterface $command |
|
| 46 | - * @param Closure $next |
|
| 47 | - * @return mixed |
|
| 48 | - * @throws InvalidClassException |
|
| 49 | - * @throws InsufficientPermissionsException |
|
| 50 | - */ |
|
| 51 | - public function handle(CommandInterface $command, Closure $next) |
|
| 52 | - { |
|
| 53 | - if ($command instanceof CommandRequiresCapCheckInterface) { |
|
| 54 | - $this->capabilities_checker->processCapCheck( |
|
| 55 | - $command->getCapCheck() |
|
| 56 | - ); |
|
| 57 | - } |
|
| 58 | - return $next($command); |
|
| 59 | - } |
|
| 27 | + /** |
|
| 28 | + * @type CapabilitiesCheckerInterface $capabilities_checker |
|
| 29 | + */ |
|
| 30 | + private $capabilities_checker; |
|
| 31 | + |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * CapChecker constructor |
|
| 35 | + * |
|
| 36 | + * @param CapabilitiesCheckerInterface $capabilities_checker |
|
| 37 | + */ |
|
| 38 | + public function __construct(CapabilitiesCheckerInterface $capabilities_checker) |
|
| 39 | + { |
|
| 40 | + $this->capabilities_checker = $capabilities_checker; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @param CommandInterface $command |
|
| 46 | + * @param Closure $next |
|
| 47 | + * @return mixed |
|
| 48 | + * @throws InvalidClassException |
|
| 49 | + * @throws InsufficientPermissionsException |
|
| 50 | + */ |
|
| 51 | + public function handle(CommandInterface $command, Closure $next) |
|
| 52 | + { |
|
| 53 | + if ($command instanceof CommandRequiresCapCheckInterface) { |
|
| 54 | + $this->capabilities_checker->processCapCheck( |
|
| 55 | + $command->getCapCheck() |
|
| 56 | + ); |
|
| 57 | + } |
|
| 58 | + return $next($command); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -16,112 +16,112 @@ |
||
| 16 | 16 | { |
| 17 | 17 | |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var \EE_Transaction $transaction |
|
| 21 | - */ |
|
| 22 | - private $transaction; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @var \EE_Ticket $ticket |
|
| 26 | - */ |
|
| 27 | - private $ticket; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var \EE_Line_Item $ticket_line_item |
|
| 31 | - */ |
|
| 32 | - protected $ticket_line_item; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var int $quantity |
|
| 36 | - */ |
|
| 37 | - protected $quantity; |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @param \EE_Registration $registration |
|
| 42 | - * @param int $quantity |
|
| 43 | - */ |
|
| 44 | - public static function fromRegistration(\EE_Registration $registration, $quantity = 1) |
|
| 45 | - { |
|
| 46 | - new self( |
|
| 47 | - $registration->transaction(), |
|
| 48 | - $registration->ticket(), |
|
| 49 | - 1, |
|
| 50 | - $registration->ticket_line_item() |
|
| 51 | - ); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @param \EE_Line_Item $ticket_line_item |
|
| 57 | - * @param int $quantity |
|
| 58 | - */ |
|
| 59 | - public static function fromTicketLineItem( |
|
| 60 | - \EE_Line_Item $ticket_line_item, |
|
| 61 | - $quantity = 1 |
|
| 62 | - ) { |
|
| 63 | - new self( |
|
| 64 | - $ticket_line_item->transaction(), |
|
| 65 | - $ticket_line_item->ticket(), |
|
| 66 | - $quantity, |
|
| 67 | - $ticket_line_item |
|
| 68 | - ); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * CancelTicketLineItemCommand constructor. |
|
| 74 | - * |
|
| 75 | - * @param \EE_Transaction $transaction |
|
| 76 | - * @param \EE_Ticket $ticket |
|
| 77 | - * @param int $quantity |
|
| 78 | - * @param \EE_Line_Item $ticket_line_item |
|
| 79 | - */ |
|
| 80 | - public function __construct( |
|
| 81 | - \EE_Transaction $transaction, |
|
| 82 | - \EE_Ticket $ticket, |
|
| 83 | - $quantity = 1, |
|
| 84 | - \EE_Line_Item $ticket_line_item = null |
|
| 85 | - ) { |
|
| 86 | - $this->transaction = $transaction; |
|
| 87 | - $this->ticket = $ticket; |
|
| 88 | - $this->quantity = min(1, absint($quantity)); |
|
| 89 | - $this->ticket_line_item = $ticket_line_item; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * @return \EE_Transaction |
|
| 95 | - */ |
|
| 96 | - public function transaction() |
|
| 97 | - { |
|
| 98 | - return $this->transaction; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @return \EE_Ticket |
|
| 104 | - */ |
|
| 105 | - public function ticket() |
|
| 106 | - { |
|
| 107 | - return $this->ticket; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @return \EE_Line_Item |
|
| 113 | - */ |
|
| 114 | - public function ticketLineItem() |
|
| 115 | - { |
|
| 116 | - return $this->ticket_line_item; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @return int |
|
| 122 | - */ |
|
| 123 | - public function quantity() |
|
| 124 | - { |
|
| 125 | - return $this->quantity; |
|
| 126 | - } |
|
| 19 | + /** |
|
| 20 | + * @var \EE_Transaction $transaction |
|
| 21 | + */ |
|
| 22 | + private $transaction; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @var \EE_Ticket $ticket |
|
| 26 | + */ |
|
| 27 | + private $ticket; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var \EE_Line_Item $ticket_line_item |
|
| 31 | + */ |
|
| 32 | + protected $ticket_line_item; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var int $quantity |
|
| 36 | + */ |
|
| 37 | + protected $quantity; |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @param \EE_Registration $registration |
|
| 42 | + * @param int $quantity |
|
| 43 | + */ |
|
| 44 | + public static function fromRegistration(\EE_Registration $registration, $quantity = 1) |
|
| 45 | + { |
|
| 46 | + new self( |
|
| 47 | + $registration->transaction(), |
|
| 48 | + $registration->ticket(), |
|
| 49 | + 1, |
|
| 50 | + $registration->ticket_line_item() |
|
| 51 | + ); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @param \EE_Line_Item $ticket_line_item |
|
| 57 | + * @param int $quantity |
|
| 58 | + */ |
|
| 59 | + public static function fromTicketLineItem( |
|
| 60 | + \EE_Line_Item $ticket_line_item, |
|
| 61 | + $quantity = 1 |
|
| 62 | + ) { |
|
| 63 | + new self( |
|
| 64 | + $ticket_line_item->transaction(), |
|
| 65 | + $ticket_line_item->ticket(), |
|
| 66 | + $quantity, |
|
| 67 | + $ticket_line_item |
|
| 68 | + ); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * CancelTicketLineItemCommand constructor. |
|
| 74 | + * |
|
| 75 | + * @param \EE_Transaction $transaction |
|
| 76 | + * @param \EE_Ticket $ticket |
|
| 77 | + * @param int $quantity |
|
| 78 | + * @param \EE_Line_Item $ticket_line_item |
|
| 79 | + */ |
|
| 80 | + public function __construct( |
|
| 81 | + \EE_Transaction $transaction, |
|
| 82 | + \EE_Ticket $ticket, |
|
| 83 | + $quantity = 1, |
|
| 84 | + \EE_Line_Item $ticket_line_item = null |
|
| 85 | + ) { |
|
| 86 | + $this->transaction = $transaction; |
|
| 87 | + $this->ticket = $ticket; |
|
| 88 | + $this->quantity = min(1, absint($quantity)); |
|
| 89 | + $this->ticket_line_item = $ticket_line_item; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * @return \EE_Transaction |
|
| 95 | + */ |
|
| 96 | + public function transaction() |
|
| 97 | + { |
|
| 98 | + return $this->transaction; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @return \EE_Ticket |
|
| 104 | + */ |
|
| 105 | + public function ticket() |
|
| 106 | + { |
|
| 107 | + return $this->ticket; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @return \EE_Line_Item |
|
| 113 | + */ |
|
| 114 | + public function ticketLineItem() |
|
| 115 | + { |
|
| 116 | + return $this->ticket_line_item; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @return int |
|
| 122 | + */ |
|
| 123 | + public function quantity() |
|
| 124 | + { |
|
| 125 | + return $this->quantity; |
|
| 126 | + } |
|
| 127 | 127 | } |
@@ -16,77 +16,77 @@ |
||
| 16 | 16 | { |
| 17 | 17 | |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var \EE_Transaction $transaction |
|
| 21 | - */ |
|
| 22 | - private $transaction; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @var \EE_Ticket $ticket |
|
| 26 | - */ |
|
| 27 | - private $ticket; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var int $quantity |
|
| 31 | - */ |
|
| 32 | - private $quantity = 1; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var \EE_Line_Item $ticket_line_item |
|
| 36 | - */ |
|
| 37 | - protected $ticket_line_item; |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * CreateTicketLineItemCommand constructor. |
|
| 42 | - * |
|
| 43 | - * @param \EE_Transaction $transaction |
|
| 44 | - * @param \EE_Ticket $ticket |
|
| 45 | - * @param int $quantity |
|
| 46 | - */ |
|
| 47 | - public function __construct( |
|
| 48 | - \EE_Transaction $transaction, |
|
| 49 | - \EE_Ticket $ticket, |
|
| 50 | - $quantity = 1 |
|
| 51 | - ) { |
|
| 52 | - $this->transaction = $transaction; |
|
| 53 | - $this->ticket = $ticket; |
|
| 54 | - $this->quantity = $quantity; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @return \EE_Transaction |
|
| 60 | - */ |
|
| 61 | - public function transaction() |
|
| 62 | - { |
|
| 63 | - return $this->transaction; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * @return \EE_Ticket |
|
| 69 | - */ |
|
| 70 | - public function ticket() |
|
| 71 | - { |
|
| 72 | - return $this->ticket; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * @return int |
|
| 78 | - */ |
|
| 79 | - public function quantity() |
|
| 80 | - { |
|
| 81 | - return $this->quantity; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * @return \EE_Line_Item |
|
| 87 | - */ |
|
| 88 | - public function ticketLineItem() |
|
| 89 | - { |
|
| 90 | - return $this->ticket_line_item; |
|
| 91 | - } |
|
| 19 | + /** |
|
| 20 | + * @var \EE_Transaction $transaction |
|
| 21 | + */ |
|
| 22 | + private $transaction; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @var \EE_Ticket $ticket |
|
| 26 | + */ |
|
| 27 | + private $ticket; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var int $quantity |
|
| 31 | + */ |
|
| 32 | + private $quantity = 1; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var \EE_Line_Item $ticket_line_item |
|
| 36 | + */ |
|
| 37 | + protected $ticket_line_item; |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * CreateTicketLineItemCommand constructor. |
|
| 42 | + * |
|
| 43 | + * @param \EE_Transaction $transaction |
|
| 44 | + * @param \EE_Ticket $ticket |
|
| 45 | + * @param int $quantity |
|
| 46 | + */ |
|
| 47 | + public function __construct( |
|
| 48 | + \EE_Transaction $transaction, |
|
| 49 | + \EE_Ticket $ticket, |
|
| 50 | + $quantity = 1 |
|
| 51 | + ) { |
|
| 52 | + $this->transaction = $transaction; |
|
| 53 | + $this->ticket = $ticket; |
|
| 54 | + $this->quantity = $quantity; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @return \EE_Transaction |
|
| 60 | + */ |
|
| 61 | + public function transaction() |
|
| 62 | + { |
|
| 63 | + return $this->transaction; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @return \EE_Ticket |
|
| 69 | + */ |
|
| 70 | + public function ticket() |
|
| 71 | + { |
|
| 72 | + return $this->ticket; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * @return int |
|
| 78 | + */ |
|
| 79 | + public function quantity() |
|
| 80 | + { |
|
| 81 | + return $this->quantity; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * @return \EE_Line_Item |
|
| 87 | + */ |
|
| 88 | + public function ticketLineItem() |
|
| 89 | + { |
|
| 90 | + return $this->ticket_line_item; |
|
| 91 | + } |
|
| 92 | 92 | } |
@@ -14,10 +14,10 @@ |
||
| 14 | 14 | abstract class FormHtmlFilter |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @param $html |
|
| 19 | - * @param EE_Form_Section_Validatable $form_section |
|
| 20 | - * @return string |
|
| 21 | - */ |
|
| 22 | - abstract public function filterHtml($html, EE_Form_Section_Validatable $form_section); |
|
| 17 | + /** |
|
| 18 | + * @param $html |
|
| 19 | + * @param EE_Form_Section_Validatable $form_section |
|
| 20 | + * @return string |
|
| 21 | + */ |
|
| 22 | + abstract public function filterHtml($html, EE_Form_Section_Validatable $form_section); |
|
| 23 | 23 | } |
@@ -12,49 +12,49 @@ |
||
| 12 | 12 | class EventListIframeEmbedButton extends IframeEmbedButton |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * EventListIframeEmbedButton constructor. |
|
| 17 | - */ |
|
| 18 | - public function __construct() |
|
| 19 | - { |
|
| 20 | - parent::__construct( |
|
| 21 | - esc_html__('Upcoming Event List', 'event_espresso'), |
|
| 22 | - 'event_list' |
|
| 23 | - ); |
|
| 24 | - } |
|
| 15 | + /** |
|
| 16 | + * EventListIframeEmbedButton constructor. |
|
| 17 | + */ |
|
| 18 | + public function __construct() |
|
| 19 | + { |
|
| 20 | + parent::__construct( |
|
| 21 | + esc_html__('Upcoming Event List', 'event_espresso'), |
|
| 22 | + 'event_list' |
|
| 23 | + ); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | - public function addEmbedButton() |
|
| 28 | - { |
|
| 29 | - add_filter( |
|
| 30 | - 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array', |
|
| 31 | - array($this, 'addEventListIframeEmbedButtonSection') |
|
| 32 | - ); |
|
| 33 | - add_action( |
|
| 34 | - 'admin_enqueue_scripts', |
|
| 35 | - array($this, 'embedButtonAssets'), |
|
| 36 | - 10 |
|
| 37 | - ); |
|
| 38 | - } |
|
| 27 | + public function addEmbedButton() |
|
| 28 | + { |
|
| 29 | + add_filter( |
|
| 30 | + 'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array', |
|
| 31 | + array($this, 'addEventListIframeEmbedButtonSection') |
|
| 32 | + ); |
|
| 33 | + add_action( |
|
| 34 | + 'admin_enqueue_scripts', |
|
| 35 | + array($this, 'embedButtonAssets'), |
|
| 36 | + 10 |
|
| 37 | + ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Adds an iframe embed code button to the Event editor. |
|
| 43 | - * return string |
|
| 44 | - * |
|
| 45 | - * @param array $after_list_table |
|
| 46 | - * @return array |
|
| 47 | - */ |
|
| 48 | - public function addEventListIframeEmbedButtonSection(array $after_list_table) |
|
| 49 | - { |
|
| 50 | - return \EEH_Array::insert_into_array( |
|
| 51 | - $after_list_table, |
|
| 52 | - array( |
|
| 53 | - 'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection( |
|
| 54 | - array('event_list' => $this->embedButtonHtml()) |
|
| 55 | - ), |
|
| 56 | - ), |
|
| 57 | - 'legend' |
|
| 58 | - ); |
|
| 59 | - } |
|
| 41 | + /** |
|
| 42 | + * Adds an iframe embed code button to the Event editor. |
|
| 43 | + * return string |
|
| 44 | + * |
|
| 45 | + * @param array $after_list_table |
|
| 46 | + * @return array |
|
| 47 | + */ |
|
| 48 | + public function addEventListIframeEmbedButtonSection(array $after_list_table) |
|
| 49 | + { |
|
| 50 | + return \EEH_Array::insert_into_array( |
|
| 51 | + $after_list_table, |
|
| 52 | + array( |
|
| 53 | + 'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection( |
|
| 54 | + array('event_list' => $this->embedButtonHtml()) |
|
| 55 | + ), |
|
| 56 | + ), |
|
| 57 | + 'legend' |
|
| 58 | + ); |
|
| 59 | + } |
|
| 60 | 60 | } |