Completed
Push — master ( b69e83...ad913f )
by Vladimir
02:54
created

CacheServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 25
c 0
b 0
f 0
rs 10
wmc 1
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
adapter() 0 1 ?
A register() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Cache;
6
7
use FondBot\Contracts\Cache;
8
use League\Container\ServiceProvider\AbstractServiceProvider;
9
10
abstract class CacheServiceProvider extends AbstractServiceProvider
11
{
12
    protected $provides = [
13
        Cache::class,
14
    ];
15
16
    /**
17
     * Cache adapter.
18
     *
19
     * @return Adapter
20
     */
21
    abstract public function adapter(): Adapter;
22
23
    /**
24
     * Use the register method to register items with the container via the
25
     * protected $this->container property or the `getContainer` method
26
     * from the ContainerAwareTrait.
27
     *
28
     * @return void
29
     */
30
    public function register(): void
31
    {
32
        $this->getContainer()->share(Cache::class, $this->adapter());
33
    }
34
}
35