CacheServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 5
rs 10
ccs 0
cts 1
cp 0
crap 2
1
<?php
2
3
namespace Nip\Cache;
4
5
use ByTIC\PackageBase\BaseBootableServiceProvider;
6
7
/**
8
 * Class CacheServiceProvider
9
 * @package Nip\Cache
10
 *
11
 */
12
class CacheServiceProvider extends BaseBootableServiceProvider
13
{
14 1
    public const NAME = 'cache';
15
    public const NAME_STORE = 'cache.store';
16 1
17 1
    public function register()
18 1
    {
19
        $this->registerManager();
20 1
        $this->registerDefaultStore();
21
    }
22
23 1
    protected function registerManager()
24 1
    {
25 1
        $this->getContainer()->share(static::NAME, function () {
26
            return new CacheManager();
27 1
        });
28
    }
29
30 1
    protected function registerDefaultStore()
31 1
    {
32 1
        $this->getContainer()->share(static::NAME_STORE, function () {
33
            return $this->getContainer()->get('cache')->store();
34
        });
35
    }
36
37
38
    /**
39
     * @inheritdoc
40
     */
41
    public function provides()
42
    {
43
        return [
44
            static::NAME,
45
            static::NAME_STORE,
46
        ];
47
    }
48
}
49