RouteServiceProvider::registerApiMiddleware()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php namespace Arcanedev\LaravelApiHelper\Providers;
2
3
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;
4
5
/**
6
 * Class     RouteServiceProvider
7
 *
8
 * @package  Arcanedev\LaravelApiHelper\Providers
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class RouteServiceProvider extends ServiceProvider
12
{
13
    /* -----------------------------------------------------------------
14
     |  Main Methods
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Define the routes for the application.
20
     */
21 84
    public function map()
22
    {
23 84
        $this->registerApiMiddleware();
24 84
    }
25
26
    /**
27
     * Register the API route Middleware.
28
     */
29 84
    private function registerApiMiddleware()
30
    {
31
        /** @var  \Illuminate\Contracts\Config\Repository  $config */
32 84
        $config = $this->app['config'];
33
34 84
        foreach ($config->get('api-helper.middleware', []) as $name => $class) {
35 84
            $this->aliasMiddleware($name, $class);
36
        };
37 84
    }
38
}
39