ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Gurgentil\LaravelStorable;
4
5
use Gurgentil\LaravelStorable\Console\Commands\MakeStorableCommand;
6
use Gurgentil\LaravelStorable\Services\DeleteStorableFile;
7
use Gurgentil\LaravelStorable\Services\GenerateStorableFile;
8
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
9
10
class ServiceProvider extends IlluminateServiceProvider
11
{
12
    /**
13
     * Register the application services.
14
     */
15
    public function register(): void
16
    {
17
        $this->app->bind('delete-storable-file', static function () {
18
            return new DeleteStorableFile;
19
        });
20
21
        $this->app->bind('generate-storable-file', static function () {
22
            return new GenerateStorableFile;
23
        });
24
25
        $this->mergeConfigFrom(__DIR__ . '/../config/storable.php', 'storable');
26
    }
27
28
    /**
29
     * Bootstrap the application services.
30
     */
31
    public function boot(): void
32
    {
33
        if ($this->app->runningInConsole()) {
34
            $this->commands([
35
                MakeStorableCommand::class,
36
            ]);
37
        }
38
    }
39
}
40