Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getRegisteredControllers example
$this
->controller =
$this
->collection->
getDefaultController
(
)
;
$this
->method =
$this
->collection->
getDefaultMethod
(
)
;
$this
->collection->
setHTTPVerb
(
$request
->
getMethod
(
)
??
$_SERVER
[
'REQUEST_METHOD'
]
)
;
$this
->translateURIDashes =
$this
->collection->
shouldTranslateURIDashes
(
)
;
if
(
$this
->collection->
shouldAutoRoute
(
)
)
{
$autoRoutesImproved
=
config
(
Feature::
class
)
->autoRoutesImproved ?? false;
if
(
$autoRoutesImproved
)
{
$this
->autoRouter =
new
AutoRouterImproved
(
$this
->collection->
getRegisteredControllers
(
'*'
)
,
$this
->collection->
getDefaultNamespace
(
)
,
$this
->collection->
getDefaultController
(
)
,
$this
->collection->
getDefaultMethod
(
)
,
$this
->translateURIDashes,
$this
->collection->
getHTTPVerb
(
)
)
;
}
else
{
$this
->autoRouter =
new
AutoRouter
(
$this
->collection->
getRoutes
(
'cli', false
)
, // @phpstan-ignore-line
$this
->collection->
getDefaultNamespace
(
)
,
$this
->collection->
getDefaultController
(
)
,
if
(
$collection
->
shouldAutoRoute
(
)
)
{
$autoRoutesImproved
=
config
(
Feature::
class
)
->autoRoutesImproved ?? false;
if
(
$autoRoutesImproved
)
{
$autoRouteCollector
=
new
AutoRouteCollectorImproved
(
$collection
->
getDefaultNamespace
(
)
,
$collection
->
getDefaultController
(
)
,
$collection
->
getDefaultMethod
(
)
,
$methods
,
$collection
->
getRegisteredControllers
(
'*'
)
)
;
$autoRoutes
=
$autoRouteCollector
->
get
(
)
;
// Check for Module Routes.
if
(
$routingConfig
=
config
(
Routing::
class
)
)
{
foreach
(
$routingConfig
->moduleRoutes
as
$uri
=>
$namespace
)
{
$autoRouteCollector
=
new
AutoRouteCollectorImproved
(
$namespace
,
$collection
->
getDefaultController
(
)
,
$collection
->
getDefaultMethod
(
)
,