Completed
Branch master (de4804)
by
unknown
34:50 queued 28:45
created
core/domain/services/licensing/LicenseDataPue.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -14,48 +14,48 @@
 block discarded – undo
14 14
  */
15 15
 class LicenseDataPue implements LicenseDataStrategy
16 16
 {
17
-    private string $license_key = '';
17
+	private string $license_key = '';
18 18
 
19
-    private string $status;
19
+	private string $status;
20 20
 
21
-    protected EE_Network_Core_Config $network_core_config;
21
+	protected EE_Network_Core_Config $network_core_config;
22 22
 
23 23
 
24
-    /**
25
-     * @param EE_Network_Core_Config $network_core_config
26
-     */
27
-    public function __construct(EE_Network_Core_Config $network_core_config)
28
-    {
29
-        $this->network_core_config = $network_core_config;
30
-    }
24
+	/**
25
+	 * @param EE_Network_Core_Config $network_core_config
26
+	 */
27
+	public function __construct(EE_Network_Core_Config $network_core_config)
28
+	{
29
+		$this->network_core_config = $network_core_config;
30
+	}
31 31
 
32 32
 
33
-    public function loadLicenseData(): void
34
-    {
35
-        if (empty($this->network_core_config->site_license_key)) {
36
-            $this->status = LicenseStatus::EXPIRED;
37
-            return;
38
-        }
39
-        $this->license_key = $this->network_core_config->site_license_key;
40
-        $verify_fail       = get_option('puvererr_' . basename(EE_PLUGIN_BASENAME), false);
41
-        $this->status      = $verify_fail ? LicenseStatus::EXPIRED : LicenseStatus::ACTIVE;
42
-    }
33
+	public function loadLicenseData(): void
34
+	{
35
+		if (empty($this->network_core_config->site_license_key)) {
36
+			$this->status = LicenseStatus::EXPIRED;
37
+			return;
38
+		}
39
+		$this->license_key = $this->network_core_config->site_license_key;
40
+		$verify_fail       = get_option('puvererr_' . basename(EE_PLUGIN_BASENAME), false);
41
+		$this->status      = $verify_fail ? LicenseStatus::EXPIRED : LicenseStatus::ACTIVE;
42
+	}
43 43
 
44 44
 
45
-    public function getLicenseKey(): string
46
-    {
47
-        return $this->license_key;
48
-    }
45
+	public function getLicenseKey(): string
46
+	{
47
+		return $this->license_key;
48
+	}
49 49
 
50 50
 
51
-    public function getLicenseStatus(): string
52
-    {
53
-        return $this->status;
54
-    }
51
+	public function getLicenseStatus(): string
52
+	{
53
+		return $this->status;
54
+	}
55 55
 
56 56
 
57
-    public function getLicenseExpiry(): string
58
-    {
59
-        return '';
60
-    }
57
+	public function getLicenseExpiry(): string
58
+	{
59
+		return '';
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
             return;
38 38
         }
39 39
         $this->license_key = $this->network_core_config->site_license_key;
40
-        $verify_fail       = get_option('puvererr_' . basename(EE_PLUGIN_BASENAME), false);
40
+        $verify_fail       = get_option('puvererr_'.basename(EE_PLUGIN_BASENAME), false);
41 41
         $this->status      = $verify_fail ? LicenseStatus::EXPIRED : LicenseStatus::ACTIVE;
42 42
     }
43 43
 
Please login to merge, or discard this patch.
core/domain/services/licensing/LicenseKeysAdminForm.php 2 patches
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -19,188 +19,188 @@
 block discarded – undo
19 19
 
20 20
 class LicenseKeysAdminForm extends FormHandler
