Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
loadValues example
$output
=
[
]
;
$fileValues
=
[
]
;
foreach
(
$vars
as
$var
)
{
if
(
null !==
$nameFilter
&& 0 !==
stripos
(
$var
,
$nameFilter
)
)
{
continue
;
}
$realValue
=
$_SERVER
[
$var
]
;
$varDetails
=
[
$var
,
$realValue
]
;
foreach
(
$envFiles
as
$envFile
)
{
$values
=
$fileValues
[
$envFile
]
??=
$this
->
loadValues
(
$envFile
)
;
$varString
=
$values
[
$var
]
?? '<fg=yellow>n/a</>';
$shortenedVar
=
$this
->
getHelper
(
'formatter'
)
->
truncate
(
$varString
, 30
)
;
$varDetails
[
]
=
$varString
===
$realValue
? '<fg=green>'.
$shortenedVar
.'</>' :
$shortenedVar
;
}
$output
[
]
=
$varDetails
;
}
return
$output
;
}
// Save current context to mail model
$mailContext
=
json_decode
(
json_encode
(
$context
)
, true
)
;
$mailModel
->
setContext
(
$mailContext
)
;
$this
->
getModelManager
(
)
->
flush
(
$mailModel
)
;
$this
->
getStringCompiler
(
)
->
setContext
(
array_merge
(
$defaultContext
,
$context
)
)
;
$mail
=
clone
Shopware
(
)
->
Container
(
)
->
get
(
'mail'
)
;
return
$this
->
loadValues
(
$mail
,
$mailModel
,
$overrideConfig
)
;
}
/** * Loads values from MailModel into Mail * * @param array $overrideConfig * * @throws Enlight_Exception * * @return Enlight_Components_Mail */