Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
get_namespaces example
protected
function
match_request_to_handler
(
$request
)
{
$method
=
$request
->
get_method
(
)
;
$path
=
$request
->
get_route
(
)
;
$with_namespace
= array
(
)
;
foreach
(
$this
->
get_namespaces
(
)
as
$namespace
)
{
if
(
str_starts_with
(
trailingslashit
(
ltrim
(
$path
, '/'
)
)
,
$namespace
)
)
{
$with_namespace
[
]
=
$this
->
get_routes
(
$namespace
)
;
}
}
if
(
$with_namespace
)
{
$routes
=
array_merge
(
...
$with_namespace
)
;
}
else
{
$routes
=
$this
->
get_routes
(
)
;
}