BindingServiceProvider::configurePackage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MichaelRubel\AutoBinder;
6
7
use Illuminate\Cache\CacheServiceProvider;
8
use Illuminate\Redis\RedisServiceProvider;
9
use MichaelRubel\AutoBinder\Commands\AutoBinderClearCommand;
10
use Spatie\LaravelPackageTools\Package;
11
use Spatie\LaravelPackageTools\PackageServiceProvider;
12
13
class BindingServiceProvider extends PackageServiceProvider
14
{
15
    /**
16
     * Configure the package.
17
     */
18 26
    public function configurePackage(Package $package): void
19
    {
20 26
        $package
21 26
            ->name('laravel-auto-binder')
22 26
            ->hasCommand(AutoBinderClearCommand::class);
23
    }
24
25
    /**
26
     * Register bindings.
27
     */
28 26
    public function registeringPackage(): void
29
    {
30 26
        if (! $this->app->bound('cache')) {
31 26
            $this->app->register(CacheServiceProvider::class, true);
32
        }
33
34 26
        if (! $this->app->bound('redis')) {
35 26
            $this->app->register(RedisServiceProvider::class);
36
        }
37
    }
38
}
39