DaftravelServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 2
A provides() 0 3 1
A register() 0 9 1
1
<?php
2
3
namespace UsamamuneerChaudhary\Daftravel;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class DaftravelServiceProvider extends ServiceProvider
8
{
9
    public function register(): void
10
    {
11
        $this->mergeConfigFrom(__DIR__ . '/../config/daftravel.php', 'daftravel');
12
13
        $this->app->singleton('daftravel', function ($app) {
14
            return new Daftravel($app['config']['daftravel']);
15
        });
16
17
        $this->app->alias('daftravel', Daftravel::class);
18
    }
19
20
    public function boot(): void
21
    {
22
        if ($this->app->runningInConsole()) {
23
            $this->publishes([
24
                __DIR__ . '/../config/daftravel.php' => config_path('daftravel.php'),
25
            ], 'daftravel-config');
26
        }
27
    }
28
29
    public function provides(): array
30
    {
31
        return ['daftravel'];
32
    }
33
}
34