AuthServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Soved\Laravel\Magic\Auth;
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Support\ServiceProvider;
7
8
class AuthServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->registerRoutes();
18
        $this->registerTranslations();
19
    }
20
21
    /**
22
     * Register the magic authentication routes.
23
     *
24
     * @return void
25
     */
26
    protected function registerRoutes()
27
    {
28
        Route::group([
29
            'prefix'     => config('magic-auth.uri'),
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
            'prefix'     => /** @scrutinizer ignore-call */ config('magic-auth.uri'),
Loading history...
30
            'namespace'  => 'Soved\Laravel\Magic\Auth\Http\Controllers',
31
            'middleware' => 'web',
32
        ], function () {
33
            $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
34
        });
35
    }
36
37
    /**
38
     * Register the magic authentication translations.
39
     *
40
     * @return void
41
     */
42
    protected function registerTranslations()
43
    {
44
        $this->loadTranslationsFrom(
45
            __DIR__ . '/../resources/lang', 'magic-auth'
46
        );
47
    }
48
49
    /**
50
     * Register the application services.
51
     *
52
     * @return void
53
     */
54
    public function register()
55
    {
56
        $this->configure();
57
        $this->offerPublishing();
58
    }
59
60
    /**
61
     * Setup the configuration for magic authentication.
62
     *
63
     * @return void
64
     */
65
    protected function configure()
66
    {
67
        $this->mergeConfigFrom(
68
            __DIR__ . '/../config/magic-auth.php', 'magic-auth'
69
        );
70
    }
71
72
    /**
73
     * Setup the resource publishing groups for magic authentication.
74
     *
75
     * @return void
76
     */
77
    protected function offerPublishing()
78
    {
79
        if ($this->app->runningInConsole()) {
80
            $this->publishes([
81
                __DIR__ . '/../config/magic-auth.php' => config_path('magic-auth.php'),
0 ignored issues
show
Bug introduced by
The function config_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

81
                __DIR__ . '/../config/magic-auth.php' => /** @scrutinizer ignore-call */ config_path('magic-auth.php'),
Loading history...
82
            ], 'magic-auth-config');
83
84
            $this->publishes([
85
                __DIR__ . '/../resources/lang' => resource_path('lang/vendor/magic-auth'),
0 ignored issues
show
Bug introduced by
The function resource_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

85
                __DIR__ . '/../resources/lang' => /** @scrutinizer ignore-call */ resource_path('lang/vendor/magic-auth'),
Loading history...
86
            ], 'magic-auth-lang');
87
        }
88
    }
89
}
90