Completed
Branch master (e79d92)
by
unknown
06:11
created
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/services/licensing/LicenseAPI.php 1 patch
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -8,158 +8,158 @@
 block discarded – undo
8 8
 
9 9
 class LicenseAPI
10 10
 {
11
-    public const ACTION_ACTIVATE            = 'activate_license';
12
-
13
-    public const ACTION_DEACTIVATE          = 'deactivate_license';
14
-
15
-    public const ACTION_CHECK               = 'check_license';
16
-
17
-    public const ACTION_GET_VERSION         = 'get_version';
18
-
19
-    public const ACTION_RESET               = 'reset_license';
20
-
21
-    public const API_USES_ITEM_ID_OR_NAME   = 'item_id';
22
-
23
-    public const AUTHOR                     = 'Event Espresso';
24
-
25
-    public const REQUEST_PARAM_ACTION       = 'license_action';
26
-
27
-    public const REQUEST_PARAM_ITEM_ID      = 'item_id';
28
-
29
-    public const REQUEST_PARAM_ITEM_NAME    = 'item_name';
30
-
31
-    public const REQUEST_PARAM_LICENSE_KEY  = 'license_key';
32
-
33
-    public const REQUEST_PARAM_MIN_CORE_VER = 'min_core_ver';
34
-
35
-    public const REQUEST_PARAM_PLUGIN_SLUG  = 'plugin_slug';
36
-
37
-    public const REQUEST_PARAM_PLUGIN_VER   = 'plugin_ver';
38
-
39
-    public const URL                        = 'https://my.eventespresso.com/';
40
-
41
-
42
-    /**
43
-     * successful license key API response example:
44
-     *  {
45
-     *      "success": true,
46
-     *      "license": "valid",
47
-     *      "item_id": false (or Item ID if passed)
48
-     *      "item_name": "EDD Product Name",
49
-     *      "license_limit": 0,
50
-     *      "site_count": 2,
51
-     *      "expires": "2020-06-30 23:59:59",
52
-     *      "activations_left": "unlimited",
53
-     *      "checksum": "<md5 checksum>",
54
-     *      "payment_id": 12345,
55
-     *      "customer_name": "John Doe",
56
-     *      "customer_email": "[email protected]",
57
-     *      "price_id": "2"
58
-     *  }
59
-     * failed license key API response example:
60
-     *  {
61
-     *      "success": false,
62
-     *      "license": "invalid",
63
-     *      "item_id": false (or Item ID if passed)
64
-     *      "item_name": "EDD Product Name",
65
-     *      "error": "expired",
66
-     *      "expires": "2020-04-28 23:59:59",
67
-     *      "license_limit": 0,
68
-     *      "site_count": 1,
69
-     *      "activations_left": "unlimited",
70
-     *      "checksum": "<md5 checksum>",
71
-     *      "payment_id": 12345,
72
-     *      "customer_name": "John Doe",
73
-     *      "customer_email": "[email protected]",
74
-     *      "price_id": "2"
75
-     *  }
76
-     *
77
-     * @param string $action
78
-     * @param string $license_key
79
-     * @param string $item_id
80
-     * @param string $item_name
81
-     * @param string $plugin_version
82
-     * @param string $min_core_version
83
-     * @return stdClass
84
-     */
85
-    public function postRequest(
86
-        string $action,
87
-        string $license_key,
88
-        string $item_id,
89
-        string $item_name,
90
-        string $plugin_version,
91
-        string $min_core_version = ''
92
-    ): stdClass {
93
-        $body = [
94
-            'edd_action'                  => $action,
95
-            'event_espresso_core_version' => EVENT_ESPRESSO_VERSION,
96
-            'min_core_version'            => $min_core_version,
97
-            'license'                     => $license_key,
98
-            'version'                     => $plugin_version,
99
-            'php_version'                 => phpversion(),
100
-            'url'                         => home_url(),
101
-            'wp_version'                  => get_bloginfo('version'),
102
-            'environment'                 => function_exists('wp_get_environment_type')
103
-                ? wp_get_environment_type()
104
-                : 'production',
105
-        ];
106
-        // change the item ID or item name based on the API_USES_ITEM_ID_OR_NAME constant
107
-        if (LicenseAPI::API_USES_ITEM_ID_OR_NAME === 'item_name') {
108
-            $body['item_name'] = $item_name;
109
-        } else {
110
-            $body['item_id'] = $item_id;
111
-        }
112
-
113
-        $response = $this->handleApiErrors(
114
-            wp_remote_post(
115
-                LicenseAPI::url(),
116
-                [
117
-                    'timeout' => 15,
118
-                    'body'    => $body,
119
-                ]
120
-            )
121
-        );
122
-        // decode the license data
123
-        return (object) json_decode(wp_remote_retrieve_body($response));
124
-    }
125
-
126
-
127
-    /**
128
-     * @param array|WP_Error $response
129
-     * @return array
130
-     */
131
-    private function handleApiErrors($response): array
132
-    {
133
-        // make sure the response came back okay
134
-        if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
135
-            EE_Error::add_error($response->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
136
-            return ['success' => false, 'error' => true];
137
-        }
138
-        return $response;
139
-    }
140
-
141
-
142
-    public function getProductVersions(array $products): stdClass
143
-    {
144
-        $response = $this->handleApiErrors(
145
-            wp_remote_post(
146
-                LicenseAPI::url(),
147
-                [
148
-                    'timeout' => 15,
149
-                    'body'    => [
150
-                        'edd_action' => LicenseAPI::ACTION_GET_VERSION,
151
-                        'products'   => $products,
152
-                    ],
153
-                ]
154
-            )
155
-        );
156
-        // decode the license data
157
-        return (object) json_decode(wp_remote_retrieve_body($response));
158
-    }
159
-
160
-
161
-    public static function url(): string
162
-    {
163
-        return defined('EDD_LICENSE_API_URL') ? EDD_LICENSE_API_URL : LicenseAPI::URL;
164
-    }
11
+	public const ACTION_ACTIVATE            = 'activate_license';
12
+
13
+	public const ACTION_DEACTIVATE          = 'deactivate_license';
14
+
15
+	public const ACTION_CHECK               = 'check_license';
16
+
17
+	public const ACTION_GET_VERSION         = 'get_version';
18
+
19
+	public const ACTION_RESET               = 'reset_license';
20
+
21
+	public const API_USES_ITEM_ID_OR_NAME   = 'item_id';
22
+
23
+	public const AUTHOR                     = 'Event Espresso';
24
+
25
+	public const REQUEST_PARAM_ACTION       = 'license_action';
26
+
27
+	public const REQUEST_PARAM_ITEM_ID      = 'item_id';
28
+
29
+	public const REQUEST_PARAM_ITEM_NAME    = 'item_name';
30
+
31
+	public const REQUEST_PARAM_LICENSE_KEY  = 'license_key';
32
+
33
+	public const REQUEST_PARAM_MIN_CORE_VER = 'min_core_ver';
34
+
35
+	public const REQUEST_PARAM_PLUGIN_SLUG  = 'plugin_slug';
36
+
37
+	public const REQUEST_PARAM_PLUGIN_VER   = 'plugin_ver';
38
+
39
+	public const URL                        = 'https://my.eventespresso.com/';
40
+
41
+
42
+	/**
43
+	 * successful license key API response example:
44
+	 *  {
45
+	 *      "success": true,
46
+	 *      "license": "valid",
47
+	 *      "item_id": false (or Item ID if passed)
48
+	 *      "item_name": "EDD Product Name",
49
+	 *      "license_limit": 0,
50
+	 *      "site_count": 2,
51
+	 *      "expires": "2020-06-30 23:59:59",
52
+	 *      "activations_left": "unlimited",
53
+	 *      "checksum": "<md5 checksum>",
54
+	 *      "payment_id": 12345,
55
+	 *      "customer_name": "John Doe",
56
+	 *      "customer_email": "[email protected]",
57
+	 *      "price_id": "2"
58
+	 *  }
59
+	 * failed license key API response example:
60
+	 *  {
61
+	 *      "success": false,
62
+	 *      "license": "invalid",
63
+	 *      "item_id": false (or Item ID if passed)
64
+	 *      "item_name": "EDD Product Name",
65
+	 *      "error": "expired",
66
+	 *      "expires": "2020-04-28 23:59:59",
67
+	 *      "license_limit": 0,
68
+	 *      "site_count": 1,
69
+	 *      "activations_left": "unlimited",
70
+	 *      "checksum": "<md5 checksum>",
71
+	 *      "payment_id": 12345,
72
+	 *      "customer_name": "John Doe",
73
+	 *      "customer_email": "[email protected]",
74
+	 *      "price_id": "2"
75
+	 *  }
76
+	 *
77
+	 * @param string $action
78
+	 * @param string $license_key
79
+	 * @param string $item_id
80
+	 * @param string $item_name
81
+	 * @param string $plugin_version
82
+	 * @param string $min_core_version
83
+	 * @return stdClass
84
+	 */
85
+	public function postRequest(
86
+		string $action,
87
+		string $license_key,
88
+		string $item_id,
89
+		string $item_name,
90
+		string $plugin_version,
91
+		string $min_core_version = ''
92
+	): stdClass {
93
+		$body = [
94
+			'edd_action'                  => $action,
95
+			'event_espresso_core_version' => EVENT_ESPRESSO_VERSION,
96
+			'min_core_version'            => $min_core_version,
97
+			'license'                     => $license_key,
98
+			'version'                     => $plugin_version,
99
+			'php_version'                 => phpversion(),
100
+			'url'                         => home_url(),
101
+			'wp_version'                  => get_bloginfo('version'),
102
+			'environment'                 => function_exists('wp_get_environment_type')
103
+				? wp_get_environment_type()
104
+				: 'production',
105
+		];
106
+		// change the item ID or item name based on the API_USES_ITEM_ID_OR_NAME constant
107
+		if (LicenseAPI::API_USES_ITEM_ID_OR_NAME === 'item_name') {
108
+			$body['item_name'] = $item_name;
109
+		} else {
110
+			$body['item_id'] = $item_id;
111
+		}
112
+
113
+		$response = $this->handleApiErrors(
114
+			wp_remote_post(
115
+				LicenseAPI::url(),
116
+				[
117
+					'timeout' => 15,
118
+					'body'    => $body,
119
+				]
120
+			)
121
+		);
122
+		// decode the license data
123
+		return (object) json_decode(wp_remote_retrieve_body($response));
124
+	}
125
+
126
+
127
+	/**
128
+	 * @param array|WP_Error $response
129
+	 * @return array
130
+	 */
131
+	private function handleApiErrors($response): array
132
+	{
133
+		// make sure the response came back okay
134
+		if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
135
+			EE_Error::add_error($response->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
136
+			return ['success' => false, 'error' => true];
137
+		}
138
+		return $response;
139
+	}
140
+
141
+
142
+	public function getProductVersions(array $products): stdClass
143
+	{
144
+		$response = $this->handleApiErrors(
145
+			wp_remote_post(
146
+				LicenseAPI::url(),
147
+				[
148
+					'timeout' => 15,
149
+					'body'    => [
150
+						'edd_action' => LicenseAPI::ACTION_GET_VERSION,
151
+						'products'   => $products,
152
+					],
153
+				]
154
+			)
155
+		);
156
+		// decode the license data
157
+		return (object) json_decode(wp_remote_retrieve_body($response));
158
+	}
159
+
160
+
161
+	public static function url(): string
162
+	{
163
+		return defined('EDD_LICENSE_API_URL') ? EDD_LICENSE_API_URL : LicenseAPI::URL;
164
+	}
165 165
 }
