Skip to content

Commit

Permalink
Cast the flags to bool
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Oct 1, 2024
1 parent a6be18f commit 0aa7805
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Gateway/GatewayModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,25 @@ public function services(): array
},
'gateway.getPaymentMethodsAfterFeatureFlag' => static function (ContainerInterface $container): array {
$availablePaymentMethods = $container->get('gateway.listAllMethodsAvailable');
$klarnaOneFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.klarna_one_enabled', true);
$klarnaOneFlag = (bool) apply_filters('inpsyde.feature-flags.mollie-woocommerce.klarna_one_enabled', true);
if (!$klarnaOneFlag) {
$availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::KLARNA;
});
}
$bancomatpayFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.bancomatpay_enabled', true);
$bancomatpayFlag = (bool) apply_filters('inpsyde.feature-flags.mollie-woocommerce.bancomatpay_enabled', true);
if (!$bancomatpayFlag) {
$availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::BANCOMATPAY;
});
}
$almaFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.alma_enabled', true);
$almaFlag = (bool) apply_filters('inpsyde.feature-flags.mollie-woocommerce.alma_enabled', true);
if (!$almaFlag) {
$availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::ALMA;
});
}
$swishFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.swish_enabled', false);
$swishFlag = (bool) apply_filters('inpsyde.feature-flags.mollie-woocommerce.swish_enabled', false);
if (!$swishFlag) {
$availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::SWISH;
Expand Down

0 comments on commit 0aa7805

Please sign in to comment.