From 6410733cac3c52fb4b6421182a130458c8715e73 Mon Sep 17 00:00:00 2001 From: Nahid Bin Azhar Date: Mon, 11 Sep 2023 14:49:13 +0600 Subject: [PATCH] code fix with php-cs-fix --- src/Actions/InstallShop.php | 2 -- src/Http/Middleware/IframeProtection.php | 4 ++-- src/Http/Middleware/VerifyShopify.php | 4 +++- src/Util.php | 8 ++++---- src/resources/config/shopify-app.php | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Actions/InstallShop.php b/src/Actions/InstallShop.php index da56d41a..9f0a22b3 100644 --- a/src/Actions/InstallShop.php +++ b/src/Actions/InstallShop.php @@ -66,7 +66,6 @@ public function __construct( */ public function __invoke(ShopDomain $shopDomain, ?string $code): array { - if (!$this->isValidShop($shopDomain)) { return [ 'completed' => false, @@ -135,5 +134,4 @@ public function isValidShop(ShopDomain $shopDomain): bool return $isMatched === 1; } - } diff --git a/src/Http/Middleware/IframeProtection.php b/src/Http/Middleware/IframeProtection.php index d14078b6..e03bacd3 100644 --- a/src/Http/Middleware/IframeProtection.php +++ b/src/Http/Middleware/IframeProtection.php @@ -59,10 +59,10 @@ function () use ($request) { ? $shop->name : '*.myshopify.com'; - $iframeAncestors = "frame-ancestors https://admin.shopify.com https://$domain"; + $iframeAncestors = "frame-ancestors https://$domain https://admin.shopify.com"; if (!blank($ancestors)) { - $iframeAncestors .= ' ' . $ancestors; + $iframeAncestors .= ' '.$ancestors; } $response->headers->set( diff --git a/src/Http/Middleware/VerifyShopify.php b/src/Http/Middleware/VerifyShopify.php index 3650cb32..b7d43e60 100644 --- a/src/Http/Middleware/VerifyShopify.php +++ b/src/Http/Middleware/VerifyShopify.php @@ -83,7 +83,7 @@ public function __construct( * @param Request $request The request object. * @param Closure $next The next action. * - * @throws SignatureVerificationException If HMAC verification fails. + * @throws SignatureVerificationException|HttpException If HMAC verification fails. * * @return mixed */ @@ -107,6 +107,7 @@ public function handle(Request $request, Closure $next) if ($storeResult) { $this->loginFromShop($shop); + return $next($request); } } @@ -533,6 +534,7 @@ protected function getShopIfAlreadyInstalled(Request $request): ?ShopModel * Login and validate store * * @param ShopModel $shop + * * @return void */ protected function loginFromShop(ShopModel $shop): void diff --git a/src/Util.php b/src/Util.php index b2f03765..293bf7cb 100644 --- a/src/Util.php +++ b/src/Util.php @@ -36,7 +36,7 @@ public static function createHmac(array $opts, string $secret): Hmac ksort($data); $queryCompiled = []; foreach ($data as $key => $value) { - $queryCompiled[] = "{$key}=" . (is_array($value) ? implode(',', $value) : $value); + $queryCompiled[] = "{$key}=".(is_array($value) ? implode(',', $value) : $value); } $data = implode( $buildQueryWithJoin ? '&' : '', @@ -72,7 +72,7 @@ public static function parseQueryString(string $queryString, string $delimiter = $params = []; $split = preg_split( - $delimiter ? $commonSeparator[$delimiter] || '/[' . $delimiter . ']\s*/' : $defaultSeparator, + $delimiter ? $commonSeparator[$delimiter] || '/['.$delimiter.']\s*/' : $defaultSeparator, $queryString ?? '' ); @@ -229,7 +229,7 @@ public static function getShopsTable(): string */ public static function getShopsTableForeignKey(): string { - return Str::singular(self::getShopsTable()) . '_id'; + return Str::singular(self::getShopsTable()).'_id'; } /** @@ -251,6 +251,6 @@ public static function hasAppLegacySupport(string $feature): bool { $legacySupports = self::getShopifyConfig('app_legacy_supports') ?? []; - return (bool)Arr::get($legacySupports, $feature, true); + return (bool) Arr::get($legacySupports, $feature, true); } } diff --git a/src/resources/config/shopify-app.php b/src/resources/config/shopify-app.php index 0f1ab28b..cda82baf 100644 --- a/src/resources/config/shopify-app.php +++ b/src/resources/config/shopify-app.php @@ -539,26 +539,26 @@ */ 'theme_support' => [ - /** + /* * Specify the name of the template the app will integrate with */ 'templates' => ['product', 'collection', 'index'], - /** + /* * Interval for caching the request: minutes, seconds, hours, days, etc. */ 'cache_interval' => 'hours', - /** + /* * Cache duration */ 'cache_duration' => '12', - /** + /* * At which levels of theme support the use of "theme app extension" is not available * and script tags will be installed. * Available levels: FULL, PARTIAL, UNSUPPORTED. */ 'unacceptable_levels' => [ - Osiset\ShopifyApp\Objects\Enums\ThemeSupportLevel::UNSUPPORTED - ] + Osiset\ShopifyApp\Objects\Enums\ThemeSupportLevel::UNSUPPORTED, + ], ], /*