Please login to merge, or discard this patch.
core/services/licensing/LicenseKeyData.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -16,85 +16,85 @@
 block discarded – undo
16 16
  */
17 17
 class LicenseKeyData extends WordPressOption
18 18
 {
19
-    /**
20
-     * The name of the WordPress option where license data is stored.
21
-     */
22
-    const OPTION_NAME = 'event-espresso-license-keys';
19
+	/**
20
+	 * The name of the WordPress option where license data is stored.
21
+	 */
22
+	const OPTION_NAME = 'event-espresso-license-keys';
23 23
 
24
-    private static array $no_license = [
25
-        'item_id'     => false,
26
-        'item_name'   => '',
27
-        'license'     => 'none',
28
-        'license_key' => '',
29
-        'success'     => false,
30
-    ];
24
+	private static array $no_license = [
25
+		'item_id'     => false,
26
+		'item_name'   => '',
27
+		'license'     => 'none',
28
+		'license_key' => '',
29
+		'success'     => false,
30
+	];
31 31
 
32 32
 
33
-    public function __construct()
34
-    {
35
-        parent::__construct(LicenseKeyData::OPTION_NAME, [], true);
36
-    }
33
+	public function __construct()
34
+	{
35
+		parent::__construct(LicenseKeyData::OPTION_NAME, [], true);
36
+	}
37 37
 
38 38
 
39
-    /**
40
-     * Retrieves all stored license data for all plugins.
41
-     *
42
-     * @return array An associative array of all license data, keyed by plugin identifier.
43
-     */
44
-    public function getAllLicenses(): array
45
-    {
46
-        return $this->loadOption();
47
-    }
39
+	/**
40
+	 * Retrieves all stored license data for all plugins.
41
+	 *
42
+	 * @return array An associative array of all license data, keyed by plugin identifier.
43
+	 */
44
+	public function getAllLicenses(): array
45
+	{
46
+		return $this->loadOption();
47
+	}
48 48
 
49 49
 
50
-    /**
51
-     * Retrieves the license data for a specific plugin.
52
-     *
53
-     * @param string $plugin The plugin identifier.
54
-     * @return stdClass An object containing the license data for the specified plugin.
55
-     *                       Returns a default structure if no data exists.
56
-     */
57
-    public function getLicenseDataForPlugin(string $plugin): stdCLass
58
-    {
59
-        $licenses     = $this->loadOption();
60
-        $license_data = $licenses[ $plugin ] ?? LicenseKeyData::$no_license;
61
-        return (object) $license_data;
62
-    }
50
+	/**
51
+	 * Retrieves the license data for a specific plugin.
52
+	 *
53
+	 * @param string $plugin The plugin identifier.
54
+	 * @return stdClass An object containing the license data for the specified plugin.
55
+	 *                       Returns a default structure if no data exists.
56
+	 */
57
+	public function getLicenseDataForPlugin(string $plugin): stdCLass
58
+	{
59
+		$licenses     = $this->loadOption();
60
+		$license_data = $licenses[ $plugin ] ?? LicenseKeyData::$no_license;
61
+		return (object) $license_data;
62
+	}
63 63
 
64 64
 
65
-    /**
66
-     * Updates or adds the license data for a specific plugin.
67
-     *
68
-     * @param stdClass $license_data The new license data to store.
69
-     * @param string   $plugin       The plugin identifier.
70
-     * @param bool     $force_update Whether to force the update operation.
71
-     * @return int The result of the update operation.
72
-     */
73
-    public function updateLicenseDataForPlugin(stdCLass $license_data, string $plugin, bool $force_update = false): int
74
-    {
75
-        if (! isset($license_data->success) || (bool) $license_data->success !== true) {
76
-            return WordPressOption::UPDATE_NONE;
77
-        }
78
-        $licenses = $this->loadOption();
79
-        // convert objects to array and merge new data with old
80
-        $licenses[ $plugin ] = (array) $license_data;
81
-        // then sort by key and convert back to stdCLass
82
-        ksort($licenses[ $plugin ]);
83
-        $licenses[ $plugin ] = (object) $licenses[ $plugin ];
84
-        return $this->updateOption($licenses, $force_update);
85
-    }
65
+	/**
66
+	 * Updates or adds the license data for a specific plugin.
67
+	 *
68
+	 * @param stdClass $license_data The new license data to store.
69
+	 * @param string   $plugin       The plugin identifier.
70
+	 * @param bool     $force_update Whether to force the update operation.
71
+	 * @return int The result of the update operation.
72
+	 */
73
+	public function updateLicenseDataForPlugin(stdCLass $license_data, string $plugin, bool $force_update = false): int
74
+	{
75
+		if (! isset($license_data->success) || (bool) $license_data->success !== true) {
76
+			return WordPressOption::UPDATE_NONE;
77
+		}
78
+		$licenses = $this->loadOption();
79
+		// convert objects to array and merge new data with old
80
+		$licenses[ $plugin ] = (array) $license_data;
81
+		// then sort by key and convert back to stdCLass
82
+		ksort($licenses[ $plugin ]);
83
+		$licenses[ $plugin ] = (object) $licenses[ $plugin ];
84
+		return $this->updateOption($licenses, $force_update);
85
+	}
86 86
 
87 87
 
88
-    /**
89
-     * Removes the license data for a specific plugin.
90
-     *
91
-     * @param string $plugin The plugin identifier.
92
-     * @return int The result of the remove operation.
93
-     */
94
-    public function removeLicenseDataForPlugin(string $plugin): int
95
-    {
96
-        $licenses = $this->loadOption();
97
-        unset($licenses[ $plugin ]);
98
-        return $this->updateOption($licenses);
99
-    }
88
+	/**
89
+	 * Removes the license data for a specific plugin.
90
+	 *
91
+	 * @param string $plugin The plugin identifier.
92
+	 * @return int The result of the remove operation.
93
+	 */
94
+	public function removeLicenseDataForPlugin(string $plugin): int
95
+	{
96
+		$licenses = $this->loadOption();
97
+		unset($licenses[ $plugin ]);
98
+		return $this->updateOption($licenses);
99
+	}
100 100
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public function getLicenseDataForPlugin(string $plugin): stdCLass
58 58
     {
59 59
         $licenses     = $this->loadOption();
60
-        $license_data = $licenses[ $plugin ] ?? LicenseKeyData::$no_license;
60
+        $license_data = $licenses[$plugin] ?? LicenseKeyData::$no_license;
61 61
         return (object) $license_data;
62 62
     }
63 63
 
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function updateLicenseDataForPlugin(stdCLass $license_data, string $plugin, bool $force_update = false): int
74 74
     {
75
-        if (! isset($license_data->success) || (bool) $license_data->success !== true) {
75
+        if ( ! isset($license_data->success) || (bool) $license_data->success !== true) {
76 76
             return WordPressOption::UPDATE_NONE;
77 77
         }
78 78
         $licenses = $this->loadOption();
79 79
         // convert objects to array and merge new data with old
80
-        $licenses[ $plugin ] = (array) $license_data;
80
+        $licenses[$plugin] = (array) $license_data;
81 81
         // then sort by key and convert back to stdCLass
82
-        ksort($licenses[ $plugin ]);
83
-        $licenses[ $plugin ] = (object) $licenses[ $plugin ];
82
+        ksort($licenses[$plugin]);
83
+        $licenses[$plugin] = (object) $licenses[$plugin];
84 84
         return $this->updateOption($licenses, $force_update);
85 85
     }
86 86
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     public function removeLicenseDataForPlugin(string $plugin): int
95 95
     {
96 96
         $licenses = $this->loadOption();
97
-        unset($licenses[ $plugin ]);
97
+        unset($licenses[$plugin]);
98 98
         return $this->updateOption($licenses);
99 99
     }
100 100
 }
Please login to merge, or discard this patch.