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.
This commit is contained in:
Franz Liedke 2018-09-07 01:00:56 +02:00
parent 96045ca390
commit 14393ec53e
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

@ -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);
}
}