Completed
Push — stable ( 386c57...2cb6a4 )
by Nuno
02:05
created

CacheServiceProvider::register()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2
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 19
    public function register(): void
27
    {
28 19
        parent::register();
29
30 19
        if ($this->app['config']->get('cache') === null) {
31 19
            $this->app['config']->set('cache', $this->getDefaultConfig());
32
        }
33 19
    }
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 19
    protected function getDefaultConfig(): array
43
    {
44
        return [
45 19
            'default' => 'array',
46
            'stores' => [
47
                'array' => [
48
                    'driver' => 'array',
49
                ],
50
            ],
51
        ];
52
    }
53
}
54