if (!\
is_array($shopId)) { $newShopId =
$this->
generateShopId();
$this->systemConfigService->
set(self::SHOP_ID_SYSTEM_CONFIG_KEY,
[ 'app_url' => EnvironmentHelper::
getVariable('APP_URL'
),
'value' =>
$newShopId,
]);
return $newShopId;
} if (EnvironmentHelper::
getVariable('APP_URL'
) !== ($shopId['app_url'
] ?? ''
)) { if ($this->
hasApps()) { /** @var string $appUrl */
$appUrl = EnvironmentHelper::
getVariable('APP_URL'
);
throw new AppUrlChangeDetectedException($shopId['app_url'
],
$appUrl);
} // if the shop does not have any apps we can update the existing shop id value
// with the new APP_URL as no app knows the shop id
$this->systemConfigService->
set(ShopIdProvider::SHOP_ID_SYSTEM_CONFIG_KEY,
[ 'app_url' => EnvironmentHelper::
getVariable('APP_URL'
),
'value' =>
$shopId['value'
],
]);