diff --git a/modules/ppcp-api-client/services.php b/modules/ppcp-api-client/services.php index 4b54692eb..97ca0d149 100644 --- a/modules/ppcp-api-client/services.php +++ b/modules/ppcp-api-client/services.php @@ -71,7 +71,7 @@ return array( }, 'api.bearer' => static function ( $container ): Bearer { - $cache = new Cache('ppcp-paypal-bearer'); + $cache = new Cache( 'ppcp-paypal-bearer' ); $key = $container->get( 'api.key' ); $secret = $container->get( 'api.secret' ); diff --git a/modules/ppcp-api-client/src/Entity/class-applicationcontext.php b/modules/ppcp-api-client/src/Entity/class-applicationcontext.php index 8e7fe461f..51a3ad005 100644 --- a/modules/ppcp-api-client/src/Entity/class-applicationcontext.php +++ b/modules/ppcp-api-client/src/Entity/class-applicationcontext.php @@ -19,7 +19,7 @@ class ApplicationContext { const LANDING_PAGE_LOGIN = 'LOGIN'; const LANDING_PAGE_BILLING = 'BILLING'; const LANDING_PAGE_NO_PREFERENCE = 'NO_PREFERENCE'; - const VALID_LANDING_PAGE_VALUES = array( + const VALID_LANDING_PAGE_VALUES = array( self::LANDING_PAGE_LOGIN, self::LANDING_PAGE_BILLING, self::LANDING_PAGE_NO_PREFERENCE, @@ -28,14 +28,14 @@ class ApplicationContext { const SHIPPING_PREFERENCE_GET_FROM_FILE = 'GET_FROM_FILE'; const SHIPPING_PREFERENCE_NO_SHIPPING = 'NO_SHIPPING'; const SHIPPING_PREFERENCE_SET_PROVIDED_ADDRESS = 'SET_PROVIDED_ADDRESS'; - const VALID_SHIPPING_PREFERENCE_VALUES = array( + const VALID_SHIPPING_PREFERENCE_VALUES = array( self::SHIPPING_PREFERENCE_GET_FROM_FILE, self::SHIPPING_PREFERENCE_NO_SHIPPING, self::SHIPPING_PREFERENCE_SET_PROVIDED_ADDRESS, ); - const USER_ACTION_CONTINUE = 'CONTINUE'; - const USER_ACTION_PAY_NOW = 'PAY_NOW'; + const USER_ACTION_CONTINUE = 'CONTINUE'; + const USER_ACTION_PAY_NOW = 'PAY_NOW'; const VALID_USER_ACTION_VALUES = array( self::USER_ACTION_CONTINUE, self::USER_ACTION_PAY_NOW, diff --git a/modules/ppcp-api-client/src/Entity/class-order.php b/modules/ppcp-api-client/src/Entity/class-order.php index 90d7d44b3..67eb982a3 100644 --- a/modules/ppcp-api-client/src/Entity/class-order.php +++ b/modules/ppcp-api-client/src/Entity/class-order.php @@ -225,13 +225,13 @@ class Order { ), ); if ( $this->create_time() ) { - $order['create_time'] = $this->create_time()->format( "Y-m-d\TH:i:sO" ); + $order['create_time'] = $this->create_time()->format( 'Y-m-d\TH:i:sO' ); } if ( $this->payer() ) { $order['payer'] = $this->payer()->to_array(); } if ( $this->update_time() ) { - $order['update_time'] = $this->update_time()->format( "Y-m-d\TH:i:sO" ); + $order['update_time'] = $this->update_time()->format( 'Y-m-d\TH:i:sO' ); } if ( $this->application_context() ) { $order['application_context'] = $this->application_context()->to_array(); diff --git a/modules/ppcp-api-client/src/Factory/class-orderfactory.php b/modules/ppcp-api-client/src/Factory/class-orderfactory.php index 83aff8175..95cf4231f 100644 --- a/modules/ppcp-api-client/src/Factory/class-orderfactory.php +++ b/modules/ppcp-api-client/src/Factory/class-orderfactory.php @@ -141,10 +141,10 @@ class OrderFactory { ); $create_time = ( isset( $order_data->create_time ) ) ? - \DateTime::createFromFormat( "Y-m-d\TH:i:sO", $order_data->create_time ) + \DateTime::createFromFormat( 'Y-m-d\TH:i:sO', $order_data->create_time ) : null; $update_time = ( isset( $order_data->update_time ) ) ? - \DateTime::createFromFormat( "Y-m-d\TH:i:sO", $order_data->update_time ) + \DateTime::createFromFormat( 'Y-m-d\TH:i:sO', $order_data->update_time ) : null; $payer = ( isset( $order_data->payer ) ) ? $this->payer_factory->from_paypal_response( $order_data->payer ) diff --git a/modules/ppcp-api-client/src/Helper/class-cache.php b/modules/ppcp-api-client/src/Helper/class-cache.php index 6a781a713..2af1e5246 100644 --- a/modules/ppcp-api-client/src/Helper/class-cache.php +++ b/modules/ppcp-api-client/src/Helper/class-cache.php @@ -4,6 +4,7 @@ * * @package WooCommerce\PayPalCommerce\ApiClient\Helper */ + declare( strict_types=1 ); namespace WooCommerce\PayPalCommerce\ApiClient\Helper; @@ -23,9 +24,9 @@ class Cache { /** * Cache constructor. * - * @param string $prefix + * @param string $prefix The prefix for the value keys. */ - public function __construct(string $prefix) { + public function __construct( string $prefix ) { $this->prefix = $prefix; } @@ -36,19 +37,19 @@ class Cache { * * @return mixed */ - public function get(string $key) { - return get_transient($this->prefix . $key); + public function get( string $key ) { + return get_transient( $this->prefix . $key ); } /** * Caches a value. * * @param string $key The key under which the value should be cached. - * @param mixed $value The value to cache. + * @param mixed $value The value to cache. * * @return bool */ - public function set(string $key, $value): bool { - return (bool) set_transient($this->prefix . $key, $value); + public function set( string $key, $value ): bool { + return (bool) set_transient( $this->prefix . $key, $value ); } -} \ No newline at end of file +} diff --git a/modules/ppcp-onboarding/services.php b/modules/ppcp-onboarding/services.php index 436e95b95..5f5847bc9 100644 --- a/modules/ppcp-onboarding/services.php +++ b/modules/ppcp-onboarding/services.php @@ -71,7 +71,7 @@ return array( if ( $state->current_state() < State::STATE_ONBOARDED ) { return new ConnectBearer(); } - $cache = new Cache('ppcp-paypal-bearer'); + $cache = new Cache( 'ppcp-paypal-bearer' ); $key = $container->get( 'api.key' ); $secret = $container->get( 'api.secret' ); @@ -119,7 +119,7 @@ return array( $partner_referrals_data = $container->get( 'api.repository.partner-referrals-data' ); $settings = $container->get( 'wcgateway.settings' ); - $cache = new Cache('ppcp-token'); + $cache = new Cache( 'ppcp-token' ); return new LoginSellerEndpoint( $request_data, $login_seller, diff --git a/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php b/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php index 393a49525..f82c9020e 100644 --- a/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php +++ b/modules/ppcp-onboarding/src/Render/class-onboardingrenderer.php @@ -59,7 +59,7 @@ class OnboardingRenderer { ); ?> - +