VacuumServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 35
ccs 6
cts 6
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
A boot() 0 12 3
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