Completed
Push — master ( a8bf63...814c7f )
by Henry
10:23
created

GecharlServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 65
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 37 2
A register() 0 18 1
1
<?php
2
3
namespace HenryEjemuta\LaravelGecharl;
4
5
use HenryEjemuta\LaravelGecharl\Console\InstallLaravelGecharl;
6
use Illuminate\Support\ServiceProvider;
7
8
class GecharlServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        /*
16
         * Optional methods to load your package assets
17
         */
18
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-gecharl');
19
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-gecharl');
20
//         $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
21
//         $this->loadRoutesFrom(__DIR__.'/routes.php');
22
23
        if ($this->app->runningInConsole()) {
24
            $this->publishes([
25
                __DIR__.'/../config/config.php' => config_path('gecharl.php'),
26
            ], 'config');
27
28
            // Publishing the views.
29
            /*$this->publishes([
30
                __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-gecharl'),
31
            ], 'views');*/
32
33
            // Publishing assets.
34
            /*$this->publishes([
35
                __DIR__.'/../resources/assets' => public_path('vendor/laravel-gecharl'),
36
            ], 'assets');*/
37
38
            // Publishing the translation files.
39
            /*$this->publishes([
40
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-gecharl'),
41
            ], 'lang');*/
42
43
            // Registering package commands.
44
            $this->commands([
45
                InstallLaravelGecharl::class,
46
            ]);
47
48
        }
49
    }
50
51
    /**
52
     * Register the application services.
53
     */
54
    public function register()
55
    {
56
        // Automatically apply the package configuration
57
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'gecharl');
58
59
        // Register the main class to use with the facade
60
        $this->app->singleton('gecharl', 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...
61
            $baseUrl = config('gecharl.base_url');
62
            $instanceName = 'gecharl';
63
64
            return new Gecharl(
65
                $baseUrl,
66
                $instanceName,
67
                config('gecharl')
68
            );
69
        });
70
71
    }
72
}
73