21 21
 {
22
-    public function __construct(EE_Registry $registry)
23
-    {
24
-        parent::__construct(
25
-            LICENSE_KEYS_LABEL,
26
-            LICENSE_KEYS_LABEL,
27
-            LICENSE_KEYS_PG_SLUG,
28
-            '',
29
-            FormHandler::DO_NOT_SETUP_FORM,
30
-            $registry
31
-        );
32
-    }
33
-
34
-
35
-    /**
36
-     * @throws EE_Error
37
-     */
38
-    public function generate(): EE_Form_Section_Proper
39
-    {
40
-        $subsections = (array) apply_filters('FHEE__LicenseKeysAdminForm__generate__form_subsections', []);
41
-        ksort($subsections);
42
-        return new EE_Form_Section_Proper(
43
-            [
44
-                'name'            => 'license_keys_admin_form',
45
-                'html_id'         => 'license_keys_admin_form',
46
-                'layout_strategy' => new EE_No_Layout(),
47
-                'subsections'     => $this->addCoreSupportLicenseKey($subsections),
48
-            ]
49
-        );
50
-    }
51
-
52
-
53
-    private function addCoreSupportLicenseKey(array $subsections): array
54
-    {
55
-        // we want to move the license key input for core to a different location,
56
-        // so to do that, we need to copy it, delete the old location, then add re-add to the form
57
-        $core_license_key = $subsections['event_espresso_core'] ?? null;
58
-        unset($subsections['event_espresso_core']);
59
-        $new_subsections = [
60
-            'license_keys_hdr'           => new EE_Form_Section_HTML(
61
-                EEH_HTML::h1(
62
-                    esc_html__('Event Espresso Core License & Support Keys', 'event_espresso'),
63
-                    '',
64
-                    'ee-admin-settings-hdr'
65
-                )
66
-            ),
67
-            'support_license_notice'     => new EE_Form_Section_HTML(
68
-                EEH_HTML::div(
69
-                    '<span class="dashicons dashicons-sos"></span>'
70
-                    . EEH_HTML::span(
71
-                        esc_html__(
72
-                            'Adding a valid Support License Key will enable automatic update notifications and backend updates.',
73
-                            'event_espresso'
74
-                        )
75
-                    ),
76
-                    'support-license-notice-dv',
77
-                    'ee-status-outline ee-status-outline--small ee-status-bg--info'
78
-                )
79
-            ),
80
-            'event_espresso_core'        => $core_license_key,
81
-            'dev_site_notice'            => new EE_Form_Section_HTML(
82
-                EEH_HTML::br()
83
-                . EEH_HTML::div(
84
-                    EEH_HTML::span(
85
-                        sprintf(
86
-                            esc_html__(
87
-                                'If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
88
-                                'event_espresso'
89
-                            ),
90
-                            '<strong>',
91
-                            '</strong>'
92
-                        )
93
-                    ),
94
-                    'dev-site-notice-dv',
95
-                    'ee-status--warning'
96
-                )
97
-            ),
98
-            'add-on-license-keys-hdr'    => new EE_Form_Section_HTML(
99
-                EEH_HTML::h2(
100
-                    esc_html__('Add-on License Keys', 'event_espresso'),
101
-                    '',
102
-                    'ee-admin-settings-hdr'
103
-                )
104
-            ),
105
-            'add-on-license-keys-notice' => new EE_Form_Section_HTML(
106
-                EEH_HTML::div(
107
-                    EEH_HTML::span(
108
-                        esc_html__(
109
-                            'Please activate an Event Espresso Core support license key first in order to activate your add-on license keys',
110
-                            'event_espresso'
111
-                        )
112
-                    ),
113
-                    'add-on-license-keys-notice-dv',
114
-                    'ee-status-outline ee-status-outline--micro ee-status-bg--attention',
115
-                    'display: none;'
116
-                )
117
-            ),
118
-        ];
119
-
120
-        if ($core_license_key instanceof LicenseKeyFormInput && $core_license_key->get_default()) {
121
-            unset($new_subsections['dev_site_notice']);
122
-            unset($new_subsections['support_license_notice']);
123
-            unset($new_subsections['add-on-license-keys-notice']);
124
-        }
125
-        return EEH_Array::insert_into_array($subsections, $new_subsections);
126
-    }
127
-
128
-
129
-    /**
130
-     * @param array $submitted_form_data
131
-     * @return stdClass
132
-     * @throws EE_Error
133
-     */
134
-    public function process($submitted_form_data = [])
135
-    {
136
-        $capabilities = LoaderFactory::getShared(EE_Capabilities::class);
137
-        if (! $capabilities->current_user_can('manage_options', __FUNCTION__)) {
138
-            throw new RuntimeException(
139
-                esc_html__('You do not have the required privileges to perform this action', 'event_espresso')
140
-            );
141
-        }
142
-
143
-        // NOTE! we're not using parent::process() here
144
-        // because the requests are coming in via ajax
145
-        // and the request parameters do not match the form schema
146
-        $license_action   = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ACTION ] ?? '';
147
-        $license_key      = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_LICENSE_KEY ] ?? '';
148
-        $item_id          = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ITEM_ID ] ?? 0;
149
-        $item_name        = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ITEM_NAME ] ?? '';
150
-        $plugin_slug      = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_PLUGIN_SLUG ] ?? '';
151
-        $plugin_version   = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_PLUGIN_VER ] ?? '';
152
-        $min_core_version = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_MIN_CORE_VER ] ?? '';
153
-
154
-        /** @var LicenseManager $licence_manager */
155
-        $licence_manager = LoaderFactory::getShared(LicenseManager::class);
156
-
157
-        $license_data = [];
158
-        switch ($license_action) {
159
-            case LicenseAPI::ACTION_ACTIVATE:
160
-                $license_data = $licence_manager->activateLicense(
161
-                    $license_key,
162
-                    $item_id,
163
-                    $item_name,
164
-                    $plugin_slug,
165
-                    $plugin_version,
166
-                    $min_core_version
167
-                );
168
-                break;
169
-
170
-            case LicenseAPI::ACTION_DEACTIVATE:
171
-                $license_data = $licence_manager->deactivateLicense(
172
-                    $license_key,
173
-                    $item_id,
174
-                    $item_name,
175
-                    $plugin_slug,
176
-                    $plugin_version,
177
-                    $min_core_version
178
-                );
179
-                break;
180
-
181
-            case LicenseAPI::ACTION_CHECK:
182
-                $license_data = $licence_manager->checkLicense(
183
-                    $license_key,
184
-                    $item_id,
185
-                    $item_name,
186
-                    $plugin_slug,
187
-                    $plugin_version,
188
-                    $min_core_version
189
-                );
190
-                break;
191
-
192
-            case LicenseAPI::ACTION_GET_VERSION:
193
-                $license_data = $licence_manager->getVersionInfo();
194
-                break;
195
-
196
-            case LicenseAPI::ACTION_RESET:
197
-                $license_data = $licence_manager->resetLicenseKey($plugin_slug);
198
-                break;
199
-        }
200
-
201
-        $license_data               = (object) $license_data;
202
-        $license_data->statusNotice = LicenseStatusDisplay::statusNotice($license_data->license);
203
-        $license_data->statusClass  = LicenseStatusDisplay::statusClass($license_data->license);
204
-        return $license_data;
205
-    }
22
+	public function __construct(EE_Registry $registry)
23
+	{
24
+		parent::__construct(
25
+			LICENSE_KEYS_LABEL,
26
+			LICENSE_KEYS_LABEL,
27
+			LICENSE_KEYS_PG_SLUG,
28
+			'',
29
+			FormHandler::DO_NOT_SETUP_FORM,
30
+			$registry
31
+		);
32
+	}
33
+
34
+
35
+	/**
36
+	 * @throws EE_Error
37
+	 */
38
+	public function generate(): EE_Form_Section_Proper
39
+	{
40
+		$subsections = (array) apply_filters('FHEE__LicenseKeysAdminForm__generate__form_subsections', []);
41
+		ksort($subsections);
42
+		return new EE_Form_Section_Proper(
43
+			[
44
+				'name'            => 'license_keys_admin_form',
45
+				'html_id'         => 'license_keys_admin_form',
46
+				'layout_strategy' => new EE_No_Layout(),
47
+				'subsections'     => $this->addCoreSupportLicenseKey($subsections),
48
+			]
49
+		);
50
+	}
51
+
52
+
53
+	private function addCoreSupportLicenseKey(array $subsections): array
54
+	{
55
+		// we want to move the license key input for core to a different location,
56
+		// so to do that, we need to copy it, delete the old location, then add re-add to the form
57
+		$core_license_key = $subsections['event_espresso_core'] ?? null;
58
+		unset($subsections['event_espresso_core']);
59
+		$new_subsections = [
60
+			'license_keys_hdr'           => new EE_Form_Section_HTML(
61
+				EEH_HTML::h1(
62
+					esc_html__('Event Espresso Core License & Support Keys', 'event_espresso'),
63
+					'',
64
+					'ee-admin-settings-hdr'
65
+				)
66
+			),
67
+			'support_license_notice'     => new EE_Form_Section_HTML(
68
+				EEH_HTML::div(
69
+					'<span class="dashicons dashicons-sos"></span>'
70
+					. EEH_HTML::span(
71
+						esc_html__(
72
+							'Adding a valid Support License Key will enable automatic update notifications and backend updates.',
73
+							'event_espresso'
74
+						)
75
+					),
76
+					'support-license-notice-dv',
77
+					'ee-status-outline ee-status-outline--small ee-status-bg--info'
78
+				)
79
+			),
80
+			'event_espresso_core'        => $core_license_key,
81
+			'dev_site_notice'            => new EE_Form_Section_HTML(
82
+				EEH_HTML::br()
83
+				. EEH_HTML::div(
84
+					EEH_HTML::span(
85
+						sprintf(
86
+							esc_html__(
87
+								'If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
88
+								'event_espresso'
89
+							),
90
+							'<strong>',
91
+							'</strong>'
92
+						)
93
+					),
94
+					'dev-site-notice-dv',
95
+					'ee-status--warning'
96
+				)
97
+			),
98
+			'add-on-license-keys-hdr'    => new EE_Form_Section_HTML(
99
+				EEH_HTML::h2(
100
+					esc_html__('Add-on License Keys', 'event_espresso'),
101
+					'',
102
+					'ee-admin-settings-hdr'
103
+				)
104
+			),
105
+			'add-on-license-keys-notice' => new EE_Form_Section_HTML(
106
+				EEH_HTML::div(
107
+					EEH_HTML::span(
108
+						esc_html__(
109
+							'Please activate an Event Espresso Core support license key first in order to activate your add-on license keys',
110
+							'event_espresso'
111
+						)
112
+					),
113
+					'add-on-license-keys-notice-dv',
114
+					'ee-status-outline ee-status-outline--micro ee-status-bg--attention',
115
+					'display: none;'
116
+				)
117
+			),
118
+		];
119
+
120
+		if ($core_license_key instanceof LicenseKeyFormInput && $core_license_key->get_default()) {
121
+			unset($new_subsections['dev_site_notice']);
122
+			unset($new_subsections['support_license_notice']);
123
+			unset($new_subsections['add-on-license-keys-notice']);
124
+		}
125
+		return EEH_Array::insert_into_array($subsections, $new_subsections);
126
+	}
127
+
128
+
129
+	/**
130
+	 * @param array $submitted_form_data
131
+	 * @return stdClass
132
+	 * @throws EE_Error
133
+	 */
134
+	public function process($submitted_form_data = [])
135
+	{
136
+		$capabilities = LoaderFactory::getShared(EE_Capabilities::class);
137
+		if (! $capabilities->current_user_can('manage_options', __FUNCTION__)) {
138
+			throw new RuntimeException(
139
+				esc_html__('You do not have the required privileges to perform this action', 'event_espresso')
140
+			);
141
+		}
142
+
143
+		// NOTE! we're not using parent::process() here
144
+		// because the requests are coming in via ajax
145
+		// and the request parameters do not match the form schema
146
+		$license_action   = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ACTION ] ?? '';
147
+		$license_key      = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_LICENSE_KEY ] ?? '';
148
+		$item_id          = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ITEM_ID ] ?? 0;
149
+		$item_name        = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ITEM_NAME ] ?? '';
150
+		$plugin_slug      = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_PLUGIN_SLUG ] ?? '';
151
+		$plugin_version   = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_PLUGIN_VER ] ?? '';
152
+		$min_core_version = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_MIN_CORE_VER ] ?? '';
153
+
154
+		/** @var LicenseManager $licence_manager */
155
+		$licence_manager = LoaderFactory::getShared(LicenseManager::class);
156
+
157
+		$license_data = [];
158
+		switch ($license_action) {
159
+			case LicenseAPI::ACTION_ACTIVATE:
160
+				$license_data = $licence_manager->activateLicense(
161
+					$license_key,
162
+					$item_id,
163
+					$item_name,
164
+					$plugin_slug,
165
+					$plugin_version,
166
+					$min_core_version
167
+				);
168
+				break;
169
+
170
+			case LicenseAPI::ACTION_DEACTIVATE:
171
+				$license_data = $licence_manager->deactivateLicense(
172
+					$license_key,
173
+					$item_id,
174
+					$item_name,
175
+					$plugin_slug,
176
+					$plugin_version,
177
+					$min_core_version
178
+				);
179
+				break;
180
+
181
+			case LicenseAPI::ACTION_CHECK:
182
+				$license_data = $licence_manager->checkLicense(
183
+					$license_key,
184
+					$item_id,
185
+					$item_name,
186
+					$plugin_slug,
187
+					$plugin_version,
188
+					$min_core_version
189
+				);
190
+				break;
191
+
192
+			case LicenseAPI::ACTION_GET_VERSION:
193
+				$license_data = $licence_manager->getVersionInfo();
194
+				break;
195
+
196
+			case LicenseAPI::ACTION_RESET:
197
+				$license_data = $licence_manager->resetLicenseKey($plugin_slug);
198
+				break;
199
+		}
200
+
201
+		$license_data               = (object) $license_data;
202
+		$license_data->statusNotice = LicenseStatusDisplay::statusNotice($license_data->license);
203
+		$license_data->statusClass  = LicenseStatusDisplay::statusClass($license_data->license);
204
+		return $license_data;
205
+	}
206 206
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     public function process($submitted_form_data = [])
135 135
     {
136 136
         $capabilities = LoaderFactory::getShared(EE_Capabilities::class);
137
-        if (! $capabilities->current_user_can('manage_options', __FUNCTION__)) {
137
+        if ( ! $capabilities->current_user_can('manage_options', __FUNCTION__)) {
138 138
             throw new RuntimeException(
139 139
                 esc_html__('You do not have the required privileges to perform this action', 'event_espresso')
140 140
             );
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
         // NOTE! we're not using parent::process() here
144 144
         // because the requests are coming in via ajax
145 145
         // and the request parameters do not match the form schema
146
-        $license_action   = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ACTION ] ?? '';
147
-        $license_key      = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_LICENSE_KEY ] ?? '';
148
-        $item_id          = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ITEM_ID ] ?? 0;
149
-        $item_name        = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_ITEM_NAME ] ?? '';
150
-        $plugin_slug      = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_PLUGIN_SLUG ] ?? '';
151
-        $plugin_version   = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_PLUGIN_VER ] ?? '';
152
-        $min_core_version = $submitted_form_data[ LicenseAPI::REQUEST_PARAM_MIN_CORE_VER ] ?? '';
146
+        $license_action   = $submitted_form_data[LicenseAPI::REQUEST_PARAM_ACTION] ?? '';
147
+        $license_key      = $submitted_form_data[LicenseAPI::REQUEST_PARAM_LICENSE_KEY] ?? '';
148
+        $item_id          = $submitted_form_data[LicenseAPI::REQUEST_PARAM_ITEM_ID] ?? 0;
149
+        $item_name        = $submitted_form_data[LicenseAPI::REQUEST_PARAM_ITEM_NAME] ?? '';
150
+        $plugin_slug      = $submitted_form_data[LicenseAPI::REQUEST_PARAM_PLUGIN_SLUG] ?? '';
151
+        $plugin_version   = $submitted_form_data[LicenseAPI::REQUEST_PARAM_PLUGIN_VER] ?? '';
152
+        $min_core_version = $submitted_form_data[LicenseAPI::REQUEST_PARAM_MIN_CORE_VER] ?? '';
153 153
 
