Completed
Push — master ( 3cd9a5...983ab2 )
by ARCANEDEV
03:07
created

RouteServiceProvider::getRouteNamespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php namespace Arcanesoft\Blog\Providers;
2
3
use Arcanesoft\Blog\Http\Routes;
4
use Arcanesoft\Core\Bases\RouteServiceProvider as ServiceProvider;
5
use Illuminate\Contracts\Routing\Registrar as Router;
6
7
/**
8
 * Class     RouteServiceProvider
9
 *
10
 * @package  Arcanesoft\Blog\Providers
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class RouteServiceProvider extends ServiceProvider
14
{
15
    /* ------------------------------------------------------------------------------------------------
16
     |  Getters & Setters
17
     | ------------------------------------------------------------------------------------------------
18
     */
19
    /**
20
     * Get the routes namespace
21
     *
22
     * @return string
23
     */
24
    protected function getRouteNamespace()
25
    {
26
        return 'Arcanesoft\\Blog\\Http\\Routes';
27
    }
28
29
    /**
30
     * Get the auth foundation route prefix.
31
     *
32
     * @return string
33
     */
34 8
    public function getFoundationBlogPrefix()
35
    {
36 8
        $prefix = array_get($this->getFoundationRouteGroup(), 'prefix', 'dashboard');
37
38 8
        return "$prefix/" . config('arcanesoft.blog.route.prefix', 'blog');
39
    }
40
41
    /* ------------------------------------------------------------------------------------------------
42
     |  Main Functions
43
     | ------------------------------------------------------------------------------------------------
44
     */
45
    /**
46
     * Define the routes for the application.
47
     *
48
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
49
     */
50 8
    public function map(Router $router)
51
    {
52 8
        $this->mapPublicRoutes($router);
0 ignored issues
show
Unused Code introduced by
The call to the method Arcanesoft\Blog\Provider...ider::mapPublicRoutes() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
53 8
        $this->mapFoundationRoutes($router);
54 8
    }
55
56
    /**
57
     * Define the public routes for the application.
58
     *
59
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
60
     */
61 8
    private function mapPublicRoutes(Router $router)
0 ignored issues
show
Unused Code introduced by
The parameter $router is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
62
    {
63
        //
64 8
    }
65
66
    /**
67
     * Define the foundation routes for the application.
68
     *
69
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
70
     */
71 8
    private function mapFoundationRoutes(Router $router)
72
    {
73 8
        $attributes = array_merge($this->getFoundationRouteGroup(), [
74 8
            'as'        => 'blog::foundation.',
75 6
            'namespace' => 'Arcanesoft\\Blog\\Http\\Controllers\\Foundation',
76 6
        ]);
77
78 8
        $router->group(array_merge(
79 6
            $attributes,
80 8
            ['prefix' => $this->getFoundationBlogPrefix()]
81 8
        ), function (Router $router) {
82 8
            Routes\Foundation\StatsRoutes::register($router);
83 8
            Routes\Foundation\PostsRoutes::register($router);
84 8
            Routes\Foundation\CommentsRoutes::register($router);
85 8
            Routes\Foundation\CategoriesRoutes::register($router);
86 8
            Routes\Foundation\TagsRoutes::register($router);
87 8
        });
88 8
    }
89
}
90