Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ServiceStubs example
$twig
->
addGlobal
(
'shopware',
new
ArrayStruct
(
[
'version' =>
$this
->shopwareVersion,
]
)
)
;
return
$twig
;
}
private
function
initServices
(
Hook
$hook
, Script
$script
)
: ServiceStubs
{
$services
=
new
ServiceStubs
(
$hook
->
getName
(
)
)
;
$deprecatedServices
=
$hook
->
getDeprecatedServices
(
)
;
foreach
(
$hook
->
getServiceIds
(
)
as
$serviceId
)
{
if
(
!
$this
->container->
has
(
$serviceId
)
)
{
throw
new
ServiceNotFoundException
(
$serviceId
, 'Hook: ' .
$hook
->
getName
(
)
)
;
}
$service
=
$this
->container->
get
(
$serviceId
)
;
if
(
!
$service
instanceof HookServiceFactory
)
{
throw
new
NoHookServiceFactoryException
(
$serviceId
)
;
}