TelegramLoginWidgetServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A bootForConsole() 0 6 1
A boot() 0 5 2
A register() 0 6 1
1
<?php
2
3
namespace pschocke\TelegramLoginWidget;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class TelegramLoginWidgetServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Perform post-registration booting of services.
11
     *
12
     * @return void
13
     */
14
    public function boot()
15
    {
16
        // Publishing is only necessary when using the CLI.
17
        if ($this->app->runningInConsole()) {
18
            $this->bootForConsole();
19
        }
20
    }
21
22
    /**
23
     * Register any package services.
24
     *
25
     * @return void
26
     */
27
    public function register()
28
    {
29
        $this->mergeConfigFrom(__DIR__.'/../config/telegramloginwidget.php', 'telegramloginwidget');
30
31
        $this->app->singleton(TelegramLoginWidget::class, function () {
32
            return new TelegramLoginWidget;
33
        });
34
    }
35
36
    /**
37
     * Console-specific booting.
38
     *
39
     * @return void
40
     */
41
    protected function bootForConsole()
42
    {
43
        // Publishing the configuration file.
44
        $this->publishes([
45
            __DIR__.'/../config/telegramloginwidget.php' => config_path('telegramloginwidget.php'),
46
        ], 'telegramloginwidget.config');
47
    }
48
}
49