Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CliContextProvider example
$contextProviders
=
[
]
;
if
(
!\
in_array
(
\PHP_SAPI,
[
'cli', 'phpdbg'
]
, true
)
&&
class_exists
(
Request::
class
)
)
{
$requestStack
=
new
RequestStack
(
)
;
$requestStack
->
push
(
Request::
createFromGlobals
(
)
)
;
$contextProviders
[
'request'
]
=
new
RequestContextProvider
(
$requestStack
)
;
}
$fileLinkFormatter
=
class_exists
(
FileLinkFormatter::
class
)
?
new
FileLinkFormatter
(
null,
$requestStack
?? null
)
: null;
return
$contextProviders
+
[
'cli' =>
new
CliContextProvider
(
)
,
'source' =>
new
SourceContextProvider
(
null, null,
$fileLinkFormatter
)
,
]
;
}
}
$contextProviders
=
[
]
;
if
(
!\
in_array
(
\PHP_SAPI,
[
'cli', 'phpdbg'
]
, true
)
&&
class_exists
(
Request::
class
)
)
{
$requestStack
=
new
RequestStack
(
)
;
$requestStack
->
push
(
Request::
createFromGlobals
(
)
)
;
$contextProviders
[
'request'
]
=
new
RequestContextProvider
(
$requestStack
)
;
}
$fileLinkFormatter
=
class_exists
(
FileLinkFormatter::
class
)
?
new
FileLinkFormatter
(
null,
$requestStack
?? null
)
: null;
return
$contextProviders
+
[
'cli' =>
new
CliContextProvider
(
)
,
'source' =>
new
SourceContextProvider
(
null, null,
$fileLinkFormatter
)
,
]
;
}
}