154 154
         /** @var LicenseManager $licence_manager */
155 155
         $licence_manager = LoaderFactory::getShared(LicenseManager::class);
Please login to merge, or discard this patch.
core/domain/services/admin/events/editor/NewEventDefaultEntities.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -30,124 +30,124 @@
 block discarded – undo
30 30
  */
31 31
 class NewEventDefaultEntities extends EventEditorData
32 32
 {
33
-    protected DefaultDatetimes $default_datetimes;
33
+	protected DefaultDatetimes $default_datetimes;
34 34
 
35
-    protected DefaultFormSections $default_form_sections;
35
+	protected DefaultFormSections $default_form_sections;
36 36
 
37 37
 
38
-    /**
39
-     * NewEventDefaultEntities constructor.
40
-     *
41
-     * @param DefaultDatetimes    $default_datetimes
42
-     * @param DefaultFormSections $default_form_sections
43
-     * @param EEM_Datetime        $datetime_model
44
-     * @param EEM_Event           $event_model
45
-     * @param EEM_Price           $price_model
46
-     * @param EEM_Price_Type      $price_type_model
47
-     * @param EEM_Ticket          $ticket_model
48
-     * @param Utilities           $utilities
49
-     */
50
-    public function __construct(
51
-        DefaultDatetimes $default_datetimes,
52
-        DefaultFormSections $default_form_sections,
53
-        EEM_Datetime $datetime_model,
54
-        EEM_Event $event_model,
55
-        EEM_Price $price_model,
56
-        EEM_Price_Type $price_type_model,
57
-        EEM_Ticket $ticket_model,
58
-        Utilities $utilities
59
-    ) {
60
-        $this->default_datetimes     = $default_datetimes;
61
-        $this->default_form_sections = $default_form_sections;
62
-        parent::__construct(
63
-            $datetime_model,
64
-            $event_model,
65
-            $price_model,
66
-            $price_type_model,
67
-            $ticket_model,
68
-            $utilities
69
-        );
70
-    }
38
+	/**
39
+	 * NewEventDefaultEntities constructor.
40
+	 *
41
+	 * @param DefaultDatetimes    $default_datetimes
42
+	 * @param DefaultFormSections $default_form_sections
43
+	 * @param EEM_Datetime        $datetime_model
44
+	 * @param EEM_Event           $event_model
45
+	 * @param EEM_Price           $price_model
46
+	 * @param EEM_Price_Type      $price_type_model
47
+	 * @param EEM_Ticket          $ticket_model
48
+	 * @param Utilities           $utilities
49
+	 */
50
+	public function __construct(
51
+		DefaultDatetimes $default_datetimes,
52
+		DefaultFormSections $default_form_sections,
53
+		EEM_Datetime $datetime_model,
54
+		EEM_Event $event_model,
55
+		EEM_Price $price_model,
56
+		EEM_Price_Type $price_type_model,
57
+		EEM_Ticket $ticket_model,
58
+		Utilities $utilities
59
+	) {
60
+		$this->default_datetimes     = $default_datetimes;
61
+		$this->default_form_sections = $default_form_sections;
62
+		parent::__construct(
63
+			$datetime_model,
64
+			$event_model,
65
+			$price_model,
66
+			$price_type_model,
67
+			$ticket_model,
68
+			$utilities
69
+		);
70
+	}
71 71
 
72 72
 
73
-    /**
74
-     * @param int $eventId
75
-     * @return EE_Datetime[]
76
-     * @throws EE_Error
77
-     * @throws InvalidArgumentException
78
-     * @throws InvalidEntityException
79
-     * @throws ReflectionException
80
-     * @since 5.0.0.p
81
-     */
82
-    public function getData(int $eventId): array
83
-    {
84
-        $EVT_ID = absint($eventId);
85
-        if ($EVT_ID < 1) {
86
-            throw new InvalidArgumentException(
87
-                esc_html__(
88
-                    'A missing or invalid event ID was received.',
89
-                    'event_espresso'
90
-                )
91
-            );
92
-        }
93
-        $event = $this->event_model->get_one_by_ID($EVT_ID);
94
-        if (! $event instanceof EE_Event) {
95
-            throw new InvalidEntityException($event, 'EE_Event');
96
-        }
97
-        $new_event = isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new';
98
-        return [
99
-            'datetimes'     => $this->createDefaultDatetimes($event, $new_event),
100
-            'form_sections' => $this->createDefaultFormSections($event, $new_event),
101
-        ];
102
-    }
73
+	/**
74
+	 * @param int $eventId
75
+	 * @return EE_Datetime[]
76
+	 * @throws EE_Error
77
+	 * @throws InvalidArgumentException
78
+	 * @throws InvalidEntityException
79
+	 * @throws ReflectionException
80
+	 * @since 5.0.0.p
81
+	 */
82
+	public function getData(int $eventId): array
83
+	{
84
+		$EVT_ID = absint($eventId);
85
+		if ($EVT_ID < 1) {
86
+			throw new InvalidArgumentException(
87
+				esc_html__(
88
+					'A missing or invalid event ID was received.',
89
+					'event_espresso'
90
+				)
91
+			);
92
+		}
93
+		$event = $this->event_model->get_one_by_ID($EVT_ID);
94
+		if (! $event instanceof EE_Event) {
95
+			throw new InvalidEntityException($event, 'EE_Event');
96
+		}
97
+		$new_event = isset($_REQUEST['action']) && $_REQUEST['action'] === 'create_new';
98
+		return [
99
+			'datetimes'     => $this->createDefaultDatetimes($event, $new_event),
100
+			'form_sections' => $this->createDefaultFormSections($event, $new_event),
101
+		];
102
+	}
103 103
 
104 104
 
105
-    /**
106
-     * @param EE_Event $event
107
-     * @param bool     $new_event
108
-     * @return EE_Datetime[]
109
-     * @throws EE_Error
110
-     * @throws ReflectionException
111
-     */
112
-    private function createDefaultDatetimes(EE_Event $event, bool $new_event): array
113
-    {
114
-        if ($new_event) {
115
-            return $this->default_datetimes->create($event);
116
-        }
117
-        $datetime_count = $this->datetime_model->count(
118
-            [
119
-                [
120
-                    'EVT_ID'      => $event->ID(),
121
-                    'DTT_deleted' => ['IN', [true, false]],
122
-                ],
123
-                'default_where_conditions' => EE_Default_Where_Conditions::NONE,
124
-            ],
125
-            'EVT_ID'
126
-        );
127
-        return $datetime_count === 0
128
-            ? $this->default_datetimes->create($event)
129
-            : [];
130
-    }
105
+	/**
106
+	 * @param EE_Event $event
107
+	 * @param bool     $new_event
108
+	 * @return EE_Datetime[]
109
+	 * @throws EE_Error
110
+	 * @throws ReflectionException
111
+	 */
112
+	private function createDefaultDatetimes(EE_Event $event, bool $new_event): array
113
+	{
114
+		if ($new_event) {
115
+			return $this->default_datetimes->create($event);
116
+		}
117
+		$datetime_count = $this->datetime_model->count(
118
+			[
119
+				[
120
+					'EVT_ID'      => $event->ID(),
121
+					'DTT_deleted' => ['IN', [true, false]],
122
+				],
123
+				'default_where_conditions' => EE_Default_Where_Conditions::NONE,
124
+			],
125
+			'EVT_ID'
126
+		);
127
+		return $datetime_count === 0
128
+			? $this->default_datetimes->create($event)
129
+			: [];
130
+	}
131 131
 
132 132
 
133
-    /**
134
-     * if it's a new event and defaults have not been created yet, OR if there is no reg form at all...
135
-     *
136
-     * @param EE_Event $event
137
-     * @param bool     $new_event
138
-     * @return EE_Form_Section[]
139
-     * @throws EE_Error
140
-     * @throws ReflectionException
141
-     */
142
-    private function createDefaultFormSections(EE_Event $event, bool $new_event): array
143
-    {
144
-        if ($new_event) {
145
-            return $this->default_form_sections->create($event);
146
-        }
147
-        $reg_form_UUID = $event->registrationFormUuid();
148
-        // if it's a new event and defaults have not been created yet, OR if there is no reg form at all...
149
-        return ! $reg_form_UUID
150
-            ? $this->default_form_sections->create($event)
151
-            : [];
152
-    }
133
+	/**
134
+	 * if it's a new event and defaults have not been created yet, OR if there is no reg form at all...
135
+	 *
136
+	 * @param EE_Event $event
137
+	 * @param bool     $new_event
138
+	 * @return EE_Form_Section[]
139
+	 * @throws EE_Error
140
+	 * @throws ReflectionException
141
+	 */
142
+	private function createDefaultFormSections(EE_Event $event, bool $new_event): array
143
+	{
144
+		if ($new_event) {
145
+			return $this->default_form_sections->create($event);
146
+		}
147
+		$reg_form_UUID = $event->registrationFormUuid();
148
+		// if it's a new event and defaults have not been created yet, OR if there is no reg form at all...
149
+		return ! $reg_form_UUID
150
+			? $this->default_form_sections->create($event)
151
+			: [];
152
+	}
153 153
 }
Please login to merge, or discard this patch.
core/domain/services/cron/CronUtilities.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -7,80 +7,80 @@
 block discarded – undo
7 7
 
8 8
 class CronUtilities
