Test Failed
Push — master ( bdaab5...176ee2 )
by Vladimir
06:36
created

CacheServiceProvider::adapter()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 1
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Foundation;
6
7
use Psr\SimpleCache\CacheInterface;
8
use League\Container\ServiceProvider\AbstractServiceProvider;
9
10
abstract class CacheServiceProvider extends AbstractServiceProvider
11
{
12
    protected $provides = [
13
        CacheInterface::class,
14
    ];
15
16
    /**
17
     * Cache adapter.
18
     *
19
     * @return CacheInterface
20
     */
21
    abstract public function adapter(): CacheInterface;
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->container->share(CacheInterface::class, $this->adapter());
33
    }
34
}
35