Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
MissingAppSecretException example
if
(
$app
=== null
)
{
throw
new
AppByNameNotFoundException
(
$appName
)
;
}
$shopUrl
= EnvironmentHelper::
getVariable
(
'APP_URL'
)
;
if
(
!\
is_string
(
$shopUrl
)
)
{
throw
new
MissingShopUrlException
(
)
;
}
$appSecret
=
$app
->
getAppSecret
(
)
;
if
(
$appSecret
=== null
)
{
throw
new
MissingAppSecretException
(
)
;
}
$targetUrl
=
$requestDataBag
->
get
(
'url'
)
;
$targetHost
= \
parse_url
(
(string)
$targetUrl
, \PHP_URL_HOST
)
;
$allowedHosts
=
$app
->
getAllowedHosts
(
)
??
[
]
;
if
(
!
$targetHost
|| !\
in_array
(
$targetHost
,
$allowedHosts
, true
)
)
{
throw
new
UnallowedHostException
(
$targetUrl
,
$allowedHosts
,
$app
->
getName
(
)
)
;
}
$action
=
new
AppAction
(
$targetUrl
,