From f5d3ab0da255c80f44b2e8bfa40701c1b646b2fd Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 7 Sep 2018 01:00:56 +0200 Subject: [PATCH] RouteHandlerFactory: Refactor frontend parameter By passing in just the frontend identifier, we can hide some of the implementation details, in this case the identifier of the Frontend instance in the IoC container. --- framework/core/src/Http/RouteHandlerFactory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/core/src/Http/RouteHandlerFactory.php b/framework/core/src/Http/RouteHandlerFactory.php index 1a346c0da..c8e4798cb 100644 --- a/framework/core/src/Http/RouteHandlerFactory.php +++ b/framework/core/src/Http/RouteHandlerFactory.php @@ -46,7 +46,7 @@ class RouteHandlerFactory public function toFrontend(string $frontend, string $content = null) { return $this->toController(function (Container $container) use ($frontend, $content) { - $frontend = $container->make($frontend); + $frontend = $container->make("flarum.$frontend.frontend"); if ($content) { $frontend->add($container->make($content)); @@ -62,7 +62,7 @@ class RouteHandlerFactory */ public function toForum(string $content = null) { - return $this->toFrontend('flarum.forum.frontend', $content); + return $this->toFrontend('forum', $content); } /** @@ -71,6 +71,6 @@ class RouteHandlerFactory */ public function toAdmin(string $content = null) { - return $this->toFrontend('flarum.admin.frontend', $content); + return $this->toFrontend('admin', $content); } }