ImportServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 5
eloc 11
c 2
b 1
f 0
dl 0
loc 56
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 3 1
A register() 0 7 1
A bootForConsole() 0 6 1
A boot() 0 10 2
1
<?php
2
3
namespace LWS\Import;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class ImportServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Perform post-registration booting of services.
11
     *
12
     * @return void
13
     */
14
    public function boot()
15
    {
16
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'lws');
17
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'lws');
18
        $this->loadMigrationsFrom(__DIR__.'/migrations');
19
        // $this->loadRoutesFrom(__DIR__.'/routes.php');
20
21
        // Publishing is only necessary when using the CLI.
22
        if ($this->app->runningInConsole()) {
23
            $this->bootForConsole();
24
        }
25
    }
26
27
    /**
28
     * Register any package services.
29
     *
30
     * @return void
31
     */
32
    public function register()
33
    {
34
        $this->mergeConfigFrom(__DIR__.'/config/import.php', 'import');
35
36
        // Register the service the package provides.
37
        $this->app->singleton('import', function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

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

37
        $this->app->singleton('import', function (/** @scrutinizer ignore-unused */ $app) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
            return new Import;
39
        });
40
    }
41
42
    /**
43
     * Get the services provided by the provider.
44
     *
45
     * @return array
46
     */
47
    public function provides()
48
    {
49
        return ['import'];
50
    }
51
52
    /**
53
     * Console-specific booting.
54
     *
55
     * @return void
56
     */
57
    protected function bootForConsole()
58
    {
59
        // Publishing the configuration file.
60
        $this->publishes([
61
            __DIR__.'/config/import.php' => config_path('import.php'),
62
        ], 'import.config');
63
64
        // Publishing the views.
65
        /*$this->publishes([
66
            __DIR__.'/../resources/views' => base_path('resources/views/vendor/lws'),
67
        ], 'import.views');*/
68
69
        // Publishing assets.
70
        /*$this->publishes([
71
            __DIR__.'/../resources/assets' => public_path('vendor/lws'),
72
        ], 'import.views');*/
73
74
        // Publishing the translation files.
75
        /*$this->publishes([
76
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/lws'),
77
        ], 'import.views');*/
78
79
        // Registering package commands.
80
        // $this->commands([]);
81
    }
82
}
83