Test Failed
Push — stable ( a61ff6...01ae3e )
by Nuno
01:52
created

Configurations   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bootstrap() 0 16 4
A getCacheConfig() 0 11 1
1
<?php
2
3
namespace LaravelZero\Framework\Bootstrappers;
4
5
use Illuminate\Console\Scheduling;
6
use LaravelZero\Framework\Commands;
7
8
/**
9
 * This is the Laravel Zero Framework Bootstrapper Configuration class.
10
 *
11
 * Configures the console application.
12
 *
13
 * Takes in consideration the app name and the app version. Also
14
 * adds all the application commands.
15
 *
16
 * @author Nuno Maduro <[email protected]>
17
 */
18
class Configurations extends Bootstrapper
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function bootstrap(): void
24
    {
25
        $config = $this->container->make('config');
26
27
        if ($name = $config->get('app.name')) {
28
            $this->application->setName($name);
29
        }
30
31
        if ($version = $config->get('app.version')) {
32
            $this->application->setVersion($version);
33
        }
34
35
        if ($config->get('cache') === null) {
36
            $config->set('cache', $this->getCacheConfig());
37
        }
38
    }
39
40
    /**
41
     * Returns the default application cache config.
42
     *
43
     * In order to keep it simple we use the `array` driver. Feel free
44
     * to use another driver, be sure to check the cache component
45
     * documentation.
46
     *
47
     * @return array
48
     */
49
    protected function getCacheConfig(): array
50
    {
51
        return [
52
            'default' => 'array',
53
            'stores' => [
54
                'array' => [
55
                    'driver' => 'array',
56
                ],
57
            ],
58
        ];
59
    }
60
}
61