CacheServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 34
rs 10
ccs 12
cts 14
cp 0.8571
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 5 1
A registerManager() 0 4 1
A register() 0 4 1
A registerDefaultStore() 0 4 1
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