Completed
Push — stable ( 86ecc3...3a45ea )
by Nuno
07:34
created

CacheServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 2
A getDefaultConfig() 0 11 1
1
<?php
2
3
/**
4
 * This file is part of Laravel Zero.
5
 *
6
 * (c) Nuno Maduro <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace LaravelZero\Framework\Providers\Cache;
13
14
use Illuminate\Cache\CacheServiceProvider as BaseServiceProvider;
15
16
/**
17
 * This is the Laravel Zero Framework Cache Service Provider implementation.
18
 */
19
class CacheServiceProvider extends BaseServiceProvider
20
{
21
    /**
22
     * Register the Cache Service Provider.
23
     *
24
     * @return void
25
     */
26 21
    public function register(): void
27
    {
28 21
        parent::register();
29
30 21
        if ($this->app['config']->get('cache') === null) {
31 21
            $this->app['config']->set('cache', $this->getDefaultConfig());
32
        }
33 21
    }
34
35
    /**
36
     * Returns the default application cache config.
37
     *
38
     * We keep it simple using the `array` driver.
39
     *
40
     * @return array
41
     */
42 21
    protected function getDefaultConfig(): array
43
    {
44
        return [
45 21
            'default' => 'array',
46
            'stores' => [
47
                'array' => [
48
                    'driver' => 'array',
49
                ],
50
            ],
51
        ];
52
    }
53
}
54