VacuumServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 12
ccs 0
cts 0
cp 0
crap 12
rs 10
1
<?php
2
3
namespace Bavix\WalletVacuum;
4
5
use Bavix\Wallet\Interfaces\Storable;
6
use Bavix\WalletVacuum\Commands\WarmUpCommand;
7
use Bavix\WalletVacuum\Services\StoreService;
8
use Illuminate\Support\ServiceProvider;
9
10
class VacuumServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap services.
14
     *
15
     * @return void
16
     * @codeCoverageIgnore
17
     */
18
    public function boot(): void
19
    {
20
        if (! $this->app->runningInConsole()) {
21
            return;
22
        }
23
24
        $this->commands([WarmUpCommand::class]);
25
26
        if (function_exists('config_path')) {
27
            $this->publishes([
28
                dirname(__DIR__).'/config/config.php' => config_path('wallet-vacuum.php'),
29
            ], 'laravel-wallet-vacuum-config');
30
        }
31
    }
32
33
    /**
34
     * @return void
35
     */
36 4
    public function register(): void
37
    {
38 4
        $this->mergeConfigFrom(
39 4
            dirname(__DIR__).'/config/config.php',
40 4
            'wallet-vacuum'
41
        );
42
43 4
        $this->app->singleton(StoreService::class, StoreService::class);
44 4
        $this->app->singleton(Storable::class, Store::class);
45 4
    }
46
}
47