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

Collection::getRouteInformation()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 14
nc 5
nop 3
dl 0
loc 21
rs 8.7624
c 0
b 0
f 0
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