refact: Rename must_be_visible to is_incentive_visible for clarity

This commit is contained in:
Vlad Olaru 2024-09-19 13:06:02 +03:00
parent 51033673ca
commit 4709f85b64
No known key found for this signature in database
4 changed files with 11 additions and 11 deletions

View File

@ -117,7 +117,7 @@ class Payments extends Task {
}
// Check if there is an active WooPayments incentive via the welcome page.
if ( WcPayWelcomePage::instance()->must_be_visible() ) {
if ( WcPayWelcomePage::instance()->is_incentive_visible() ) {
// Point to the WooPayments welcome page.
return add_query_arg( 'from', 'WCADMIN_PAYMENT_TASK', admin_url( 'admin.php?page=wc-admin&path=/wc-pay-welcome-page' ) );
}

View File

@ -38,8 +38,8 @@ class PaymentsMoreInfoNeeded {
* @return bool
*/
public static function should_display_note() {
// WCPay welcome page must not be visible.
if ( WcPayWelcomePage::instance()->must_be_visible() ) {
// WooPayments incentive must not be visible.
if ( WcPayWelcomePage::instance()->is_incentive_visible() ) {
return false;
}

View File

@ -38,8 +38,8 @@ class PaymentsRemindMeLater {
* @return bool
*/
public static function should_display_note() {
// WCPay welcome page must be visible.
if ( ! WcPayWelcomePage::instance()->must_be_visible() ) {
// WooPayments incentive must be visible.
if ( ! WcPayWelcomePage::instance()->is_incentive_visible() ) {
return false;
}

View File

@ -51,13 +51,13 @@ class WcPayWelcomePage {
}
/**
* Whether the WooPayments welcome page should be visible.
* Whether the WooPayments incentive should be visible.
*
* @param bool $skip_wcpay_active Whether to skip the check for the WooPayments plugin being active.
*
* @return boolean
*/
public function must_be_visible( $skip_wcpay_active = false ): bool {
public function is_incentive_visible( $skip_wcpay_active = false ): bool {
// The WooPayments plugin must not be active.
if ( ! $skip_wcpay_active && $this->is_wcpay_active() ) {
return false;
@ -167,7 +167,7 @@ class WcPayWelcomePage {
}
// Return early if the incentive must not be visible.
if ( ! $this->must_be_visible() ) {
if ( ! $this->is_incentive_visible() ) {
return $settings;
}
@ -186,7 +186,7 @@ class WcPayWelcomePage {
// Note: We need to disregard if WooPayments is active when adding the promo note to the list of
// allowed promo notes. The AJAX call that adds the promo note happens after WooPayments is installed and activated.
// Return early if the incentive page must not be visible, without checking if WooPayments is active.
if ( ! $this->must_be_visible( true ) ) {
if ( ! $this->is_incentive_visible( true ) ) {
return $promo_notes;
}
@ -205,7 +205,7 @@ class WcPayWelcomePage {
*/
public function onboarding_task_badge( string $badge ): string {
// Return early if the incentive must not be visible.
if ( ! $this->must_be_visible() ) {
if ( ! $this->is_incentive_visible() ) {
return $badge;
}
@ -221,7 +221,7 @@ class WcPayWelcomePage {
*/
public function onboarding_task_additional_data( ?array $additional_data ): ?array {
// Return early if the incentive must not be visible.
if ( ! $this->must_be_visible() ) {
if ( ! $this->is_incentive_visible() ) {
return $additional_data;
}