9 9
 {
10
-    public static function logScheduledEspressoCrons(): void
11
-    {
12
-        $ee_crons = [
13
-            'AHEE__EE_Cron_Tasks__update_transaction_with_payment',
14
-            'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
15
-            'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
16
-        ];
17
-        $crons    = (array) get_option('cron');
18
-        foreach ($crons as $cron) {
19
-            /** @var array[] $cron */
20
-            foreach ($ee_crons as $ee_cron) {
21
-                if (isset($cron[ $ee_cron ]) && is_array($cron[ $ee_cron ])) {
22
-                    do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron');
23
-                    foreach ($cron[ $ee_cron ] as $ee_cron_details) {
24
-                        if (! empty($ee_cron_details['args'])) {
25
-                            do_action(
26
-                                'AHEE_log',
27
-                                __CLASS__,
28
-                                __FUNCTION__,
29
-                                print_r($ee_cron_details['args'], true),
30
-                                "$ee_cron args"
31
-                            );
32
-                        }
33
-                    }
34
-                }
35
-            }
36
-        }
37
-    }
10
+	public static function logScheduledEspressoCrons(): void
11
+	{
12
+		$ee_crons = [
13
+			'AHEE__EE_Cron_Tasks__update_transaction_with_payment',
14
+			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
15
+			'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
16
+		];
17
+		$crons    = (array) get_option('cron');
18
+		foreach ($crons as $cron) {
19
+			/** @var array[] $cron */
20
+			foreach ($ee_crons as $ee_cron) {
21
+				if (isset($cron[ $ee_cron ]) && is_array($cron[ $ee_cron ])) {
22
+					do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron');
23
+					foreach ($cron[ $ee_cron ] as $ee_cron_details) {
24
+						if (! empty($ee_cron_details['args'])) {
25
+							do_action(
26
+								'AHEE_log',
27
+								__CLASS__,
28
+								__FUNCTION__,
29
+								print_r($ee_cron_details['args'], true),
30
+								"$ee_cron args"
31
+							);
32
+						}
33
+					}
34
+				}
35
+			}
36
+		}
37
+	}
38 38
 
39 39
 
40
-    /**
41
-     * reschedule_cron_for_transactions_if_maintenance_mode
42
-     * if Maintenance Mode is active, this will reschedule a cron to run again in 10 minutes
43
-     *
44
-     * @param callable $cron_job
45
-     * @param array    $TXN_IDs
46
-     * @return bool
47
-     */
48
-    public static function rescheduleCronForTransactions(callable $cron_job, array $TXN_IDs): bool
49
-    {
50
-        // if database is accessible then return false so cron can run now
51
-        if (DbStatus::isOnline()) {
52
-            return false;
53
-        }
54
-        // reschedule the cron because we can't hit the db right now
55
-        foreach ($TXN_IDs as $TXN_ID => $additional_vars) {
56
-            // reset cron job for the TXN
57
-            call_user_func_array(
58
-                $cron_job,
59
-                array_merge(
60
-                    [
61
-                        time() + (10 * MINUTE_IN_SECONDS),
62
-                        $TXN_ID,
63
-                    ],
64
-                    (array) $additional_vars
65
-                )
66
-            );
67
-        }
68
-        return true;
69
-    }
40
+	/**
41
+	 * reschedule_cron_for_transactions_if_maintenance_mode
42
+	 * if Maintenance Mode is active, this will reschedule a cron to run again in 10 minutes
43
+	 *
44
+	 * @param callable $cron_job
45
+	 * @param array    $TXN_IDs
46
+	 * @return bool
47
+	 */
48
+	public static function rescheduleCronForTransactions(callable $cron_job, array $TXN_IDs): bool
49
+	{
50
+		// if database is accessible then return false so cron can run now
51
+		if (DbStatus::isOnline()) {
52
+			return false;
53
+		}
54
+		// reschedule the cron because we can't hit the db right now
55
+		foreach ($TXN_IDs as $TXN_ID => $additional_vars) {
56
+			// reset cron job for the TXN
57
+			call_user_func_array(
58
+				$cron_job,
59
+				array_merge(
60
+					[
61
+						time() + (10 * MINUTE_IN_SECONDS),
62
+						$TXN_ID,
63
+					],
64
+					(array) $additional_vars
65
+				)
66
+			);
67
+		}
68
+		return true;
69
+	}
70 70
 
71 71
 
72
-    public static function updateMessagesOnSameRequest()
73
-    {
74
-        // verify that WP Cron is not enabled
75
-        if (
76
-            defined('DISABLE_WP_CRON')
77
-            && DISABLE_WP_CRON
78
-            && is_admin()
79
-            && did_action('AHEE__EE_System__load_core_configuration__begin')
80
-            && EE_Network_Config::instance()->core->do_messages_on_same_request !== true
81
-        ) {
82
-            EE_Network_Config::instance()->core->do_messages_on_same_request = true;
83
-            EE_Network_Config::instance()->update_config(true, false);
84
-        }
85
-    }
72
+	public static function updateMessagesOnSameRequest()
73
+	{
74
+		// verify that WP Cron is not enabled
75
+		if (
76
+			defined('DISABLE_WP_CRON')
77
+			&& DISABLE_WP_CRON
78
+			&& is_admin()
79
+			&& did_action('AHEE__EE_System__load_core_configuration__begin')
80
+			&& EE_Network_Config::instance()->core->do_messages_on_same_request !== true
81
+		) {
82
+			EE_Network_Config::instance()->core->do_messages_on_same_request = true;
83
+			EE_Network_Config::instance()->update_config(true, false);
84
+		}
85
+	}
86 86
 }
Please login to merge, or discard this patch.
core/domain/services/cron/jobs/UpdateTransactionsWithPayment.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -21,131 +21,131 @@
 block discarded – undo
