getStoreCodeFromRequest($subject); if ($storeCode === null) { return $proceed($name, $default); } if ($name === StoreManager::PARAM_RUN_CODE) { return $storeCode; } if ($name === StoreManager::PARAM_RUN_TYPE) { return 'store'; } return $proceed($name, $default); } private function getStoreCodeFromRequest(Http $request): ?string { $value = $request->getParam(self::QUERY_PARAM_STORE); if ($value !== null && trim((string) $value) !== '') { return trim((string) $value); } $value = $request->getHeader(self::HEADER_STORE_CODE); if ($value !== false && $value !== null && trim((string) $value) !== '') { return trim((string) $value); } $value = $request->getServer('HTTP_X_MAGESAIL_STORE_CODE'); if ($value !== null && $value !== '' && trim((string) $value) !== '') { return trim((string) $value); } return null; } }