From 83ea8004195fc458b6a1653bf7f360a332179322 Mon Sep 17 00:00:00 2001 From: Vedanshu Jain Date: Mon, 23 Dec 2024 13:47:36 +0530 Subject: [PATCH] PHPCS fixes. --- app/src/Store/CheckoutController.php | 5 ++--- app/src/Store/OrderController.php | 20 +++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/src/Store/CheckoutController.php b/app/src/Store/CheckoutController.php index 71f4ca8..bd0fa15 100644 --- a/app/src/Store/CheckoutController.php +++ b/app/src/Store/CheckoutController.php @@ -153,8 +153,7 @@ protected function handle_request(): Controller { ->set_order_from_cart() ->process_payment() ->save_order() - ->empty_cart() - ; + ->empty_cart(); } $order_data = $this->order->to_public_array(); $prefixed_keys = array( 'id', 'key' ); @@ -177,7 +176,7 @@ private function validate_order_from_cart(): CheckoutController { } private function process_payment(): CheckoutController { - $params = $this->get_params_or_exit(); + $params = $this->get_params_or_exit(); if ( ! isset( $params['billing_email'] ) ) { send_error_and_exit( 'missing_billing_email', 400, 'Billing email is required' ); } diff --git a/app/src/Store/OrderController.php b/app/src/Store/OrderController.php index 994aab1..6dbb89e 100644 --- a/app/src/Store/OrderController.php +++ b/app/src/Store/OrderController.php @@ -20,28 +20,28 @@ class OrderController extends Controller { private Order $order; public function __construct( StoreAuth $auth, string $request, SerializableHotStoreInterface $hot_store, SiteInfo $site_info ) { - $this->auth = $auth; + $this->auth = $auth; $this->hot_store = $hot_store; - $this->request = $request; + $this->request = $request; $this->site_info = $site_info; } private function set_order_id_from_request(): OrderController { - $path_parts = explode('/', trim($this->request, '/')); - $this->order_id = (int) end($path_parts); + $path_parts = explode( '/', trim( $this->request, '/' ) ); + $this->order_id = (int) end( $path_parts ); if ( $this->order_id <= 0 ) { send_error_and_exit( 'invalid_request', 400, 'Missing required parameters: order_id' ); } $query_params = array(); - parse_str(parse_url($this->request, PHP_URL_QUERY), $query_params); + parse_str( parse_url( $this->request, PHP_URL_QUERY ), $query_params ); - if (empty($query_params['key'])) { - send_error_and_exit('invalid_request', 400, 'Missing required parameters: key' ); + if ( empty( $query_params['key'] ) ) { + send_error_and_exit( 'invalid_request', 400, 'Missing required parameters: key' ); } - $this->key = $query_params['key']; + $this->key = $query_params['key']; $this->billing_email = $query_params['billing_email'] ?? ''; return $this; } @@ -79,8 +79,7 @@ public function authenticate(): Controller { ->set_order_id_from_request() ->fetch_order() ->validate_order_key() - ->validate_billing_email() - ; + ->validate_billing_email(); return $this; } @@ -88,5 +87,4 @@ public function handle_request(): Controller { echo json_encode( $this->order->to_public_array() ); return $this; } - }