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

ServiceProvider::addMiddlewareAlias()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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