@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\domain\services\ticket\CancelTicketLineItemService; |
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,48 +21,48 @@ discard block |
||
21 | 21 | class CancelRegistrationService |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | - */ |
|
27 | - private $cancel_ticket_line_item_service; |
|
24 | + /** |
|
25 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | + */ |
|
27 | + private $cancel_ticket_line_item_service; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * Command constructor |
|
33 | - * |
|
34 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | - */ |
|
36 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | - { |
|
38 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | - } |
|
31 | + /** |
|
32 | + * Command constructor |
|
33 | + * |
|
34 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | + */ |
|
36 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | + { |
|
38 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @param \EE_Registration $registration |
|
45 | - * @throws \EE_Error |
|
46 | - */ |
|
47 | - public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration) |
|
48 | - { |
|
49 | - // first cancel the original line item for the registration's ticket |
|
50 | - $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
51 | - $this->cancelRegistrationOnly($registration); |
|
52 | - } |
|
43 | + /** |
|
44 | + * @param \EE_Registration $registration |
|
45 | + * @throws \EE_Error |
|
46 | + */ |
|
47 | + public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration) |
|
48 | + { |
|
49 | + // first cancel the original line item for the registration's ticket |
|
50 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
51 | + $this->cancelRegistrationOnly($registration); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * @param \EE_Registration $registration |
|
58 | - * @throws \EE_Error |
|
59 | - */ |
|
60 | - public function cancelRegistrationOnly(\EE_Registration $registration) |
|
61 | - { |
|
62 | - // now cancel the registration itself |
|
63 | - $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
64 | - $registration->save(); |
|
65 | - } |
|
56 | + /** |
|
57 | + * @param \EE_Registration $registration |
|
58 | + * @throws \EE_Error |
|
59 | + */ |
|
60 | + public function cancelRegistrationOnly(\EE_Registration $registration) |
|
61 | + { |
|
62 | + // now cancel the registration itself |
|
63 | + $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
64 | + $registration->save(); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | 68 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\domain\services\DomainService; |
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 | |
@@ -20,24 +20,24 @@ discard block |
||
20 | 20 | class UpdateRegistrationService extends DomainService |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * @param \EE_Registration $registration |
|
25 | - * @return bool |
|
26 | - */ |
|
27 | - public function updateRegistrationAndTransaction(\EE_Registration $registration) |
|
28 | - { |
|
29 | - $transaction = $registration->transaction(); |
|
30 | - // reset transaction status back to incomplete |
|
31 | - $transaction->set_status(\EEM_Transaction::incomplete_status_code); |
|
32 | - // update transaction and all line item totals and subtotals |
|
33 | - $transaction->total_line_item()->recalculate_total_including_taxes(); |
|
34 | - // maybe update status, but don't save transaction just yet |
|
35 | - $transaction->update_status_based_on_total_paid(); |
|
36 | - /** @type \EE_Registration_Processor $registration_processor */ |
|
37 | - $registration_processor = \EE_Registry::instance()->load_class('Registration_Processor'); |
|
38 | - $registration_processor->update_registration_status_and_trigger_notifications($registration); |
|
39 | - return true; |
|
40 | - } |
|
23 | + /** |
|
24 | + * @param \EE_Registration $registration |
|
25 | + * @return bool |
|
26 | + */ |
|
27 | + public function updateRegistrationAndTransaction(\EE_Registration $registration) |
|
28 | + { |
|
29 | + $transaction = $registration->transaction(); |
|
30 | + // reset transaction status back to incomplete |
|
31 | + $transaction->set_status(\EEM_Transaction::incomplete_status_code); |
|
32 | + // update transaction and all line item totals and subtotals |
|
33 | + $transaction->total_line_item()->recalculate_total_including_taxes(); |
|
34 | + // maybe update status, but don't save transaction just yet |
|
35 | + $transaction->update_status_based_on_total_paid(); |
|
36 | + /** @type \EE_Registration_Processor $registration_processor */ |
|
37 | + $registration_processor = \EE_Registry::instance()->load_class('Registration_Processor'); |
|
38 | + $registration_processor->update_registration_status_and_trigger_notifications($registration); |
|
39 | + return true; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | // End of file UpdateRegistrationService.php |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use EventEspresso\core\exceptions\UnexpectedEntityException; |
6 | 6 | |
7 | 7 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
8 | - exit('No direct script access allowed'); |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | |
@@ -23,140 +23,140 @@ discard block |
||
23 | 23 | { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @param \EE_Registration $target_registration |
|
28 | - * @param \EE_Registration $registration_to_copy |
|
29 | - * @return bool |
|
30 | - * @throws \EE_Error |
|
31 | - */ |
|
32 | - public function copyRegistrationDetails( |
|
33 | - \EE_Registration $target_registration, |
|
34 | - \EE_Registration $registration_to_copy |
|
35 | - ) { |
|
36 | - // copy attendee |
|
37 | - $target_registration->set_attendee_id($registration_to_copy->attendee_ID()); |
|
38 | - $target_registration->set_status( $registration_to_copy->status_ID() ); |
|
39 | - $target_registration->save(); |
|
40 | - // get answers to previous reg questions |
|
41 | - $answers = $this->reindexAnswersByQuestionId($registration_to_copy->answers()); |
|
42 | - // get questions to new event reg form |
|
43 | - $new_event = $target_registration->event(); |
|
44 | - $question_groups = $new_event->question_groups( |
|
45 | - array( |
|
46 | - array( |
|
47 | - 'Event.EVT_ID' => $new_event->ID(), |
|
48 | - 'Event_Question_Group.EQG_primary' => $registration_to_copy->is_primary_registrant() |
|
49 | - ), |
|
50 | - 'order_by' => array('QSG_order' => 'ASC') |
|
51 | - ) |
|
52 | - ); |
|
53 | - foreach ($question_groups as $question_group) { |
|
54 | - if ($question_group instanceof \EE_Question_Group) { |
|
55 | - foreach ($question_group->questions() as $question) { |
|
56 | - if ($question instanceof \EE_Question) { |
|
57 | - $this->generateNewAnswer( |
|
58 | - $question, |
|
59 | - $target_registration, |
|
60 | - $answers |
|
61 | - ); |
|
62 | - } |
|
63 | - } |
|
64 | - } |
|
65 | - } |
|
66 | - return true; |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * @param \EE_Answer[] $answers |
|
73 | - * @return array |
|
74 | - * @throws \EE_Error |
|
75 | - */ |
|
76 | - protected static function reindexAnswersByQuestionId(array $answers) |
|
77 | - { |
|
78 | - $reindexed_answers = array(); |
|
79 | - foreach ($answers as $answer) { |
|
80 | - if ($answer instanceof \EE_Answer) { |
|
81 | - $reindexed_answers[$answer->question_ID()] = $answer->value(); |
|
82 | - } |
|
83 | - } |
|
84 | - return $reindexed_answers; |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @param \EE_Question $question |
|
91 | - * @param \EE_Registration $registration |
|
92 | - * @param $previous_answers |
|
93 | - * @return \EE_Answer |
|
94 | - * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
95 | - * @throws \EE_Error |
|
96 | - */ |
|
97 | - protected static function generateNewAnswer( |
|
98 | - \EE_Question $question, |
|
99 | - \EE_Registration $registration, |
|
100 | - $previous_answers |
|
101 | - ) { |
|
102 | - $old_answer_value = isset($previous_answers[$question->ID()]) |
|
103 | - ? $previous_answers[$question->ID()] |
|
104 | - : ''; |
|
105 | - $new_answer = \EE_Answer::new_instance( |
|
106 | - array( |
|
107 | - 'QST_ID' => $question->ID(), |
|
108 | - 'REG_ID' => $registration->ID(), |
|
109 | - 'ANS_value' => $old_answer_value, |
|
110 | - ) |
|
111 | - ); |
|
112 | - if ( ! $new_answer instanceof \EE_Answer) { |
|
113 | - throw new UnexpectedEntityException($new_answer, 'EE_Answer'); |
|
114 | - } |
|
115 | - $new_answer->save(); |
|
116 | - return $new_answer; |
|
117 | - } |
|
118 | - |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * @param \EE_Registration $target_registration |
|
123 | - * @param \EE_Registration $registration_to_copy |
|
124 | - * @return bool |
|
125 | - * @throws \EE_Error |
|
126 | - */ |
|
127 | - public function copyPaymentDetails( |
|
128 | - \EE_Registration $target_registration, |
|
129 | - \EE_Registration $registration_to_copy |
|
130 | - ) { |
|
131 | - $previous_payments = $registration_to_copy->registration_payments(); |
|
132 | - foreach ($previous_payments as $previous_payment) { |
|
133 | - if ( |
|
134 | - $previous_payment instanceof \EE_Registration_Payment |
|
135 | - && $previous_payment->payment() instanceof \EE_Payment |
|
136 | - && $previous_payment->payment()->is_approved() |
|
137 | - ) { |
|
138 | - $new_registration_payment = \EE_Registration_Payment::new_instance( |
|
139 | - array( |
|
140 | - 'REG_ID' => $target_registration->ID(), |
|
141 | - 'PAY_ID' => $previous_payment->ID(), |
|
142 | - 'RPY_amount' => $previous_payment->amount(), |
|
143 | - ) |
|
144 | - ); |
|
145 | - if ( ! $new_registration_payment instanceof \EE_Registration_Payment) { |
|
146 | - throw new UnexpectedEntityException($new_registration_payment, 'EE_Registration_Payment'); |
|
147 | - } |
|
148 | - $new_registration_payment->save(); |
|
149 | - $target_registration->set_paid($previous_payment->amount()); |
|
150 | - $target_registration->save(); |
|
151 | - // if new reg payment is good, then set old reg payment amount to zero |
|
152 | - $previous_payment->set_amount(0); |
|
153 | - $previous_payment->save(); |
|
154 | - $registration_to_copy->set_paid(0); |
|
155 | - $registration_to_copy->save(); |
|
156 | - } |
|
157 | - } |
|
158 | - return true; |
|
159 | - } |
|
26 | + /** |
|
27 | + * @param \EE_Registration $target_registration |
|
28 | + * @param \EE_Registration $registration_to_copy |
|
29 | + * @return bool |
|
30 | + * @throws \EE_Error |
|
31 | + */ |
|
32 | + public function copyRegistrationDetails( |
|
33 | + \EE_Registration $target_registration, |
|
34 | + \EE_Registration $registration_to_copy |
|
35 | + ) { |
|
36 | + // copy attendee |
|
37 | + $target_registration->set_attendee_id($registration_to_copy->attendee_ID()); |
|
38 | + $target_registration->set_status( $registration_to_copy->status_ID() ); |
|
39 | + $target_registration->save(); |
|
40 | + // get answers to previous reg questions |
|
41 | + $answers = $this->reindexAnswersByQuestionId($registration_to_copy->answers()); |
|
42 | + // get questions to new event reg form |
|
43 | + $new_event = $target_registration->event(); |
|
44 | + $question_groups = $new_event->question_groups( |
|
45 | + array( |
|
46 | + array( |
|
47 | + 'Event.EVT_ID' => $new_event->ID(), |
|
48 | + 'Event_Question_Group.EQG_primary' => $registration_to_copy->is_primary_registrant() |
|
49 | + ), |
|
50 | + 'order_by' => array('QSG_order' => 'ASC') |
|
51 | + ) |
|
52 | + ); |
|
53 | + foreach ($question_groups as $question_group) { |
|
54 | + if ($question_group instanceof \EE_Question_Group) { |
|
55 | + foreach ($question_group->questions() as $question) { |
|
56 | + if ($question instanceof \EE_Question) { |
|
57 | + $this->generateNewAnswer( |
|
58 | + $question, |
|
59 | + $target_registration, |
|
60 | + $answers |
|
61 | + ); |
|
62 | + } |
|
63 | + } |
|
64 | + } |
|
65 | + } |
|
66 | + return true; |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * @param \EE_Answer[] $answers |
|
73 | + * @return array |
|
74 | + * @throws \EE_Error |
|
75 | + */ |
|
76 | + protected static function reindexAnswersByQuestionId(array $answers) |
|
77 | + { |
|
78 | + $reindexed_answers = array(); |
|
79 | + foreach ($answers as $answer) { |
|
80 | + if ($answer instanceof \EE_Answer) { |
|
81 | + $reindexed_answers[$answer->question_ID()] = $answer->value(); |
|
82 | + } |
|
83 | + } |
|
84 | + return $reindexed_answers; |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @param \EE_Question $question |
|
91 | + * @param \EE_Registration $registration |
|
92 | + * @param $previous_answers |
|
93 | + * @return \EE_Answer |
|
94 | + * @throws \EventEspresso\core\exceptions\UnexpectedEntityException |
|
95 | + * @throws \EE_Error |
|
96 | + */ |
|
97 | + protected static function generateNewAnswer( |
|
98 | + \EE_Question $question, |
|
99 | + \EE_Registration $registration, |
|
100 | + $previous_answers |
|
101 | + ) { |
|
102 | + $old_answer_value = isset($previous_answers[$question->ID()]) |
|
103 | + ? $previous_answers[$question->ID()] |
|
104 | + : ''; |
|
105 | + $new_answer = \EE_Answer::new_instance( |
|
106 | + array( |
|
107 | + 'QST_ID' => $question->ID(), |
|
108 | + 'REG_ID' => $registration->ID(), |
|
109 | + 'ANS_value' => $old_answer_value, |
|
110 | + ) |
|
111 | + ); |
|
112 | + if ( ! $new_answer instanceof \EE_Answer) { |
|
113 | + throw new UnexpectedEntityException($new_answer, 'EE_Answer'); |
|
114 | + } |
|
115 | + $new_answer->save(); |
|
116 | + return $new_answer; |
|
117 | + } |
|
118 | + |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * @param \EE_Registration $target_registration |
|
123 | + * @param \EE_Registration $registration_to_copy |
|
124 | + * @return bool |
|
125 | + * @throws \EE_Error |
|
126 | + */ |
|
127 | + public function copyPaymentDetails( |
|
128 | + \EE_Registration $target_registration, |
|
129 | + \EE_Registration $registration_to_copy |
|
130 | + ) { |
|
131 | + $previous_payments = $registration_to_copy->registration_payments(); |
|
132 | + foreach ($previous_payments as $previous_payment) { |
|
133 | + if ( |
|
134 | + $previous_payment instanceof \EE_Registration_Payment |
|
135 | + && $previous_payment->payment() instanceof \EE_Payment |
|
136 | + && $previous_payment->payment()->is_approved() |
|
137 | + ) { |
|
138 | + $new_registration_payment = \EE_Registration_Payment::new_instance( |
|
139 | + array( |
|
140 | + 'REG_ID' => $target_registration->ID(), |
|
141 | + 'PAY_ID' => $previous_payment->ID(), |
|
142 | + 'RPY_amount' => $previous_payment->amount(), |
|
143 | + ) |
|
144 | + ); |
|
145 | + if ( ! $new_registration_payment instanceof \EE_Registration_Payment) { |
|
146 | + throw new UnexpectedEntityException($new_registration_payment, 'EE_Registration_Payment'); |
|
147 | + } |
|
148 | + $new_registration_payment->save(); |
|
149 | + $target_registration->set_paid($previous_payment->amount()); |
|
150 | + $target_registration->save(); |
|
151 | + // if new reg payment is good, then set old reg payment amount to zero |
|
152 | + $previous_payment->set_amount(0); |
|
153 | + $previous_payment->save(); |
|
154 | + $registration_to_copy->set_paid(0); |
|
155 | + $registration_to_copy->save(); |
|
156 | + } |
|
157 | + } |
|
158 | + return true; |
|
159 | + } |
|
160 | 160 | |
161 | 161 | |
162 | 162 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | ) { |
36 | 36 | // copy attendee |
37 | 37 | $target_registration->set_attendee_id($registration_to_copy->attendee_ID()); |
38 | - $target_registration->set_status( $registration_to_copy->status_ID() ); |
|
38 | + $target_registration->set_status($registration_to_copy->status_ID()); |
|
39 | 39 | $target_registration->save(); |
40 | 40 | // get answers to previous reg questions |
41 | 41 | $answers = $this->reindexAnswersByQuestionId($registration_to_copy->answers()); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace EventEspresso\core\domain\entities; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -18,98 +18,98 @@ discard block |
||
18 | 18 | class RegUrlLink |
19 | 19 | { |
20 | 20 | |
21 | - /* |
|
21 | + /* |
|
22 | 22 | * @var string $reg_url_link |
23 | 23 | */ |
24 | - private $reg_url_link; |
|
25 | - |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * @param string $reg_url_link |
|
30 | - * @return \EventEspresso\core\domain\entities\RegUrlLink |
|
31 | - */ |
|
32 | - public static function fromRegUrlLinkString($reg_url_link) |
|
33 | - { |
|
34 | - if (empty($reg_url_link) || ! is_string($reg_url_link)) { |
|
35 | - throw new \InvalidArgumentException( |
|
36 | - __( |
|
37 | - 'You must supply a valid non-empty string to generate a reg_url_link.', |
|
38 | - 'event_espresso' |
|
39 | - ) |
|
40 | - ); |
|
41 | - } |
|
42 | - return new RegUrlLink(1, '', $reg_url_link); |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * @param \EE_Registration $registration |
|
49 | - * @return \EventEspresso\core\domain\entities\RegUrlLink |
|
50 | - */ |
|
51 | - public static function fromRegistration(\EE_Registration $registration) |
|
52 | - { |
|
53 | - return new RegUrlLink( |
|
54 | - $registration->count(), |
|
55 | - $registration->ticket_line_item() |
|
56 | - ); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * CreateRegUrlLinkCommand constructor. |
|
63 | - * |
|
64 | - * @param int $reg_count |
|
65 | - * @param mixed $base_code |
|
66 | - * @param string $reg_url_link |
|
67 | - */ |
|
68 | - public function __construct( |
|
69 | - $reg_count = 1, |
|
70 | - $base_code = '', |
|
71 | - $reg_url_link = '' |
|
72 | - ) { |
|
73 | - if ( ! empty($reg_url_link) && is_string($reg_url_link)) { |
|
74 | - $this->reg_url_link = apply_filters( |
|
75 | - 'FHEE__\EventEspresso\core\domain\entities\RegUrlLink__construct__reg_url_link', |
|
76 | - $reg_url_link, |
|
77 | - $reg_count, |
|
78 | - $base_code, |
|
79 | - $reg_url_link |
|
80 | - ); |
|
81 | - return; |
|
82 | - } |
|
83 | - $reg_count = min(1, absint($reg_count)); |
|
84 | - $base_code = $base_code instanceof \EE_Line_Item ? $base_code->code() : $base_code; |
|
85 | - if (empty($base_code) || ! is_string($base_code)) { |
|
86 | - throw new \InvalidArgumentException( |
|
87 | - __( |
|
88 | - 'You must supply a valid EE_Line_Item or a non-empty string to generate a reg_url_link.', |
|
89 | - 'event_espresso' |
|
90 | - ) |
|
91 | - ); |
|
92 | - } |
|
93 | - $this->reg_url_link = apply_filters( |
|
94 | - 'FHEE__\EventEspresso\core\domain\entities\RegUrlLink__construct__reg_url_link', |
|
95 | - $reg_count . '-' . md5($base_code . microtime()), |
|
96 | - $reg_count, |
|
97 | - $base_code, |
|
98 | - $reg_url_link |
|
99 | - ); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * Return the object as a string |
|
106 | - * |
|
107 | - * @return string |
|
108 | - */ |
|
109 | - public function __toString() |
|
110 | - { |
|
111 | - return $this->reg_url_link; |
|
112 | - } |
|
24 | + private $reg_url_link; |
|
25 | + |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * @param string $reg_url_link |
|
30 | + * @return \EventEspresso\core\domain\entities\RegUrlLink |
|
31 | + */ |
|
32 | + public static function fromRegUrlLinkString($reg_url_link) |
|
33 | + { |
|
34 | + if (empty($reg_url_link) || ! is_string($reg_url_link)) { |
|
35 | + throw new \InvalidArgumentException( |
|
36 | + __( |
|
37 | + 'You must supply a valid non-empty string to generate a reg_url_link.', |
|
38 | + 'event_espresso' |
|
39 | + ) |
|
40 | + ); |
|
41 | + } |
|
42 | + return new RegUrlLink(1, '', $reg_url_link); |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * @param \EE_Registration $registration |
|
49 | + * @return \EventEspresso\core\domain\entities\RegUrlLink |
|
50 | + */ |
|
51 | + public static function fromRegistration(\EE_Registration $registration) |
|
52 | + { |
|
53 | + return new RegUrlLink( |
|
54 | + $registration->count(), |
|
55 | + $registration->ticket_line_item() |
|
56 | + ); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * CreateRegUrlLinkCommand constructor. |
|
63 | + * |
|
64 | + * @param int $reg_count |
|
65 | + * @param mixed $base_code |
|
66 | + * @param string $reg_url_link |
|
67 | + */ |
|
68 | + public function __construct( |
|
69 | + $reg_count = 1, |
|
70 | + $base_code = '', |
|
71 | + $reg_url_link = '' |
|
72 | + ) { |
|
73 | + if ( ! empty($reg_url_link) && is_string($reg_url_link)) { |
|
74 | + $this->reg_url_link = apply_filters( |
|
75 | + 'FHEE__\EventEspresso\core\domain\entities\RegUrlLink__construct__reg_url_link', |
|
76 | + $reg_url_link, |
|
77 | + $reg_count, |
|
78 | + $base_code, |
|
79 | + $reg_url_link |
|
80 | + ); |
|
81 | + return; |
|
82 | + } |
|
83 | + $reg_count = min(1, absint($reg_count)); |
|
84 | + $base_code = $base_code instanceof \EE_Line_Item ? $base_code->code() : $base_code; |
|
85 | + if (empty($base_code) || ! is_string($base_code)) { |
|
86 | + throw new \InvalidArgumentException( |
|
87 | + __( |
|
88 | + 'You must supply a valid EE_Line_Item or a non-empty string to generate a reg_url_link.', |
|
89 | + 'event_espresso' |
|
90 | + ) |
|
91 | + ); |
|
92 | + } |
|
93 | + $this->reg_url_link = apply_filters( |
|
94 | + 'FHEE__\EventEspresso\core\domain\entities\RegUrlLink__construct__reg_url_link', |
|
95 | + $reg_count . '-' . md5($base_code . microtime()), |
|
96 | + $reg_count, |
|
97 | + $base_code, |
|
98 | + $reg_url_link |
|
99 | + ); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * Return the object as a string |
|
106 | + * |
|
107 | + * @return string |
|
108 | + */ |
|
109 | + public function __toString() |
|
110 | + { |
|
111 | + return $this->reg_url_link; |
|
112 | + } |
|
113 | 113 | } |
114 | 114 | // End of file RegUrlLink.php |
115 | 115 | // Location: /RegUrlLink.php |
116 | 116 | \ No newline at end of file |
@@ -92,7 +92,7 @@ |
||
92 | 92 | } |
93 | 93 | $this->reg_url_link = apply_filters( |
94 | 94 | 'FHEE__\EventEspresso\core\domain\entities\RegUrlLink__construct__reg_url_link', |
95 | - $reg_count . '-' . md5($base_code . microtime()), |
|
95 | + $reg_count.'-'.md5($base_code.microtime()), |
|
96 | 96 | $reg_count, |
97 | 97 | $base_code, |
98 | 98 | $reg_url_link |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\domain\entities; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | \EE_Ticket $ticket |
39 | 39 | ) { |
40 | 40 | // figure out where to start parsing the reg code |
41 | - $chars = strpos( $reg_url_link, '-' ) + 5; |
|
41 | + $chars = strpos($reg_url_link, '-') + 5; |
|
42 | 42 | // TXN_ID + TKT_ID + first 3 and last 3 chars of reg_url_link |
43 | 43 | $this->reg_code = array( |
44 | 44 | $transaction->ID(), |
45 | 45 | $ticket->ID(), |
46 | - substr( $reg_url_link, 0, $chars ) |
|
46 | + substr($reg_url_link, 0, $chars) |
|
47 | 47 | ); |
48 | 48 | // now put it all together |
49 | 49 | $this->reg_code = apply_filters( |
50 | 50 | 'FHEE__Create__regCode__new_reg_code', |
51 | - implode( '-', $this->reg_code ), |
|
51 | + implode('-', $this->reg_code), |
|
52 | 52 | $transaction, |
53 | 53 | $ticket |
54 | 54 | ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Payments |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | 46 | // check if class object is instantiated |
47 | - if ( ! self::$_instance instanceof EE_Transaction_Payments ) { |
|
47 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
48 | 48 | self::$_instance = new self(); |
49 | 49 | } |
50 | 50 | return self::$_instance; |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param string $old_txn_status |
74 | 74 | */ |
75 | - public function set_old_txn_status( $old_txn_status ) { |
|
75 | + public function set_old_txn_status($old_txn_status) { |
|
76 | 76 | // only set the first time |
77 | - if ( $this->_old_txn_status === null ) { |
|
77 | + if ($this->_old_txn_status === null) { |
|
78 | 78 | $this->_old_txn_status = $old_txn_status; |
79 | 79 | } |
80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $new_txn_status |
95 | 95 | */ |
96 | - public function set_new_txn_status( $new_txn_status ) { |
|
96 | + public function set_new_txn_status($new_txn_status) { |
|
97 | 97 | $this->_new_txn_status = $new_txn_status; |
98 | 98 | } |
99 | 99 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return bool |
106 | 106 | */ |
107 | 107 | public function txn_status_updated() { |
108 | - return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
108 | + return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -125,22 +125,22 @@ discard block |
||
125 | 125 | * @return boolean whether the TXN was saved |
126 | 126 | * @throws \EE_Error |
127 | 127 | */ |
128 | - public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
128 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) { |
|
129 | 129 | // verify transaction |
130 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
131 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
130 | + if ( ! $transaction instanceof EE_Transaction) { |
|
131 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | // set incoming TXN_Status |
135 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
135 | + $this->set_old_txn_status($transaction->status_ID()); |
|
136 | 136 | // calculate total paid |
137 | - $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
137 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
138 | 138 | // if total paid has changed |
139 | - if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) { |
|
140 | - $transaction->set_paid( $total_paid ); |
|
139 | + if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
|
140 | + $transaction->set_paid($total_paid); |
|
141 | 141 | // maybe update status, and make sure to save transaction if not done already |
142 | - if ( ! $transaction->update_status_based_on_total_paid( $update_txn ) ) { |
|
143 | - if ( $update_txn ) { |
|
142 | + if ( ! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
143 | + if ($update_txn) { |
|
144 | 144 | return $transaction->save() ? true : false; |
145 | 145 | } |
146 | 146 | } else { |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | * @return float|false float on success, false on fail |
165 | 165 | * @throws \EE_Error |
166 | 166 | */ |
167 | - public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
167 | + public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) { |
|
168 | 168 | // verify transaction |
169 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
170 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
169 | + if ( ! $transaction instanceof EE_Transaction) { |
|
170 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | // ensure Payment model is loaded |
174 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
174 | + EE_Registry::instance()->load_model('Payment'); |
|
175 | 175 | // calls EEM_Base::sum() |
176 | 176 | return EEM_Payment::instance()->sum( |
177 | 177 | // query params |
178 | - array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )), |
|
178 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
179 | 179 | // field to sum |
180 | 180 | 'PAY_amount' |
181 | 181 | ); |
@@ -193,17 +193,17 @@ discard block |
||
193 | 193 | * @return boolean |
194 | 194 | * @throws \EE_Error |
195 | 195 | */ |
196 | - public function delete_payment_and_update_transaction( EE_Payment $payment ) { |
|
196 | + public function delete_payment_and_update_transaction(EE_Payment $payment) { |
|
197 | 197 | // verify payment |
198 | - if ( ! $payment instanceof EE_Payment ) { |
|
199 | - EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
198 | + if ( ! $payment instanceof EE_Payment) { |
|
199 | + EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
200 | 200 | return false; |
201 | 201 | } |
202 | - if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) { |
|
202 | + if ( ! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
203 | 203 | return false; |
204 | 204 | } |
205 | - if ( ! $payment->delete() ) { |
|
206 | - EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
205 | + if ( ! $payment->delete()) { |
|
206 | + EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | || $TXN_status === EEM_Transaction::failed_status_code |
215 | 215 | || $payment->amount() === 0 |
216 | 216 | ) { |
217 | - EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) ); |
|
217 | + EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
218 | 218 | return true; |
219 | 219 | } |
220 | 220 | |
221 | 221 | |
222 | 222 | //if this fails, that just means that the transaction didn't get its status changed and/or updated. |
223 | 223 | //however the payment was still deleted. |
224 | - if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) { |
|
224 | + if ( ! $this->calculate_total_payments_and_update_status($transaction)) { |
|
225 | 225 | |
226 | 226 | EE_Error::add_attention( |
227 | 227 | __( |
@@ -255,28 +255,28 @@ discard block |
||
255 | 255 | * @return bool |
256 | 256 | * @throws \EE_Error |
257 | 257 | */ |
258 | - public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) { |
|
258 | + public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) { |
|
259 | 259 | $save_payment = false; |
260 | - $reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) ); |
|
261 | - $registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params ); |
|
262 | - if ( ! empty( $registration_payments )) { |
|
263 | - foreach ( $registration_payments as $registration_payment ) { |
|
264 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
260 | + $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID())); |
|
261 | + $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
262 | + if ( ! empty($registration_payments)) { |
|
263 | + foreach ($registration_payments as $registration_payment) { |
|
264 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
265 | 265 | $amount_paid = $registration_payment->amount(); |
266 | 266 | $registration = $registration_payment->registration(); |
267 | - if ( $registration instanceof EE_Registration ) { |
|
268 | - $registration->set_paid( $registration->paid() - $amount_paid ); |
|
269 | - if ( $registration->save() ) { |
|
270 | - if ( $registration_payment->delete() ) { |
|
271 | - $registration->_remove_relation_to( $payment, 'Payment' ); |
|
272 | - $payment->_remove_relation_to( $registration, 'Registration' ); |
|
267 | + if ($registration instanceof EE_Registration) { |
|
268 | + $registration->set_paid($registration->paid() - $amount_paid); |
|
269 | + if ($registration->save()) { |
|
270 | + if ($registration_payment->delete()) { |
|
271 | + $registration->_remove_relation_to($payment, 'Payment'); |
|
272 | + $payment->_remove_relation_to($registration, 'Registration'); |
|
273 | 273 | } |
274 | 274 | $save_payment = true; |
275 | 275 | } |
276 | 276 | } else { |
277 | 277 | EE_Error::add_error( |
278 | 278 | sprintf( |
279 | - __( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ), |
|
279 | + __('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'), |
|
280 | 280 | $registration_payment->ID() |
281 | 281 | ), |
282 | 282 | __FILE__, __FUNCTION__, __LINE__ |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } else { |
287 | 287 | EE_Error::add_error( |
288 | 288 | sprintf( |
289 | - __( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ), |
|
289 | + __('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'), |
|
290 | 290 | $payment->ID() |
291 | 291 | ), |
292 | 292 | __FILE__, __FUNCTION__, __LINE__ |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | } |
297 | 297 | } |
298 | - if ( $save_payment ) { |
|
298 | + if ($save_payment) { |
|
299 | 299 | $payment->save(); |
300 | 300 | } |
301 | 301 | return true; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true) |
316 | 316 | { |
317 | 317 | EE_Error::doing_it_wrong( |
318 | - __CLASS__ . '::' . __FUNCTION__, |
|
318 | + __CLASS__.'::'.__FUNCTION__, |
|
319 | 319 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
320 | 320 | 'EE_Transaction::update_status_based_on_total_paid()'), |
321 | 321 | '4.9.1', |
@@ -1,6 +1,6 @@ discard block |
||
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 | * |
@@ -65,35 +65,35 @@ discard block |
||
65 | 65 | * @param EE_Response $response |
66 | 66 | * @return EE_Response |
67 | 67 | */ |
68 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
68 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
69 | 69 | $this->request = $request; |
70 | 70 | $this->response = $response; |
71 | 71 | // info about how to load classes required by other classes |
72 | 72 | $this->dependency_map = $this->_load_dependency_map(); |
73 | 73 | // central repository for classes |
74 | 74 | $this->registry = $this->_load_registry(); |
75 | - do_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading' ); |
|
75 | + do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading'); |
|
76 | 76 | // PSR4 Autoloaders |
77 | - $this->registry->load_core( 'EE_Psr4AutoloaderInit' ); |
|
77 | + $this->registry->load_core('EE_Psr4AutoloaderInit'); |
|
78 | 78 | // create and cache the CommandBus, and also add the CapChecker middleware |
79 | 79 | $this->registry->create( |
80 | 80 | 'CommandBusInterface', |
81 | 81 | array( |
82 | 82 | null, |
83 | - $this->registry->create( 'CapChecker' ) |
|
83 | + $this->registry->create('CapChecker') |
|
84 | 84 | ), |
85 | 85 | true |
86 | 86 | ); |
87 | 87 | // workarounds for PHP < 5.3 |
88 | 88 | $this->_load_class_tools(); |
89 | 89 | // load interfaces |
90 | - espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' ); |
|
90 | + espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php'); |
|
91 | 91 | // deprecated functions |
92 | - espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' ); |
|
92 | + espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php'); |
|
93 | 93 | // WP cron jobs |
94 | - $this->registry->load_core( 'Cron_Tasks' ); |
|
95 | - $this->registry->load_core( 'EE_Request_Handler' ); |
|
96 | - $this->registry->load_core( 'EE_System' ); |
|
94 | + $this->registry->load_core('Cron_Tasks'); |
|
95 | + $this->registry->load_core('EE_Request_Handler'); |
|
96 | + $this->registry->load_core('EE_System'); |
|
97 | 97 | |
98 | 98 | return $this->response; |
99 | 99 | } |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | * @throws \EE_Error |
124 | 124 | */ |
125 | 125 | public function dependency_map() { |
126 | - if ( ! $this->dependency_map instanceof EE_Dependency_Map ) { |
|
126 | + if ( ! $this->dependency_map instanceof EE_Dependency_Map) { |
|
127 | 127 | throw new EE_Error( |
128 | 128 | sprintf( |
129 | - __( 'Invalid EE_Dependency_Map: "%1$s"', 'event_espresso' ), |
|
130 | - print_r( $this->dependency_map, true ) |
|
129 | + __('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'), |
|
130 | + print_r($this->dependency_map, true) |
|
131 | 131 | ) |
132 | 132 | ); |
133 | 133 | } |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | * @throws \EE_Error |
142 | 142 | */ |
143 | 143 | public function registry() { |
144 | - if ( ! $this->registry instanceof EE_Registry ) { |
|
144 | + if ( ! $this->registry instanceof EE_Registry) { |
|
145 | 145 | throw new EE_Error( |
146 | 146 | sprintf( |
147 | - __( 'Invalid EE_Registry: "%1$s"', 'event_espresso' ), |
|
148 | - print_r( $this->registry, true ) |
|
147 | + __('Invalid EE_Registry: "%1$s"', 'event_espresso'), |
|
148 | + print_r($this->registry, true) |
|
149 | 149 | ) |
150 | 150 | ); |
151 | 151 | } |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | * @return EE_Dependency_Map |
162 | 162 | */ |
163 | 163 | private function _load_dependency_map() { |
164 | - if ( ! is_readable( EE_CORE . 'EE_Dependency_Map.core.php' ) ) { |
|
164 | + if ( ! is_readable(EE_CORE.'EE_Dependency_Map.core.php')) { |
|
165 | 165 | EE_Error::add_error( |
166 | - __( 'The EE_Dependency_Map core class could not be loaded.', 'event_espresso' ), |
|
166 | + __('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'), |
|
167 | 167 | __FILE__, __FUNCTION__, __LINE__ |
168 | 168 | ); |
169 | - wp_die( EE_Error::get_notices() ); |
|
169 | + wp_die(EE_Error::get_notices()); |
|
170 | 170 | } |
171 | - require_once( EE_CORE . 'EE_Dependency_Map.core.php' ); |
|
172 | - return EE_Dependency_Map::instance( $this->request, $this->response ); |
|
171 | + require_once(EE_CORE.'EE_Dependency_Map.core.php'); |
|
172 | + return EE_Dependency_Map::instance($this->request, $this->response); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | * @return EE_Registry |
182 | 182 | */ |
183 | 183 | private function _load_registry() { |
184 | - if ( ! is_readable( EE_CORE . 'EE_Registry.core.php' )) { |
|
184 | + if ( ! is_readable(EE_CORE.'EE_Registry.core.php')) { |
|
185 | 185 | EE_Error::add_error( |
186 | - __( 'The EE_Registry core class could not be loaded.', 'event_espresso' ), |
|
186 | + __('The EE_Registry core class could not be loaded.', 'event_espresso'), |
|
187 | 187 | __FILE__, __FUNCTION__, __LINE__ |
188 | 188 | ); |
189 | - wp_die( EE_Error::get_notices() ); |
|
189 | + wp_die(EE_Error::get_notices()); |
|
190 | 190 | } |
191 | - require_once( EE_CORE . 'EE_Registry.core.php' ); |
|
192 | - return EE_Registry::instance( $this->dependency_map ); |
|
191 | + require_once(EE_CORE.'EE_Registry.core.php'); |
|
192 | + return EE_Registry::instance($this->dependency_map); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | * @return void |
201 | 201 | */ |
202 | 202 | private function _load_class_tools() { |
203 | - if ( ! is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) { |
|
203 | + if ( ! is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) { |
|
204 | 204 | EE_Error::add_error( |
205 | - __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ), |
|
205 | + __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'), |
|
206 | 206 | __FILE__, __FUNCTION__, __LINE__ |
207 | 207 | ); |
208 | 208 | } |
209 | - require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' ); |
|
209 | + require_once(EE_HELPERS.'EEH_Class_Tools.helper.php'); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | * @param \EE_Request $request |
221 | 221 | * @param \EE_Response $response |
222 | 222 | */ |
223 | - public function handle_response( EE_Request $request, EE_Response $response ) { |
|
223 | + public function handle_response(EE_Request $request, EE_Response $response) { |
|
224 | 224 | //\EEH_Debug_Tools::printr( __FUNCTION__, __CLASS__, __FILE__, __LINE__, 2 ); |
225 | 225 | //EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ ); |
226 | 226 | //EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ ); |
227 | 227 | //die(); |
228 | - if ( $response->plugin_deactivated() ) { |
|
229 | - espresso_deactivate_plugin( EE_PLUGIN_BASENAME ); |
|
228 | + if ($response->plugin_deactivated()) { |
|
229 | + espresso_deactivate_plugin(EE_PLUGIN_BASENAME); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace EventEspresso\core\services\commands; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | abstract class CommandHandler implements CommandHandlerInterface |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
23 | - * @return mixed |
|
24 | - */ |
|
25 | - abstract public function handle(CommandInterface $command); |
|
21 | + /** |
|
22 | + * @param \EventEspresso\core\services\commands\CommandInterface $command |
|
23 | + * @return mixed |
|
24 | + */ |
|
25 | + abstract public function handle(CommandInterface $command); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | // End of file CommandHandler.php |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
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 | |
@@ -23,35 +23,35 @@ discard block |
||
23 | 23 | { |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @access public |
|
28 | - * @param mixed $command_bus_middleware_object |
|
29 | - * @param string $message |
|
30 | - * @param int $code |
|
31 | - * @param \Exception $previous |
|
32 | - */ |
|
33 | - public function __construct($command_bus_middleware_object, $message = '', $code = 0, \Exception $previous = null) |
|
34 | - { |
|
35 | - $command_bus_middleware = is_object($command_bus_middleware_object) |
|
36 | - ? get_class($command_bus_middleware_object) |
|
37 | - : gettype($command_bus_middleware_object); |
|
38 | - |
|
39 | - if (empty($message)) { |
|
40 | - $message = sprintf( |
|
41 | - __('The supplied Command Bus Middleware "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
42 | - 'event_espresso'), |
|
43 | - $command_bus_middleware |
|
44 | - ); |
|
45 | - } |
|
46 | - parent::__construct( |
|
47 | - '$command_bus_middleware', |
|
48 | - $command_bus_middleware, |
|
49 | - 'CommandBusMiddlewareInterface', |
|
50 | - $message, |
|
51 | - $code, |
|
52 | - $previous |
|
53 | - ); |
|
54 | - } |
|
26 | + /** |
|
27 | + * @access public |
|
28 | + * @param mixed $command_bus_middleware_object |
|
29 | + * @param string $message |
|
30 | + * @param int $code |
|
31 | + * @param \Exception $previous |
|
32 | + */ |
|
33 | + public function __construct($command_bus_middleware_object, $message = '', $code = 0, \Exception $previous = null) |
|
34 | + { |
|
35 | + $command_bus_middleware = is_object($command_bus_middleware_object) |
|
36 | + ? get_class($command_bus_middleware_object) |
|
37 | + : gettype($command_bus_middleware_object); |
|
38 | + |
|
39 | + if (empty($message)) { |
|
40 | + $message = sprintf( |
|
41 | + __('The supplied Command Bus Middleware "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
42 | + 'event_espresso'), |
|
43 | + $command_bus_middleware |
|
44 | + ); |
|
45 | + } |
|
46 | + parent::__construct( |
|
47 | + '$command_bus_middleware', |
|
48 | + $command_bus_middleware, |
|
49 | + 'CommandBusMiddlewareInterface', |
|
50 | + $message, |
|
51 | + $code, |
|
52 | + $previous |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | 57 | } |