LaralockerServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 15
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Ijeffro\Laralocker\Providers;
4
5
use Ijeffro\Laralocker\xAPI;
6
use Illuminate\Filesystem\Filesystem;
7
use Ijeffro\Laralocker\LearningLocker;
8
use Illuminate\Support\ServiceProvider;
9
use Ijeffro\Laralocker\Commands\InstallCommand;
10
use Ijeffro\Laralocker\Commands\xAPICommand;
0 ignored issues
show
Bug introduced by
The type Ijeffro\Laralocker\Commands\xAPICommand was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Ijeffro\Laralocker\Commands\LearningLockerCommand;
0 ignored issues
show
Bug introduced by
The type Ijeffro\Laralocker\Commands\LearningLockerCommand was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
class LaralockerServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * Bootstrap the application services.
17
     */
18
    public function boot()
19
    {
20
        /*
21
         * Optional methods to load your package assets
22
         */
23
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laralocker');
24
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'laralocker');
25
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
26
        // $this->loadRoutesFrom(__DIR__.'/routes.php');
27
28
29
        if ($this->app->runningInConsole()) {
30
            $this->publishes([
31
                __DIR__.'/../../publishable/config/laralocker.php' => config_path('laralocker.php'),
32
            ], 'config');
33
34
            // Publishing the views.
35
            /*$this->publishes([
36
                __DIR__.'/../resources/views' => resource_path('views/vendor/laralocker'),
37
            ], 'views');*/
38
39
40
            // Publishing assets.
41
            /*$this->publishes([
42
                __DIR__.'/../resources/assets' => public_path('vendor/laralocker'),
43
            ], 'assets');*/
44
45
            // Publishing the translation files.
46
            /*$this->publishes([
47
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/laralocker'),
48
            ], 'lang');*/
49
50
            // Registering package commands.
51
            // $this->commands([]);
52
        }
53
    }
54
55
    /**
56
     * Register the application services.
57
     */
58
    public function register()
59
    {
60
        if ($this->app->runningInConsole()) {
61
            // $this->registerPublishableResources();
62
            $this->registerConsoleCommands();
63
        }
64
65
66
        // Automatically apply the package configuration
67
        $this->mergeConfigFrom(__DIR__.'/../../publishable/config/laralocker.php', 'laralocker');
68
69
70
        // Register the main class to use with the facade
71
        $this->app->bind('laralocker', function () {
72
            return new Laralocker;
73
        });
74
75
        // Register the main class to use with the facade
76
        $this->app->bind('learninglocker', function () {
77
            return new LearningLocker;
78
        });
79
80
        // Register the main class to use with the facade
81
        $this->app->bind('xapi', function () {
82
            return new xAPI;
83
        });
84
    }
85
86
    /**
87
     * Register Console Commands
88
     *
89
     * @return xAPICommand
90
     * @return InstallCommand
91
     * @return LearningLockerCommand
92
     */
93
    private function registerConsoleCommands()
94
    {
95
        $this->commands(InstallCommand::class);
96
        // $this->commands(xAPICommand::class);
97
        // $this->commands(LearningLockerCommand::class);
98
    }
99
}
100