Completed
Push — master ( 7989d2...c7d3e4 )
by ARCANEDEV
12s queued 11s
created

RouteServiceProvider::config()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\RouteViewer\Providers;
6
7
use Arcanedev\RouteViewer\Http\Routes\RouteViewerRoutes;
8
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider;
9
10
/**
11
 * Class     RouteServiceProvider
12
 *
13
 * @package  Arcanedev\RouteViewer\Providers
14
 * @author   ARCANEDEV <[email protected]>
15
 */
16
class RouteServiceProvider extends ServiceProvider
17
{
18
    /* -----------------------------------------------------------------
19
     |  Main Methods
20
     | -----------------------------------------------------------------
21
     */
22
23
    /**
24
     * Map the routes.
25
     */
26 72
    public function map(): void
27
    {
28 72
        if ($this->isEnabled()) {
29 72
            static::mapRouteClasses([
0 ignored issues
show
Documentation introduced by
array(\Arcanedev\RouteVi...uteViewerRoutes::class) is of type array<integer,?>, but the function expects a object<Arcanedev\Support...ting\Concerns\iterable>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
30 72
                RouteViewerRoutes::class,
31
            ]);
32
        }
33 72
    }
34
35
    /* -----------------------------------------------------------------
36
     |  Check Methods
37
     | -----------------------------------------------------------------
38
     */
39
40
    /**
41
     * Check if routes is enabled.
42
     *
43
     * @return bool
44
     */
45 72
    public function isEnabled(): bool
46
    {
47 72
        return (bool) ($this->app['config']['route-viewer.route.enabled'] ?: false);
48
    }
49
}
50