Skip to content

Commit 2af0cf1

Browse files
committed
Review Comments
1 parent 55fc602 commit 2af0cf1

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

includes/Services/StatusService.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
use NewfoldLabs\WP\Module\Onboarding\WP_Admin;
77
use NewfoldLabs\WP\Module\Onboarding\Data\Config;
88

9-
use function NewfoldLabs\WP\ModuleLoader\container;
10-
119
/**
1210
* Tracks the Status of Onboarding.
1311
*/
@@ -18,7 +16,7 @@ class StatusService {
1816
*
1917
* @return void
2018
*/
21-
public static function handle_started() {
19+
public static function handle_started(): void {
2220
if ( 'started' !== get_option( Options::get_option_name( 'status' ) ) ) {
2321
update_option( Options::get_option_name( 'status' ), 'started' );
2422
do_action( 'newfold/onboarding/started' );
@@ -30,7 +28,7 @@ public static function handle_started() {
3028
*
3129
* @return void
3230
*/
33-
public static function handle_completed() {
31+
public static function handle_completed(): void {
3432
if ( 'started' === get_option( Options::get_option_name( 'status' ) ) ) {
3533
update_option( Options::get_option_name( 'status' ), 'completed' );
3634
self::update_onboarding_restart_status();
@@ -44,7 +42,7 @@ public static function handle_completed() {
4442
*
4543
* @return bool True if the site was created within the last 275 days, false otherwise.
4644
*/
47-
private static function is_site_created_within_last_9_months() {
45+
private static function is_site_created_within_last_9_months(): bool {
4846
$install_date_timestamp = get_option( Options::get_option_name( 'bluehost_plugin_install_date', false ) );
4947

5048
// If the option is not set or is invalid, return false
@@ -63,7 +61,7 @@ private static function is_site_created_within_last_9_months() {
6361
*
6462
* @return bool True if eligible, false otherwise.
6563
*/
66-
public static function is_onboarding_restart_eligible() {
64+
public static function is_onboarding_restart_eligible(): bool {
6765
// Check if the brand is eligible for Restarting Onboarding
6866
$brand_config = Brands::get_brands()[ NFD_ONBOARDING_PLUGIN_BRAND ]['config'] ?? array();
6967
if ( empty( $brand_config['canRestartOnboarding'] ) || ! $brand_config['canRestartOnboarding'] ) {
@@ -83,7 +81,7 @@ public static function is_onboarding_restart_eligible() {
8381
*
8482
* @return void
8583
*/
86-
public static function update_onboarding_restart_status() {
84+
public static function update_onboarding_restart_status(): void {
8785

8886
// Don't do anything if the customer is not eligible
8987
if ( ! self::is_onboarding_restart_eligible() ) {
@@ -93,7 +91,7 @@ public static function update_onboarding_restart_status() {
9391
// Get flow data
9492
$flow_data = get_option( Options::get_option_name( 'flow' ) );
9593

96-
if ( isset( $flow_data ) ) {
94+
if ( isset( $flow_data['onboardingRetries'] ) && ! empty( $flow_data['onboardingRetries'] ) ) {
9795
// Increment the total onboarding tries
9896
$flow_data['onboardingRetries']['retryCount'] = ( $flow_data['onboardingRetries']['retryCount'] ?? 0 ) + 1;
9997

@@ -102,7 +100,7 @@ public static function update_onboarding_restart_status() {
102100

103101
// Determine eligibility for restarting onboarding
104102
$current_retry_count = $flow_data['onboardingRetries']['retryCount'];
105-
$can_restart = $current_retry_count < $flow_data['onboardingRetries']['maxRetryCount'];
103+
$can_restart = $current_retry_count < $flow_data['onboardingRetries']['maxRetryCount'];
106104

107105
// Update the eligibility status in wp_option
108106
update_option( Options::get_option_name( 'can_restart' ), $can_restart );
@@ -114,7 +112,7 @@ public static function update_onboarding_restart_status() {
114112
*
115113
* @return void
116114
*/
117-
public static function track() {
115+
public static function track(): void {
118116
global $pagenow;
119117

120118
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {

includes/WP_Admin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public static function mark_sitegen_generated_themes() {
233233
*
234234
* @return void
235235
*/
236-
public static function set_onboarding_restart_option() {
236+
public static function set_onboarding_restart_option(): void {
237237
// Check if the customer is eligible for onboarding restart
238238
if ( StatusService::is_onboarding_restart_eligible() ) {
239239
// Get the option name for 'can_restart'
@@ -252,7 +252,7 @@ public static function set_onboarding_restart_option() {
252252
*
253253
* @return void
254254
*/
255-
public static function can_restart_onboarding() {
255+
public static function can_restart_onboarding(): void {
256256
$can_restart = get_option( Options::get_option_name( 'can_restart' ), false );
257257

258258
// If the customer in ineligible for restart don't enqueue scripts

0 commit comments

Comments
 (0)