Completed
Push — master ( fe9181...bc0bfa )
by ARCANEDEV
12s
created

RoutingServiceProvider::getMiddleware()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php namespace Arcanedev\Localization\Providers;
2
3
use Arcanedev\Localization\Middleware;
4
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;
5
use Arcanedev\Localization\Routing\Router;
6
7
/**
8
 * Class     RoutingServiceProvider
9
 *
10
 * @package  Arcanedev\Localization\Providers
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class RoutingServiceProvider extends ServiceProvider
14
{
15
    /* -----------------------------------------------------------------
16
     |  Properties
17
     | -----------------------------------------------------------------
18
     */
19
    /**
20
     * The application's route middleware.
21
     *
22
     * These middleware may be assigned to groups or used individually.
23
     *
24
     * @var array
25
     */
26
    protected $routeMiddleware = [
27
        'localization-session-redirect' => Middleware\LocaleSessionRedirect::class,
28
        'localization-cookie-redirect'  => Middleware\LocaleCookieRedirect::class,
29
        'localization-redirect'         => Middleware\LocalizationRedirect::class,
30
        'localized-routes'              => Middleware\LocalizationRoutes::class,
31
        'translation-redirect'          => Middleware\TranslationRedirect::class,
32
    ];
33
34
    /* ------------------------------------------------------------------------------------------------
35
     |  Main Functions
36
     | ------------------------------------------------------------------------------------------------
37
     */
38
    /**
39
     * Register the service provider.
40
     */
41 192
    public function register()
42
    {
43 192
        $this->registerRouter();
44
45 192
        parent::register();
46 192
    }
47
48
    /* ------------------------------------------------------------------------------------------------
49
     |  Router Functions
50
     | ------------------------------------------------------------------------------------------------
51
     */
52
    /**
53
     * Register the router instance.
54
     */
55
    protected function registerRouter()
56
    {
57 192
        $this->app->singleton('router', function ($app) {
58 192
            return new Router($app['events'], $app);
59 192
        });
60 192
    }
61
}
62