Instantiate DispatchRoute manually

Since we are already providing the first and only argument
manually, we might as well instantiate the object manually.
Same effect, same coupling, less code.
This commit is contained in:
Franz Liedke 2018-08-21 23:42:00 +02:00
parent 034000ea0b
commit 973fbcf17b
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4
5 changed files with 5 additions and 11 deletions

View File

@ -62,7 +62,7 @@ class AdminServiceProvider extends AbstractServiceProvider
event(new ConfigureMiddleware($pipe, 'admin')); event(new ConfigureMiddleware($pipe, 'admin'));
$pipe->pipe($app->make(DispatchRoute::class, ['routes' => $app->make('flarum.admin.routes')])); $pipe->pipe(new DispatchRoute($app->make('flarum.admin.routes')));
return $pipe; return $pipe;
}); });

View File

@ -66,7 +66,7 @@ class ApiServiceProvider extends AbstractServiceProvider
event(new ConfigureMiddleware($pipe, 'api')); event(new ConfigureMiddleware($pipe, 'api'));
$pipe->pipe($app->make(DispatchRoute::class, ['routes' => $app->make('flarum.api.routes')])); $pipe->pipe(new DispatchRoute($app->make('flarum.api.routes')));
return $pipe; return $pipe;
}); });

View File

@ -66,7 +66,7 @@ class ForumServiceProvider extends AbstractServiceProvider
event(new ConfigureMiddleware($pipe, 'forum')); event(new ConfigureMiddleware($pipe, 'forum'));
$pipe->pipe($app->make(DispatchRoute::class, ['routes' => $app->make('flarum.forum.routes')])); $pipe->pipe(new DispatchRoute($app->make('flarum.forum.routes')));
return $pipe; return $pipe;
}); });

View File

@ -99,10 +99,7 @@ class InstalledApp implements AppInterface
{ {
$pipe = new MiddlewarePipe; $pipe = new MiddlewarePipe;
$pipe->pipe( $pipe->pipe(
$this->laravel->make( new DispatchRoute($this->laravel->make('flarum.update.routes'))
DispatchRoute::class,
['routes' => $this->laravel->make('flarum.update.routes')]
)
); );
return $pipe; return $pipe;

View File

@ -40,10 +40,7 @@ class Installer implements AppInterface
$pipe->pipe($this->laravel->make(HandleErrorsWithWhoops::class)); $pipe->pipe($this->laravel->make(HandleErrorsWithWhoops::class));
$pipe->pipe($this->laravel->make(StartSession::class)); $pipe->pipe($this->laravel->make(StartSession::class));
$pipe->pipe( $pipe->pipe(
$this->laravel->make( new DispatchRoute($this->laravel->make('flarum.install.routes'))
DispatchRoute::class,
['routes' => $this->laravel->make('flarum.install.routes')]
)
); );
return $pipe; return $pipe;