Completed
Branch stable (378b09)
by Nuno
04:07 queued 02:17
created

ServiceProvider::getDefaultConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
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