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

ServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

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