Collection   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRouteInformation() 0 22 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Overrides\Lord\Laroute\Routes;
6
7
use Illuminate\Routing\Route;
8
use Lord\Laroute\Routes\Collection as BaseCollection;
9
10
class Collection extends BaseCollection
11
{
12
    /**
13
     * Get the route information for a given route.
14
     *
15
     * @param $route     \Illuminate\Routing\Route
16
     * @param $filter    string
17
     * @param $namespace string
18
     *
19
     * @return array|null
20
     */
21
    protected function getRouteInformation(Route $route, $filter, $namespace): ?array
22
    {
23
        $uri = $route->uri();
24
        $host = $route->domain();
25
        $name = $route->getName();
26
        $laroute = $route->getAction('laroute');
27
28
        switch ($filter) {
29
            case 'all':
30
                if ($laroute === false) {
31
                    return null;
32
                }
33
                break;
34
            case 'only':
35
                if ($laroute !== true) {
36
                    return null;
37
                }
38
                break;
39
        }
40
41
        return compact('host', 'uri', 'name');
42
    }
43
}
44