Completed
Push — master ( b015a1...0e1003 )
by Abdelrahman
49:45
created

Collection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B getRouteInformation() 0 21 5
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Cortex Foundation Module.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Cortex Foundation Module
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
declare(strict_types=1);
17
18
namespace Cortex\Foundation\Overrides\Lord\Laroute\Routes;
19
20
use Illuminate\Routing\Route;
21
use Lord\Laroute\Routes\Collection as BaseCollection;
22
23
class Collection extends BaseCollection
24
{
25
    /**
26
     * Get the route information for a given route.
27
     *
28
     * @param $route     \Illuminate\Routing\Route
29
     * @param $filter    string
30
     * @param $namespace string
31
     *
32
     * @return array
0 ignored issues
show
Documentation introduced by
Should the return type not be null|array? Also, consider making the array more specific, something like array<String>, or String[].

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

If the return type contains the type array, this check recommends the use of a more specific type like String[] or array<String>.

Loading history...
33
     */
34
    protected function getRouteInformation(Route $route, $filter, $namespace)
35
    {
36
        $uri = $route->uri();
37
        $name = $route->getName();
38
        $laroute = array_get($route->getAction(), 'laroute', null);
39
40
        switch ($filter) {
41
            case 'all':
42
                if ($laroute === false) {
43
                    return;
44
                }
45
                break;
46
            case 'only':
47
                if ($laroute !== true) {
48
                    return;
49
                }
50
                break;
51
        }
52
53
        return compact('uri', 'name');
54
    }
55
}
56