mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
♻️ Use the enum in the ActivationDetector
This commit is contained in:
parent
480f3e1893
commit
d1adbf7b46
1 changed files with 5 additions and 7 deletions
|
@ -9,14 +9,12 @@ declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\Settings\Service\BrandedExperience;
|
namespace WooCommerce\PayPalCommerce\Settings\Service\BrandedExperience;
|
||||||
|
|
||||||
|
use WooCommerce\PayPalCommerce\Settings\Enum\InstallationPathEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that includes detection logic for Branded Experience.
|
* Class that includes detection logic for Branded Experience.
|
||||||
*/
|
*/
|
||||||
class ActivationDetector {
|
class ActivationDetector {
|
||||||
public const CORE_PROFILER = 'core-profiler';
|
|
||||||
public const PAYMENT_SETTINGS = 'payment-settings';
|
|
||||||
public const DIRECT = 'direct';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detects from which path the plugin was installed.
|
* Detects from which path the plugin was installed.
|
||||||
*
|
*
|
||||||
|
@ -28,15 +26,15 @@ class ActivationDetector {
|
||||||
$onboarding_data = (array) get_option( 'woocommerce_onboarding_profile', array() );
|
$onboarding_data = (array) get_option( 'woocommerce_onboarding_profile', array() );
|
||||||
if ( ! empty( $onboarding_data['business_extensions'] ) && is_array( $onboarding_data['business_extensions'] ) && in_array( $slug, $onboarding_data['business_extensions'], true )
|
if ( ! empty( $onboarding_data['business_extensions'] ) && is_array( $onboarding_data['business_extensions'] ) && in_array( $slug, $onboarding_data['business_extensions'], true )
|
||||||
) {
|
) {
|
||||||
return self::CORE_PROFILER;
|
return InstallationPathEnum::CORE_PROFILER;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nox_data = (array) get_option( 'woocommerce_payments_nox_profile', array() );
|
$nox_data = (array) get_option( 'woocommerce_payments_nox_profile', array() );
|
||||||
if ( ! empty( $nox_data['extensions']['attached'] ) && is_array( $nox_data['extensions']['attached'] ) && in_array( $slug, array_column( $nox_data['extensions']['attached'], 'slug' ), true )
|
if ( ! empty( $nox_data['extensions']['attached'] ) && is_array( $nox_data['extensions']['attached'] ) && in_array( $slug, array_column( $nox_data['extensions']['attached'], 'slug' ), true )
|
||||||
) {
|
) {
|
||||||
return self::PAYMENT_SETTINGS;
|
return InstallationPathEnum::PAYMENT_SETTINGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::DIRECT;
|
return InstallationPathEnum::DIRECT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue