Test Failed
Pull Request — stable (#73)
by Nuno
04:10
created

ServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 2
A getDefaultConfig() 0 11 1
1
<?php
2
3
namespace LaravelZero\Framework\Providers\Cache;
4
5
use Illuminate\Cache\CacheServiceProvider as BaseServiceProvider;
6
7
/**
8
 * This is the Laravel Zero Framework Filesystem service provider class.
9
 *
10
 * @author Nuno Maduro <[email protected]>
11
 */
12
class ServiceProvider extends BaseServiceProvider
13
{
14
    /**
15
     * Register Scheduler service.
16
     *
17
     * @return void
18
     */
19
    public function register(): void
20
    {
21
        parent::register();
22
23
        $config = $this->app->make('config');
24
25
        if ($config->get('cache') === null) {
26
            $config->set('cache', $this->getDefaultConfig());
27
        }
28
    }
29
30
    /**
31
     * Returns the default application cache config.
32
     *
33
     * In order to keep it simple we use the `array` driver. Feel free
34
     * to use another driver, be sure to check the cache component
35
     * documentation.
36
     *
37
     * @return array
38
     */
39
    protected function getDefaultConfig(): array
40
    {
41
        return [
42
            'default' => 'array',
43
            'stores' => [
44
                'array' => [
45
                    'driver' => 'array',
46
                ],
47
            ],
48
        ];
49
    }
50
}
51