RouteServiceProvider::mapWebRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of laravel.su package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace App\Providers;
12
13
use Illuminate\Routing\Router;
14
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
15
16
/**
17
 * Class RouteServiceProvider.
18
 */
19
class RouteServiceProvider extends ServiceProvider
20
{
21
    /**
22
     * This namespace is applied to your controller routes.
23
     * In addition, it is set as the URL generator's root namespace.
24
     *
25
     * @var string
26
     */
27
    protected $namespace = 'App\Http\Controllers';
28
29
    /**
30
     * Define your route model bindings, pattern filters, etc.
31
     */
32
    public function boot(): void
33
    {
34
        //
35
36
        parent::boot();
37
    }
38
39
    /**
40
     * @param Router $router
41
     */
42
    public function map(Router $router): void
43
    {
44
        $this->mapApiRoutes($router);
45
46
        $this->mapWebRoutes($router);
47
    }
48
49
    /**
50
     * @param Router $router
51
     */
52 View Code Duplication
    protected function mapApiRoutes(Router $router): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
53
    {
54
        $attributes = [
55
            'middleware' => 'api',
56
            'namespace'  => $this->namespace,
57
        ];
58
59
        $router->group($attributes, base_path('routes/api.php'));
60
    }
61
62
    /**
63
     * @param Router $router
64
     */
65 View Code Duplication
    protected function mapWebRoutes(Router $router): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
    {
67
        $attributes = [
68
            'middleware' => 'web',
69
            'namespace'  => $this->namespace,
70
        ];
71
72
        $router->group($attributes, base_path('routes/web.php'));
73
    }
74
}
75