21 21
 {
22 22
 
23 23
 
24
-    /**
25
-     * array of TXN IDs and the payment
26
-     *
27
-     * @var array
28
-     */
29
-    protected array $update_transactions_with_payment = [];
24
+	/**
25
+	 * array of TXN IDs and the payment
26
+	 *
27
+	 * @var array
28
+	 */
29
+	protected array $update_transactions_with_payment = [];
30 30
 
31 31
 
32
-    public function setHooks(): void
33
-    {
34
-        add_action(
35
-            'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
36
-            [$this, 'setupUpdateForTransactionWithPayment'],
37
-            10,
38
-            2
39
-        );
40
-    }
32
+	public function setHooks(): void
33
+	{
34
+		add_action(
35
+			'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
36
+			[$this, 'setupUpdateForTransactionWithPayment'],
37
+			10,
38
+			2
39
+		);
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * schedule_update_transaction_with_payment
45
-     * sets a wp_schedule_single_event() for updating any TXNs that may
46
-     * require updating due to recently received payments
47
-     *
48
-     * @param int $timestamp
49
-     * @param int $TXN_ID
50
-     * @param int $PAY_ID
51
-     */
52
-    public static function scheduleUpdateTransactionWithPayment(
53
-        int $timestamp,
54
-        int $TXN_ID,
55
-        int $PAY_ID
56
-    ): void {
57
-        // validate $TXN_ID and $timestamp
58
-        $TXN_ID    = absint($TXN_ID);
59
-        $timestamp = absint($timestamp);
60
-        if ($TXN_ID && $timestamp) {
61
-            wp_schedule_single_event(
62
-                $timestamp,
63
-                'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
64
-                [$TXN_ID, $PAY_ID]
65
-            );
66
-        }
67
-    }
43
+	/**
44
+	 * schedule_update_transaction_with_payment
45
+	 * sets a wp_schedule_single_event() for updating any TXNs that may
46
+	 * require updating due to recently received payments
47
+	 *
48
+	 * @param int $timestamp
49
+	 * @param int $TXN_ID
50
+	 * @param int $PAY_ID
51
+	 */
52
+	public static function scheduleUpdateTransactionWithPayment(
53
+		int $timestamp,
54
+		int $TXN_ID,
55
+		int $PAY_ID
56
+	): void {
57
+		// validate $TXN_ID and $timestamp
58
+		$TXN_ID    = absint($TXN_ID);
59
+		$timestamp = absint($timestamp);
60
+		if ($TXN_ID && $timestamp) {
61
+			wp_schedule_single_event(
62
+				$timestamp,
63
+				'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
64
+				[$TXN_ID, $PAY_ID]
65
+			);
66
+		}
67
+	}
68 68
 
69 69
 
70
-    /**
71
-     * setup_update_for_transaction_with_payment
72
-     * this is the callback for the action hook:
73
-     * 'AHEE__EE_Cron_Tasks__update_transaction_with_payment'
74
-     * which is set up by EE_Cron_Tasks::schedule_update_transaction_with_payment().
75
-     * The passed TXN_ID and associated payment gets added to an array, and then
76
-     * the EE_Cron_Tasks::update_transaction_with_payment() function is hooked into
77
-     * 'shutdown' which will actually handle the processing of any
78
-     * transactions requiring updating, because doing so now would be too early
79
-     * and the required resources may not be available
80
-     *
81
-     * @param int $TXN_ID
82
-     * @param int $PAY_ID
83
-     */
84
-    public function setupUpdateForTransactionWithPayment(int $TXN_ID = 0, int $PAY_ID = 0): void
85
-    {
86
-        if (absint($TXN_ID)) {
87
-            $this->update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
88
-            add_action(
89
-                'shutdown',
90
-                [$this, 'updateTransactionWithPayment'],
91
-                5
92
-            );
93
-        }
94
-    }
70
+	/**
71
+	 * setup_update_for_transaction_with_payment
72
+	 * this is the callback for the action hook:
73
+	 * 'AHEE__EE_Cron_Tasks__update_transaction_with_payment'
74
+	 * which is set up by EE_Cron_Tasks::schedule_update_transaction_with_payment().
75
+	 * The passed TXN_ID and associated payment gets added to an array, and then
76
+	 * the EE_Cron_Tasks::update_transaction_with_payment() function is hooked into
77
+	 * 'shutdown' which will actually handle the processing of any
78
+	 * transactions requiring updating, because doing so now would be too early
79
+	 * and the required resources may not be available
80
+	 *
81
+	 * @param int $TXN_ID
82
+	 * @param int $PAY_ID
83
+	 */
84
+	public function setupUpdateForTransactionWithPayment(int $TXN_ID = 0, int $PAY_ID = 0): void
85
+	{
86
+		if (absint($TXN_ID)) {
87
+			$this->update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
88
+			add_action(
89
+				'shutdown',
90
+				[$this, 'updateTransactionWithPayment'],
91
+				5
92
+			);
93
+		}
94
+	}
95 95
 
96 96
 
97
-    /**
98
-     * update_transaction_with_payment
99
-     * loops through the self::$_abandoned_transactions array
100
-     * and attempts to finalize any TXNs that have not been completed
101
-     * but have had their sessions expired, most likely due to a user not
102
-     * returning from an off-site payment gateway
103
-     *
104
-     * @throws EE_Error
105
-     * @throws DomainException
106
-     * @throws ReflectionException
107
-     * @throws RuntimeException
108
-     */
109
-    public function updateTransactionWithPayment(): void
110
-    {
111
-        if (
112
-            // are there any TXNs that need cleaning up ?
113
-            empty($this->update_transactions_with_payment)
114
-            // reschedule the cron if we can't hit the db right now
115
-            || CronUtilities::rescheduleCronForTransactions(
116
-                [UpdateTransactionsWithPayment::class, 'scheduleUpdateTransactionWithPayment'],
117
-                $this->update_transactions_with_payment
118
-            )
119
-        ) {
120
-            return;
121
-        }
122
-        /** @var EE_Transaction_Processor $transaction_processor */
123
-        $transaction_processor = LoaderFactory::getShared(EE_Transaction_Processor::class);
124
-        if ($transaction_processor instanceof EE_Transaction_Processor) {
125
-            // set revisit flag for payment processor
126
-            $transaction_processor->set_revisit();
127
-        }
128
-        foreach ($this->update_transactions_with_payment as $TXN_ID => $PAY_ID) {
129
-            // reschedule the cron if we can't hit the db right now
130
-            if (DbStatus::isOffline()) {
131
-                // reset cron job for updating the TXN
132
-                UpdateTransactionsWithPayment::scheduleUpdateTransactionWithPayment(
133
-                    time() + CronJob::RESCHEDULE_TIMEOUT,
134
-                    $TXN_ID,
135
-                    $PAY_ID
136
-                );
137
-                continue;
138
-            }
139
-            $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
140
-            $payment     = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
141
-            // verify transaction
142
-            if ($transaction instanceof EE_Transaction && $payment instanceof EE_Payment) {
143
-                // now try to update the TXN with any payments
144
-                /** @var PaymentProcessor $payment_processor */
145
-                $payment_processor = LoaderFactory::getShared(PaymentProcessor::class);
146
-                $payment_processor->updateTransactionBasedOnPayment($transaction, $payment, true, true);
147
-            }
148
-            unset($this->update_transactions_with_payment[ $TXN_ID ]);
149
-        }
150
-    }
97
+	/**
98
+	 * update_transaction_with_payment
99
+	 * loops through the self::$_abandoned_transactions array
100
+	 * and attempts to finalize any TXNs that have not been completed
101
+	 * but have had their sessions expired, most likely due to a user not
102
+	 * returning from an off-site payment gateway
103
+	 *
104
+	 * @throws EE_Error
105
+	 * @throws DomainException
106
+	 * @throws ReflectionException
107
+	 * @throws RuntimeException
108
+	 */
109
+	public function updateTransactionWithPayment(): void
110
+	{
111
+		if (
112
+			// are there any TXNs that need cleaning up ?
113
+			empty($this->update_transactions_with_payment)
114
+			// reschedule the cron if we can't hit the db right now
115
+			|| CronUtilities::rescheduleCronForTransactions(
116
+				[UpdateTransactionsWithPayment::class, 'scheduleUpdateTransactionWithPayment'],
117
+				$this->update_transactions_with_payment
118
+			)
119
+		) {
120
+			return;
121
+		}
122
+		/** @var EE_Transaction_Processor $transaction_processor */
123
+		$transaction_processor = LoaderFactory::getShared(EE_Transaction_Processor::class);
124
+		if ($transaction_processor instanceof EE_Transaction_Processor) {
125
+			// set revisit flag for payment processor
126
+			$transaction_processor->set_revisit();
127
+		}
128
+		foreach ($this->update_transactions_with_payment as $TXN_ID => $PAY_ID) {
129
+			// reschedule the cron if we can't hit the db right now
130
+			if (DbStatus::isOffline()) {
131
+				// reset cron job for updating the TXN
132
+				UpdateTransactionsWithPayment::scheduleUpdateTransactionWithPayment(
133
+					time() + CronJob::RESCHEDULE_TIMEOUT,
134
+					$TXN_ID,
135
+					$PAY_ID
136
+				);
137
+				continue;
138
+			}
139
+			$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
140
+			$payment     = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
141
+			// verify transaction
142
+			if ($transaction instanceof EE_Transaction && $payment instanceof EE_Payment) {
143
+				// now try to update the TXN with any payments
144
+				/** @var PaymentProcessor $payment_processor */
145
+				$payment_processor = LoaderFactory::getShared(PaymentProcessor::class);
146
+				$payment_processor->updateTransactionBasedOnPayment($transaction, $payment, true, true);
147
+			}
148
+			unset($this->update_transactions_with_payment[ $TXN_ID ]);
149
+		}
150
+	}
151 151
 }
Please login to merge, or discard this patch.
core/domain/services/cron/jobs/UpdatePluginLicenseData.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -20,48 +20,48 @@
 block discarded – undo
20 20
  */
21 21
 class UpdatePluginLicenseData extends CronJob
22 22
 {
23
-    public const HOOK = 'AHEE_EventEspresso_core_domain_services_cron_jobs_UpdatePluginLicenseData';
23
+	public const HOOK = 'AHEE_EventEspresso_core_domain_services_cron_jobs_UpdatePluginLicenseData';
24 24
 
25 25
 
26
-    public function setHooks(): void
27
-    {
28
-        add_action(UpdatePluginLicenseData::HOOK, [$this, 'checkCoreLicenseOnShutdown']);
29
-        if (! wp_next_scheduled(UpdatePluginLicenseData::HOOK) && ! wp_installing()) {
30
-            $one_am = strtotime('1:00') + (int) ((float) get_option('gmt_offset', 0) * HOUR_IN_SECONDS);
31
-            wp_schedule_event($one_am, 'daily', UpdatePluginLicenseData::HOOK);
32
-        }
33
-    }
26
+	public function setHooks(): void
27
+	{
28
+		add_action(UpdatePluginLicenseData::HOOK, [$this, 'checkCoreLicenseOnShutdown']);
29
+		if (! wp_next_scheduled(UpdatePluginLicenseData::HOOK) && ! wp_installing()) {
30
+			$one_am = strtotime('1:00') + (int) ((float) get_option('gmt_offset', 0) * HOUR_IN_SECONDS);
31
+			wp_schedule_event($one_am, 'daily', UpdatePluginLicenseData::HOOK);
32
+		}
33
+	}
34 34
 
35 35
 
36
-    public function checkCoreLicenseOnShutdown(): void
37
-    {
38
-        // run license check on shutdown so it doesn't interfere with the rest of the request
39
-        add_action('shutdown', [$this, 'checkCoreLicense']);
40
-    }
36
+	public function checkCoreLicenseOnShutdown(): void
37
+	{
38
+		// run license check on shutdown so it doesn't interfere with the rest of the request
39
+		add_action('shutdown', [$this, 'checkCoreLicense']);
40
+	}
41 41
 
42 42
 
43
-    public function checkCoreLicense(): void
44
-    {
45
-        EE_Dependency_Map::instance()->registerDependencies(
46
-            LicenseManager::class,
47
-            [
48
-                LicenseAPI::class              => EE_Dependency_Map::load_from_cache,
49
-                LicenseKeyData::class          => EE_Dependency_Map::load_from_cache,
50
-                PluginLicenseCollection::class => EE_Dependency_Map::load_from_cache,
51
-            ]
52
-        );
53
-        /** @var PluginLicense $core_license */
54
-        $core_license = $this->loader->getShared(PluginLicense::class);
55
-        /** @var LicenseManager $licence_manager */
56
-        $licence_manager = $this->loader->getShared(LicenseManager::class);
57
-        $licence_manager->checkLicense(
58
-            $core_license->licenseKey(),
59
-            $core_license->itemID(),
60
-            $core_license->itemName(),
61
-            $core_license->pluginSlug(),
62
-            $core_license->version(),
63
-            $core_license->minCoreVersion(),
64
-            $core_license->status()
65
-        );
66
-    }
43
+	public function checkCoreLicense(): void
44
+	{
45
+		EE_Dependency_Map::instance()->registerDependencies(
46
+			LicenseManager::class,
47
+			[
48
+				LicenseAPI::class              => EE_Dependency_Map::load_from_cache,
49
+				LicenseKeyData::class          => EE_Dependency_Map::load_from_cache,
50
+				PluginLicenseCollection::class => EE_Dependency_Map::load_from_cache,
51
+			]
52
+		);
53
+		/** @var PluginLicense $core_license */
54
+		$core_license = $this->loader->getShared(PluginLicense::class);
55
+		/** @var LicenseManager $licence_manager */
56
+		$licence_manager = $this->loader->getShared(LicenseManager::class);
57
+		$licence_manager->checkLicense(
58
+			$core_license->licenseKey(),
59
+			$core_license->itemID(),
60
+			$core_license->itemName(),
61
+			$core_license->pluginSlug(),
62
+			$core_license->version(),
63
+			$core_license->minCoreVersion(),
64
+			$core_license->status()
65
+		);
66
+	}
67 67
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     public function setHooks(): void
27 27
     {
28 28
         add_action(UpdatePluginLicenseData::HOOK, [$this, 'checkCoreLicenseOnShutdown']);
29
-        if (! wp_next_scheduled(UpdatePluginLicenseData::HOOK) && ! wp_installing()) {
29
+        if ( ! wp_next_scheduled(UpdatePluginLicenseData::HOOK) && ! wp_installing()) {
30 30
             $one_am = strtotime('1:00') + (int) ((float) get_option('gmt_offset', 0) * HOUR_IN_SECONDS);
31 31
             wp_schedule_event($one_am, 'daily', UpdatePluginLicenseData::HOOK);
32 32
         }
Please login to merge, or discard this patch.
core/domain/services/cron/CronManager.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -13,59 +13,59 @@
 block discarded – undo
13 13
 
14 14
 class CronManager
15 15
 {
16
-    protected LoaderInterface $loader;
16
+	protected LoaderInterface $loader;
17 17
 
18
-    private static array $cron_jobs = [
19
-        // ExpiredTransactionCheck::class,
20
-        // GarbageCollection::class,
21
-        UpdatePluginLicenseData::class,
22
-        // UpdateTransactionsWithPayment::class,
23
-    ];
18
+	private static array $cron_jobs = [
19
+		// ExpiredTransactionCheck::class,
20
+		// GarbageCollection::class,
21
+		UpdatePluginLicenseData::class,
22
+		// UpdateTransactionsWithPayment::class,
23
+	];
24 24
 
25 25
 
26
-    public function __construct(LoaderInterface $loader)
27
-    {
28
-        $this->loader = $loader;
26
+	public function __construct(LoaderInterface $loader)
27
+	{
28
+		$this->loader = $loader;
29 29
 
30
-    }
30
+	}
31 31
 
32
-    public function initialize(): void
33
-    {
34
-        $this->registerDependencies();
35
-        $this->loadCronJobs();
36
-        add_action(
37
-            'AHEE__EE_System__load_core_configuration__complete',
38
-            [CronUtilities::class, 'updateMessagesOnSameRequest']
39
-        );
40
-    }
32
+	public function initialize(): void
33
+	{
34
+		$this->registerDependencies();
35
+		$this->loadCronJobs();
36
+		add_action(
37
+			'AHEE__EE_System__load_core_configuration__complete',
38
+			[CronUtilities::class, 'updateMessagesOnSameRequest']
39
+		);
40
+	}
41 41
 
42 42
 
43
-    public function registerDependencies()
44
-    {
45
-        foreach (CronManager::$cron_jobs as $cron_class) {
46
-            EE_Dependency_Map::register_dependencies(
47
-                $cron_class,
48
-                [LoaderInterface::class => EE_Dependency_Map::load_from_cache]
49
-            );
50
-        }
51
-    }
43
+	public function registerDependencies()
44
+	{
45
+		foreach (CronManager::$cron_jobs as $cron_class) {
46
+			EE_Dependency_Map::register_dependencies(
47
+				$cron_class,
48
+				[LoaderInterface::class => EE_Dependency_Map::load_from_cache]
49
+			);
50
+		}
51
+	}
52 52
 
53 53
 
54
-    public function loadCronJobs()
55
-    {
56
-        foreach (CronManager::$cron_jobs as $cron_class) {
57
-            $cron_job = $this->loader->getShared($cron_class);
58
-            if (! $cron_job instanceof CronJob) {
59
-                throw new RuntimeException(
60
-                    sprintf(
61
-                        esc_html__('Class %s must be an instance of %s', 'event_espresso'),
62
-                        $cron_class,
63
-                        CronJob::class
64
-                    )
65
-                );
66
-            }
67
-            $cron_job->setHooks();
68
-        }
69
-        // will also need to load EE_Messages_Scheduler::class separately, because it's "special"
70
-    }
54
+	public function loadCronJobs()
55
+	{
56
+		foreach (CronManager::$cron_jobs as $cron_class) {
57
+			$cron_job = $this->loader->getShared($cron_class);
58
+			if (! $cron_job instanceof CronJob) {
59
+				throw new RuntimeException(
60
+					sprintf(
61
+						esc_html__('Class %s must be an instance of %s', 'event_espresso'),
62
+						$cron_class,
63
+						CronJob::class
64
+					)
65
+				);
66
+			}
67
+			$cron_job->setHooks();
68
+		}
69
+		// will also need to load EE_Messages_Scheduler::class separately, because it's "special"
70
+	}
71 71
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     {
56 56
         foreach (CronManager::$cron_jobs as $cron_class) {
57 57
             $cron_job = $this->loader->getShared($cron_class);
58
-            if (! $cron_job instanceof CronJob) {
58
+            if ( ! $cron_job instanceof CronJob) {
59 59
                 throw new RuntimeException(
60 60
                     sprintf(
61 61
                         esc_html__('Class %s must be an instance of %s', 'event_espresso'),
Please login to merge, or discard this patch.
core/domain/services/cron/CronJob.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 
7 7
 abstract class CronJob
8 8
 {
9
-    /**
10
-     * WordPress doesn't allow duplicate crons within 10 minutes of the original,
11
-     * so we'll set our retry time for just over 10 minutes to avoid that
12
-     */
13
-    public const RESCHEDULE_TIMEOUT = 605;
9
+	/**
10
+	 * WordPress doesn't allow duplicate crons within 10 minutes of the original,
11
+	 * so we'll set our retry time for just over 10 minutes to avoid that
12
+	 */
13
+	public const RESCHEDULE_TIMEOUT = 605;
14 14
 
15 15
 
16
-    protected LoaderInterface $loader;
16
+	protected LoaderInterface $loader;
17 17
 
18 18
 
19
-    /**
20
-     * @param LoaderInterface $loader
21
-     */
22
-    public function __construct(LoaderInterface $loader)
23
-    {
24
-        $this->loader = $loader;
25
-    }
19
+	/**
20
+	 * @param LoaderInterface $loader
21
+	 */
22
+	public function __construct(LoaderInterface $loader)
23
+	{
24
+		$this->loader = $loader;
25
+	}
26 26
 
27 27
 
28
-    abstract public function setHooks(): void;
28
+	abstract public function setHooks(): void;
29 29
 }
Please login to merge, or discard this patch.
core/domain/services/registration/form/v1/RegFormHandler.php 2 patches
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -17,290 +17,290 @@
 block discarded – undo
17 17
 
18 18
 class RegFormHandler
19 19
 {
20
-    public EE_Checkout $checkout;
20
+	public EE_Checkout $checkout;
21 21
 
22
-    public RegFormInputHandler $input_handler;
22
+	public RegFormInputHandler $input_handler;
23 23
 
24
-    private RegFormAttendeeFactory $attendee_factory;
24
+	private RegFormAttendeeFactory $attendee_factory;
25 25
 
26
-    private RegistrantData $registrant_data;
26
+	private RegistrantData $registrant_data;
27 27
 
28
-    private EE_Registration_Processor $registration_processor;
28
+	private EE_Registration_Processor $registration_processor;
29 29
 
30
-    /**
31
-     * reg form sections that do not contain inputs
32
-     *
33
-     * @var string[]
34
-     */
35
-    private array $non_input_form_sections = [
36
-        'primary_registrant',
37
-        'additional_attendee_reg_info',
38
-        'spco_copy_attendee_chk',
39
-    ];
30
+	/**
31
+	 * reg form sections that do not contain inputs
32
+	 *
33
+	 * @var string[]
34
+	 */
35
+	private array $non_input_form_sections = [
36
+		'primary_registrant',
37
+		'additional_attendee_reg_info',
38
+		'spco_copy_attendee_chk',
39
+	];
40 40
 
41
-    private bool $valid;
41
+	private bool $valid;
42 42
 
43 43
 
44
-    /**
45
-     * RegFormHandler constructor.
46
-     */
47
-    public function __construct(
48
-        EE_Checkout $checkout,
49
-        RegistrantData $registrant_data,
50
-        RegFormAttendeeFactory $attendee_factory,
51
-        EE_Registration_Processor $registration_processor
52
-    ) {
53
-        $this->checkout               = $checkout;
54
-        $this->registrant_data        = $registrant_data;
55
-        $this->attendee_factory       = $attendee_factory;
56
-        $this->registration_processor = $registration_processor;
57
-        $this->initializeInputHandler();
58
-    }
44
+	/**
45
+	 * RegFormHandler constructor.
46
+	 */
47
+	public function __construct(
48
+		EE_Checkout $checkout,
49
+		RegistrantData $registrant_data,
50
+		RegFormAttendeeFactory $attendee_factory,
51
+		EE_Registration_Processor $registration_processor
52
+	) {
53
+		$this->checkout               = $checkout;
54
+		$this->registrant_data        = $registrant_data;
55
+		$this->attendee_factory       = $attendee_factory;
56
+		$this->registration_processor = $registration_processor;
57
+		$this->initializeInputHandler();
58
+	}
59 59
 
60 60
 
61
-    private function initializeInputHandler()
62
-    {
63
-        $reg_form            = $this->checkout->current_step->reg_form;
64
-        $required_questions  = $reg_form instanceof RegForm ? $reg_form->requiredQuestions() : [];
65
-        $this->input_handler = LoaderFactory::getShared(
66
-            RegFormInputHandler::class,
67
-            [$this->checkout->reg_url_link, $required_questions]
68
-        );
69
-    }
61
+	private function initializeInputHandler()
62
+	{
63
+		$reg_form            = $this->checkout->current_step->reg_form;
64
+		$required_questions  = $reg_form instanceof RegForm ? $reg_form->requiredQuestions() : [];
65
+		$this->input_handler = LoaderFactory::getShared(
66
+			RegFormInputHandler::class,
67
+			[$this->checkout->reg_url_link, $required_questions]
68
+		);
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     * @return int
74
-     */
75
-    public function attendeeCount(): int
76
-    {
77
-        return $this->registrant_data->attendeeCount();
78
-    }
72
+	/**
73
+	 * @return int
74
+	 */
75
+	public function attendeeCount(): int
76
+	{
77
+		return $this->registrant_data->attendeeCount();
78
+	}
79 79
 
80 80
 
81
-    /**
82
-     * @return bool
83
-     */
84
-    private function isInvalid(): bool
85
-    {
86
-        $this->valid = false;
87
-        return $this->valid;
88
-    }
81
+	/**
82
+	 * @return bool
83
+	 */
84
+	private function isInvalid(): bool
85
+	{
86
+		$this->valid = false;
87
+		return $this->valid;
88
+	}
89 89
 
90 90
 
91
-    /**
92
-     * @param EE_Registration[] $registrations
93
-     * @param array[][]         $reg_form_data
94
-     * @return bool
95
-     * @throws EntityNotFoundException
96
-     * @throws EE_Error
97
-     * @throws InvalidArgumentException
98
-     * @throws ReflectionException
99
-     * @throws RuntimeException
100
-     * @throws InvalidDataTypeException
101
-     * @throws InvalidInterfaceException
102
-     */
103
-    public function processRegistrations(array $registrations, array $reg_form_data): bool
104
-    {
105
-        // start off optimistic, then trip this to false if anything goes wrong
106
-        $this->valid = true;
107
-        foreach ($registrations as $registration) {
108
-            // verify EE_Registration object
109
-            if (! $this->isValidRegistration($registration)) {
110
-                return $this->isInvalid();
111
-            }
112
-            $reg_url_link = $registration->reg_url_link();
113
-            // reg_url_link exists ?
114
-            if (! $this->isValidRegUrlLink($reg_url_link)) {
115
-                return $this->isInvalid();
116
-            }
117
-            // should this registration be processed during this visit ?
118
-            if (! $this->checkout->visit_allows_processing_of_this_registration($registration)) {
119
-                continue;
120
-            }
121
-            // if NOT revisiting, then let's save the registration now,
122
-            // so that we have a REG_ID to use when generating other objects
123
-            if (! $this->checkout->revisit) {
124
-                $registration->save();
125
-            }
91
+	/**
92
+	 * @param EE_Registration[] $registrations
93
+	 * @param array[][]         $reg_form_data
94
+	 * @return bool
95
+	 * @throws EntityNotFoundException
96
+	 * @throws EE_Error
97
+	 * @throws InvalidArgumentException
98
+	 * @throws ReflectionException
99
+	 * @throws RuntimeException
100
+	 * @throws InvalidDataTypeException
101
+	 * @throws InvalidInterfaceException
102
+	 */
103
+	public function processRegistrations(array $registrations, array $reg_form_data): bool
104
+	{
105
+		// start off optimistic, then trip this to false if anything goes wrong
106
+		$this->valid = true;
107
+		foreach ($registrations as $registration) {
108
+			// verify EE_Registration object
109
+			if (! $this->isValidRegistration($registration)) {
110
+				return $this->isInvalid();
111
+			}
112
+			$reg_url_link = $registration->reg_url_link();
113
+			// reg_url_link exists ?
114
+			if (! $this->isValidRegUrlLink($reg_url_link)) {
115
+				return $this->isInvalid();
116
+			}
117
+			// should this registration be processed during this visit ?
118
+			if (! $this->checkout->visit_allows_processing_of_this_registration($registration)) {
119
+				continue;
120
+			}
121
+			// if NOT revisiting, then let's save the registration now,
122
+			// so that we have a REG_ID to use when generating other objects
123
+			if (! $this->checkout->revisit) {
124
+				$registration->save();
125
+			}
126 126
 
127
-            if (
128
-                // This allows plugins to trigger a fail on processing of a registration
129
-                // for any conditions they may have for it to pass.
130
-                apply_filters(
131
-                    'FHEE__EventEspresso_core_domain_services_registration_form_v1_RegFormHandler__processRegistrations__bypass',
132
-                    false, // if the plugin returns 'true' then the registration processing is halted.
133
-                    $this->registrant_data->attendeeCount(),
134
-                    $registration,
135
-                    $registrations,
136
-                    $reg_form_data,
137
-                    $this
138
-                )
139
-            ) {
140
-                return $this->isInvalid();
141
-            }
127
+			if (
128
+				// This allows plugins to trigger a fail on processing of a registration
129
+				// for any conditions they may have for it to pass.
130
+				apply_filters(
131
+					'FHEE__EventEspresso_core_domain_services_registration_form_v1_RegFormHandler__processRegistrations__bypass',
132
+					false, // if the plugin returns 'true' then the registration processing is halted.
133
+					$this->registrant_data->attendeeCount(),
134
+					$registration,
135
+					$registrations,
136
+					$reg_form_data,
137
+					$this
138
+				)
139
+			) {
140
+				return $this->isInvalid();
141
+			}
142 142
 
143
-            // Houston, we have a registration!
144
-            if (! $this->processRegistration($registration, $reg_url_link, $reg_form_data)) {
145
-                return $this->isInvalid();
146
-            }
147
-        }
148
-        return $this->valid;
149
-    }
143
+			// Houston, we have a registration!
144
+			if (! $this->processRegistration($registration, $reg_url_link, $reg_form_data)) {
145
+				return $this->isInvalid();
146
+			}
147
+		}
148
+		return $this->valid;
149
+	}
150 150
 
151 151
 
152
-    /**
153
-     * @param string $reg_url_link
154
-     * @return bool
155
-     */
156
-    private function isValidRegUrlLink(string $reg_url_link): bool
157
-    {
158
-        if (! empty($reg_url_link)) {
159
-            return true;
160
-        }
161
-        EE_Error::add_error(
162
-            esc_html__(
163
-                'An invalid or missing line item ID was encountered while attempting to process the registration form.',
164
-                'event_espresso'
165
-            ),
166
-            __FILE__,
167
-            __FUNCTION__,
168
-            __LINE__
169
-        );
170
-        return false;
171
-    }
152
+	/**
153
+	 * @param string $reg_url_link
154
+	 * @return bool
155
+	 */
156
+	private function isValidRegUrlLink(string $reg_url_link): bool
157
+	{
158
+		if (! empty($reg_url_link)) {
159
+			return true;
160
+		}
161
+		EE_Error::add_error(
162
+			esc_html__(
163
+				'An invalid or missing line item ID was encountered while attempting to process the registration form.',
164
+				'event_espresso'
165
+			),
166
+			__FILE__,
167
+			__FUNCTION__,
168
+			__LINE__
169
+		);
170
+		return false;
171
+	}
172 172
 
173 173
 
174
-    /**
175
-     * @param EE_Registration|null $registration
176
-     * @return bool
177
-     */
178
-    private function isValidRegistration(?EE_Registration $registration): bool
179
-    {
180
-        // verify EE_Registration object
181
-        if ($registration instanceof EE_Registration) {
182
-            return true;
183
-        }
184
-        EE_Error::add_error(
185
-            esc_html__(
186
-                'An invalid Registration object was discovered when attempting to process your registration information.',
187
-                'event_espresso'
188
-            ),
189
-            __FILE__,
190
-            __FUNCTION__,
191
-            __LINE__
192
-        );
193
-        return false;
194
-    }
174
+	/**
175
+	 * @param EE_Registration|null $registration
176
+	 * @return bool
177
+	 */
178
+	private function isValidRegistration(?EE_Registration $registration): bool
179
+	{
180
+		// verify EE_Registration object
181
+		if ($registration instanceof EE_Registration) {
182
+			return true;
183
+		}
184
+		EE_Error::add_error(
185
+			esc_html__(
186
+				'An invalid Registration object was discovered when attempting to process your registration information.',
187
+				'event_espresso'
188
+			),
189
+			__FILE__,
190
+			__FUNCTION__,
191
+			__LINE__
192
+		);
193
+		return false;
194
+	}
195 195
 
196 196
 
197
-    /**
198
-     * @param EE_Registration $registration
199
-     * @param string          $reg_url_link
200
-     * @param array[][]       $reg_form_data
201
-     * @return bool
202
-     * @throws EE_Error
203
-     * @throws ReflectionException
204
-     */
205
-    private function processRegistration(
206
-        EE_Registration $registration,
207
-        string $reg_url_link,
208
-        array $reg_form_data
209
-    ): bool {
210
-        $this->registrant_data->initializeRegistrantData($registration);
211
-        if (! $this->processRegFormData($registration, $reg_url_link, $reg_form_data)) {
212
-            return false;
213
-        }
214
-        // RegFormAttendeeFactory
215
-        if (! $this->attendee_factory->create($registration, $reg_url_link)) {
216
-            return false;
217
-        }
218
-        // at this point, we should have enough details about the registrant to consider the registration
219
-        // NOT incomplete
220
-        $this->registration_processor->toggle_incomplete_registration_status_to_default(
221
-            $registration,
222
-            false,
223
-            new Context(
224
-                'spco_reg_step_attendee_information_process_registrations',
225
-                esc_html__(
226
-                    'Finished populating registration with details from the registration form after submitting the Attendee Information Reg Step.',
227
-                    'event_espresso'
228
-                )
229
-            )
230
-        );
231
-        // we can also consider the TXN to not have been failed, so temporarily upgrade its status to
232
-        // abandoned
233
-        $this->checkout->transaction->toggle_failed_transaction_status();
234
-        // if we've gotten this far, then let's save what we have
235
-        $registration->save();
236
-        // add relation between TXN and registration
237
-        $this->associateRegistrationWithTransaction($registration);
238
-        return true;
239
-    }
197
+	/**
198
+	 * @param EE_Registration $registration
199
+	 * @param string          $reg_url_link
200
+	 * @param array[][]       $reg_form_data
201
+	 * @return bool
202
+	 * @throws EE_Error
203
+	 * @throws ReflectionException
204
+	 */
205
+	private function processRegistration(
206
+		EE_Registration $registration,
207
+		string $reg_url_link,
208
+		array $reg_form_data
209
+	): bool {
210
+		$this->registrant_data->initializeRegistrantData($registration);
211
+		if (! $this->processRegFormData($registration, $reg_url_link, $reg_form_data)) {
212
+			return false;
213
+		}
214
+		// RegFormAttendeeFactory
215
+		if (! $this->attendee_factory->create($registration, $reg_url_link)) {
216
+			return false;
217
+		}
218
+		// at this point, we should have enough details about the registrant to consider the registration
219
+		// NOT incomplete
220
+		$this->registration_processor->toggle_incomplete_registration_status_to_default(
221
+			$registration,
222
+			false,
223
+			new Context(
224
+				'spco_reg_step_attendee_information_process_registrations',
225
+				esc_html__(
226
+					'Finished populating registration with details from the registration form after submitting the Attendee Information Reg Step.',
227
+					'event_espresso'
228
+				)
229
+			)
230
+		);
231
+		// we can also consider the TXN to not have been failed, so temporarily upgrade its status to
232
+		// abandoned
233
+		$this->checkout->transaction->toggle_failed_transaction_status();
234
+		// if we've gotten this far, then let's save what we have
235
+		$registration->save();
236
+		// add relation between TXN and registration
237
+		$this->associateRegistrationWithTransaction($registration);
238
+		return true;
239
+	}
240 240
 
241 241
 
242
-    /**
243
-     * @param EE_Registration $registration
244
-     * @param string          $reg_url_link
245
-     * @param array           $reg_form_data
246
-     * @return bool
247
-     * @throws EE_Error
248
-     * @throws ReflectionException
249
-     */
250
-    private function processRegFormData(EE_Registration $registration, string $reg_url_link, array $reg_form_data): bool
251
-    {
252
-        if (! isset($reg_form_data[ $reg_url_link ])) {
253
-            return false;
254
-        }
255
-        // do we need to copy basic info from primary attendee ?
256
-        $copy_primary = isset($reg_form_data[ $reg_url_link ]['additional_attendee_reg_info'])
257
-            && absint($reg_form_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;
258
-        $this->registrant_data->setCopyPrimary($copy_primary);
259
-        // filter form input data for this registration
260
-        $reg_form_data[ $reg_url_link ] = (array) apply_filters(
261
-            'FHEE__EventEspresso_core_domain_services_registration_form_v1_RegFormHandler__processRegFormData__registrant_form_data',
262
-            $reg_form_data[ $reg_url_link ],
263
-            $registration
264
-        );
265
-        if (isset($reg_form_data['primary_attendee'])) {
266
-            $primary_reg_url_link = $reg_form_data['primary_attendee'] ?: '';
267
-            $this->registrant_data->addPrimaryRegistrantDataValue('reg_url_link', $primary_reg_url_link);
268
-            unset($reg_form_data['primary_attendee']);
269
-        }
270
-        // now loop through our array of valid post data && process attendee reg forms
271
-        foreach ($reg_form_data[ $reg_url_link ] as $form_section => $form_inputs) {
272
-            if (in_array($form_section, $this->non_input_form_sections, true)) {
273
-                continue;
274
-            }
275
-            foreach ($form_inputs as $form_input => $input_value) {
276
-                $input_processed = $this->input_handler->processFormInput(
277
-                    $registration,
278
-                    $reg_url_link,
279
-                    $form_input,
280
-                    $input_value
281
-                );
282
-                if (! $input_processed) {
283
-                    return false;
284
-                }
285
-            }
286
-        }
287
-        return true;
288
-    }
242
+	/**
243
+	 * @param EE_Registration $registration
244
+	 * @param string          $reg_url_link
245
+	 * @param array           $reg_form_data
246
+	 * @return bool
247
+	 * @throws EE_Error
248
+	 * @throws ReflectionException
249
+	 */
250
+	private function processRegFormData(EE_Registration $registration, string $reg_url_link, array $reg_form_data): bool
251
+	{
252
+		if (! isset($reg_form_data[ $reg_url_link ])) {
253
+			return false;
254
+		}
255
+		// do we need to copy basic info from primary attendee ?
256
+		$copy_primary = isset($reg_form_data[ $reg_url_link ]['additional_attendee_reg_info'])
257
+			&& absint($reg_form_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;
258
+		$this->registrant_data->setCopyPrimary($copy_primary);
259
+		// filter form input data for this registration
260
+		$reg_form_data[ $reg_url_link ] = (array) apply_filters(
261
+			'FHEE__EventEspresso_core_domain_services_registration_form_v1_RegFormHandler__processRegFormData__registrant_form_data',
262
+			$reg_form_data[ $reg_url_link ],
263
+			$registration
264
+		);
265
+		if (isset($reg_form_data['primary_attendee'])) {
266
+			$primary_reg_url_link = $reg_form_data['primary_attendee'] ?: '';
267
+			$this->registrant_data->addPrimaryRegistrantDataValue('reg_url_link', $primary_reg_url_link);
268
+			unset($reg_form_data['primary_attendee']);
269
+		}
270
+		// now loop through our array of valid post data && process attendee reg forms
271
+		foreach ($reg_form_data[ $reg_url_link ] as $form_section => $form_inputs) {
272
+			if (in_array($form_section, $this->non_input_form_sections, true)) {
273
+				continue;
274
+			}
275
+			foreach ($form_inputs as $form_input => $input_value) {
276
+				$input_processed = $this->input_handler->processFormInput(
277
+					$registration,
278
+					$reg_url_link,
279
+					$form_input,
280
+					$input_value
281
+				);
282
+				if (! $input_processed) {
283
+					return false;
284
+				}
285
+			}
286
+		}
287
+		return true;
288
+	}
289 289
 
290 290
 
291
-    /**
292
-     * @param EE_Registration $registration
293
-     * @return void
294
-     * @throws EE_Error
295
-     * @throws InvalidArgumentException
296
-     * @throws ReflectionException
297
-     * @throws InvalidDataTypeException
298
-     * @throws InvalidInterfaceException
299
-     */
300
-    private function associateRegistrationWithTransaction(EE_Registration $registration)
301
-    {
302
-        // add relation to registration
303
-        $this->checkout->transaction->_add_relation_to($registration, 'Registration');
304
-        $this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
305
-    }
291
+	/**
292
+	 * @param EE_Registration $registration
293
+	 * @return void
294
+	 * @throws EE_Error
295
+	 * @throws InvalidArgumentException
296
+	 * @throws ReflectionException
297
+	 * @throws InvalidDataTypeException
298
+	 * @throws InvalidInterfaceException
299
+	 */
300
+	private function associateRegistrationWithTransaction(EE_Registration $registration)
301
+	{
302
+		// add relation to registration
303
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
304
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
305
+	}
306 306
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
         $this->valid = true;
107 107
         foreach ($registrations as $registration) {
108 108
             // verify EE_Registration object
109
-            if (! $this->isValidRegistration($registration)) {
109
+            if ( ! $this->isValidRegistration($registration)) {
110 110
                 return $this->isInvalid();
111 111
             }
112 112
             $reg_url_link = $registration->reg_url_link();
113 113
             // reg_url_link exists ?
114
-            if (! $this->isValidRegUrlLink($reg_url_link)) {
114
+            if ( ! $this->isValidRegUrlLink($reg_url_link)) {
115 115
                 return $this->isInvalid();
116 116
             }
117 117
             // should this registration be processed during this visit ?
118
-            if (! $this->checkout->visit_allows_processing_of_this_registration($registration)) {
118
+            if ( ! $this->checkout->visit_allows_processing_of_this_registration($registration)) {
119 119
                 continue;
120 120
             }
121 121
             // if NOT revisiting, then let's save the registration now,
122 122
             // so that we have a REG_ID to use when generating other objects
123
-            if (! $this->checkout->revisit) {
123
+            if ( ! $this->checkout->revisit) {
124 124
                 $registration->save();
125 125
             }
126 126
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             }
142 142
 
143 143
             // Houston, we have a registration!
144
-            if (! $this->processRegistration($registration, $reg_url_link, $reg_form_data)) {
144
+            if ( ! $this->processRegistration($registration, $reg_url_link, $reg_form_data)) {
145 145
                 return $this->isInvalid();
146 146
             }
147 147
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      */
156 156
     private function isValidRegUrlLink(string $reg_url_link): bool
157 157
     {
158
-        if (! empty($reg_url_link)) {
158
+        if ( ! empty($reg_url_link)) {
159 159
             return true;
160 160
         }
161 161
         EE_Error::add_error(
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
         array $reg_form_data
209 209
     ): bool {
210 210
         $this->registrant_data->initializeRegistrantData($registration);
211
-        if (! $this->processRegFormData($registration, $reg_url_link, $reg_form_data)) {
211
+        if ( ! $this->processRegFormData($registration, $reg_url_link, $reg_form_data)) {
212 212
             return false;
213 213
         }
214 214
         // RegFormAttendeeFactory
215
-        if (! $this->attendee_factory->create($registration, $reg_url_link)) {
215
+        if ( ! $this->attendee_factory->create($registration, $reg_url_link)) {
216 216
             return false;
217 217
         }
218 218
         // at this point, we should have enough details about the registrant to consider the registration
@@ -249,17 +249,17 @@  discard block
 block discarded – undo
249 249
      */
250 250
     private function processRegFormData(EE_Registration $registration, string $reg_url_link, array $reg_form_data): bool
251 251
     {
252
-        if (! isset($reg_form_data[ $reg_url_link ])) {
252
+        if ( ! isset($reg_form_data[$reg_url_link])) {
253 253
             return false;
254 254
         }
255 255
         // do we need to copy basic info from primary attendee ?
256
-        $copy_primary = isset($reg_form_data[ $reg_url_link ]['additional_attendee_reg_info'])
257
-            && absint($reg_form_data[ $reg_url_link ]['additional_attendee_reg_info']) === 0;
256
+        $copy_primary = isset($reg_form_data[$reg_url_link]['additional_attendee_reg_info'])
257
+            && absint($reg_form_data[$reg_url_link]['additional_attendee_reg_info']) === 0;
258 258
         $this->registrant_data->setCopyPrimary($copy_primary);
259 259
         // filter form input data for this registration
260
-        $reg_form_data[ $reg_url_link ] = (array) apply_filters(
260
+        $reg_form_data[$reg_url_link] = (array) apply_filters(
261 261
             'FHEE__EventEspresso_core_domain_services_registration_form_v1_RegFormHandler__processRegFormData__registrant_form_data',
262
-            $reg_form_data[ $reg_url_link ],
262
+            $reg_form_data[$reg_url_link],
263 263
             $registration
264 264
         );
265 265
         if (isset($reg_form_data['primary_attendee'])) {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             unset($reg_form_data['primary_attendee']);
269 269
         }
270 270
         // now loop through our array of valid post data && process attendee reg forms
271
-        foreach ($reg_form_data[ $reg_url_link ] as $form_section => $form_inputs) {
271
+        foreach ($reg_form_data[$reg_url_link] as $form_section => $form_inputs) {
272 272
             if (in_array($form_section, $this->non_input_form_sections, true)) {
273 273
                 continue;
274 274
             }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                     $form_input,
280 280
                     $input_value
281 281
                 );
282
-                if (! $input_processed) {
282
+                if ( ! $input_processed) {
283 283
                     return false;
284 284
                 }
285 285
             }
Please login to merge, or discard this patch.