LocaleRouteServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A boot() 0 6 1
1
<?php
2
3
namespace CaribouFute\LocaleRoute;
4
5
use CaribouFute\LocaleRoute\Middleware\SetSessionLocale;
6
use CaribouFute\LocaleRoute\Prefix\Route as PrefixRoute;
7
use CaribouFute\LocaleRoute\Routing\LocaleRouter;
8
use Illuminate\Routing\Router;
9
use Illuminate\Support\ServiceProvider;
10
11
class LocaleRouteServiceProvider extends ServiceProvider
12
{
13
    protected $defer = false;
14
15
    public function boot(Router $router)
16
    {
17
        $this->publishes([__DIR__ . '/config/localeroute.php' => config_path('localeroute.php')]);
18
        $this->mergeConfigFrom(__DIR__ . '/config/localeroute.php', 'localeroute');
19
20
        $router->aliasMiddleware('locale.session', SetSessionLocale::class);
21
    }
22
23
    public function register()
24
    {
25
        $this->app->bind('locale-route', LocaleRouter::class);
26
        $this->app->bind('locale-route-url', PrefixRoute::class);
27
28
        config('config/localeroute.php');
29
    }
30
}
31