From 7eb85cb7cce608c761ecf9060f05b89036994ce3 Mon Sep 17 00:00:00 2001 From: vgumonis <43743406+vgumonis@users.noreply.github.com> Date: Mon, 23 Dec 2024 19:51:11 +0200 Subject: [PATCH] update return types --- .github/workflows/wpcs.yml | 2 +- ...oingate-for-woocommerce-blocks-support.php | 27 ++++++++++++++++--- .../class-coingate-for-woocommerce-public.php | 3 +-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/wpcs.yml b/.github/workflows/wpcs.yml index 10049a1..58ee4a8 100644 --- a/.github/workflows/wpcs.yml +++ b/.github/workflows/wpcs.yml @@ -16,4 +16,4 @@ jobs: - name: Install PHP Dependencies uses: "ramsey/composer-install@v2" - name: Coding Standards - run: composer phpcs --ignore=build/* . \ No newline at end of file + run: composer phpcs --ignore=woocommerce-plugin/woocommerce-plugin/build/* . \ No newline at end of file diff --git a/includes/class-coingate-for-woocommerce-blocks-support.php b/includes/class-coingate-for-woocommerce-blocks-support.php index 5b86cba..35ca316 100644 --- a/includes/class-coingate-for-woocommerce-blocks-support.php +++ b/includes/class-coingate-for-woocommerce-blocks-support.php @@ -6,15 +6,29 @@ final class Coingate_For_Woocommerce_Blocks_Support extends AbstractPaymentMetho private $gateway; protected $name = 'coingate'; // payment gateway id - public function initialize() { + + /** + * Init + */ + public function initialize(): array { $this->settings = get_option( "woocommerce_coingate_settings", array() ); } - public function is_active() { + /** + * payment method enabled. + * + * @return bool + */ + public function is_active(): bool { return ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled']; } - public function get_payment_method_script_handles() { + /** + * Script to use + * + * @return array + */ + public function get_payment_method_script_handles(): array { wp_register_script( 'wc-coingate-blocks-integration', @@ -32,7 +46,12 @@ public function get_payment_method_script_handles() { return array( 'wc-coingate-blocks-integration' ); } - public function get_payment_method_data() { + /** + * Payment method data + * + * @return array + */ + public function get_payment_method_data(): array { return [ 'title' => $this->get_setting( 'title' ), 'description' => $this->get_setting( 'description' ), diff --git a/public/class-coingate-for-woocommerce-public.php b/public/class-coingate-for-woocommerce-public.php index 44bb8a4..cc41426 100644 --- a/public/class-coingate-for-woocommerce-public.php +++ b/public/class-coingate-for-woocommerce-public.php @@ -73,7 +73,6 @@ public function register_payment_gateway( array $methods ) { /** * Enable Block support - * */ public function woocommerce_gateway_coingate_block_support() { require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-coingate-for-woocommerce-blocks-support.php'; @@ -81,7 +80,7 @@ public function woocommerce_gateway_coingate_block_support() { add_action( 'woocommerce_blocks_payment_method_type_registration', function ( \Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) { - $payment_method_registry->register( new Coingate_For_Woocommerce_Blocks_Support ); + $payment_method_registry->register( new Coingate_For_Woocommerce_Blocks_Support() ); } ); }