VtuDotNGServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace HenryEjemuta\LaravelVtuDotNG;
4
5
use HenryEjemuta\LaravelVtuDotNG\Console\InstallLaravelVtuDotNG;
6
use Illuminate\Support\ServiceProvider;
7
8
class VtuDotNGServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        if ($this->app->runningInConsole()) {
16
            $this->publishes([
17
                __DIR__.'/../config/config.php' => config_path('vtung.php'),
18
            ], 'config');
19
20
            // Registering package commands.
21
            $this->commands([
22
                InstallLaravelVtuDotNG::class,
23
            ]);
24
25
        }
26
    }
27
28
    /**
29
     * Register the application services.
30
     */
31
    public function register()
32
    {
33
        // Automatically apply the package configuration
34
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'vtung');
35
36
        // Register the main class to use with the facade
37
        $this->app->singleton('vtung', function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app 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...
38
            $baseUrl = config('vtung.base_url');
39
            $instanceName = 'vtung';
40
41
            return new VtuDotNG(
42
                $baseUrl,
43
                $instanceName,
44
                config('vtung')
45
            );
46
        });
47
48
    }
49
}
50