Completed
Push — master ( b02197...088acd )
by Mahmoud
03:21
created

MiddlewaresLoaderTrait::loadMiddlewares()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace App\Ship\Engine\Loaders;
4
5
use App;
6
7
/**
8
 * Class MiddlewaresLoaderTrait.
9
 *
10
 * @author  Mahmoud Zalt <[email protected]>
11
 */
12
trait MiddlewaresLoaderTrait
13
{
14
15
    /**
16
     * @void
17
     */
18
    public function loadMiddlewares()
19
    {
20
        $this->registerMiddlewareGroups($this->middlewareGroups);
0 ignored issues
show
Bug introduced by
The property middlewareGroups does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
21
        $this->registerRouteMiddleware($this->routeMiddleware);
0 ignored issues
show
Bug introduced by
The property routeMiddleware does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
22
    }
23
24
25
    /**
26
     * Registering Route Group's
27
     *
28
     * @void
29
     */
30
    private function registerMiddlewareGroups(array $middlewareGroups = [])
31
    {
32
        foreach ($middlewareGroups as $key => $middleware) {
33
            $this->app['router']->middlewareGroup($key, $middleware);
0 ignored issues
show
Bug introduced by
The property app does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
34
        }
35
    }
36
37
    /**
38
     * Registering Route Middleware's
39
     *
40
     * @void
41
     */
42
    private function registerRouteMiddleware(array $routeMiddleware = [])
43
    {
44
        foreach ($routeMiddleware as $key => $routeMiddleware) {
45
            $this->app['router']->aliasMiddleware($key, $routeMiddleware);
46
        }
47
    }
48
49
50
}
51