Completed
Push — master ( d0572a...56be9e )
by Pásztor
03:28 queued 01:34
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 4 1
A addMiddlewareAlias() 0 6 1
1
<?php
2
3
namespace Autumn\Api\Providers;
4
5
use Autumn\Api\Http\Middleware\ThrottleRequests;
6
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
7
8
class ServiceProvider extends IlluminateServiceProvider
9
{
10
    /**
11
     * Register the service provider.
12
     *
13
     * @return void
14
     */
15
    public function register()
16
    {
17
        $this->addMiddlewareAlias('api.throttle', ThrottleRequests::class);
18
    }
19
20
    /**
21
     * Register a short-hand name for a middleware.
22
     *
23
     * @param string $name
24
     * @param string $class
25
     */
26
    protected function addMiddlewareAlias($name, $class)
27
    {
28
        $router = $this->app['router'];
29
30
        $router->middleware($name, $class);
31
    }
32
}
33