LaralangServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 20
rs 9.4285
cc 3
eloc 12
nc 4
nop 1
1
<?php
2
3
namespace Aitor24\Laralang;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class LaralangServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     *
12
     * @return void
13
     */
14
    public function boot(\Illuminate\Routing\Router $router)
15
    {
16
        if (!$this->app->routesAreCached()) {
0 ignored issues
show
Bug introduced by
The method routesAreCached() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
17
            require __DIR__.'/Routes/web.php';
18
        }
19
20
        $this->publishes([
21
            __DIR__.'/Config/laralang.php' => config_path('laralang.php'),
22
            __DIR__.'/Assets'              => public_path('vendor/Aitor24/Laralang'),
23
        ], 'laralang_pkg');
24
25
        $router->aliasMiddleware('laralang.middleware', config('laralang.default.middleware'));
26
27
        $this->loadTranslationsFrom(__DIR__.'/translations', 'laralang');
28
        if (config('laralang.default.migrations')) {
29
            $this->loadMigrationsFrom(__DIR__.'/Migrations', 'laralang');
0 ignored issues
show
Unused Code introduced by
The call to LaralangServiceProvider::loadMigrationsFrom() has too many arguments starting with 'laralang'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
30
        }
31
32
        $this->loadViewsFrom(__DIR__.'/Views', 'laralang');
33
    }
34
35
    /**
36
     * Register the application services.
37
     *
38
     * @return void
39
     */
40
    public function register()
41
    {
42
        $this->mergeConfigFrom(__DIR__.'/Config/laralang.php', 'laralang');
43
    }
44
}
45