Completed
Push — stable ( 86ecc3...3a45ea )
by Nuno
07:34
created

FilesystemServiceProvider::getDefaultConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
crap 1
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\Filesystem;
13
14
use Illuminate\Contracts\Filesystem\Filesystem;
15
use Illuminate\Filesystem\FilesystemServiceProvider as BaseServiceProvider;
16
17
/**
18
 * This is the Laravel Zero Framework Filesystem Service Provider implementation.
19
 */
20
class FilesystemServiceProvider extends BaseServiceProvider
21
{
22
    /**
23
     * Register Filesystem service.
24
     *
25
     * @return void
26
     */
27 21
    public function register(): void
28
    {
29 21
        parent::register();
30
31 21
        $this->app->alias('filesystem.disk', Filesystem::class);
32
33 21
        $config = $this->app->make('config');
34
35 21
        if ($config->get('filesystems.default') === null) {
36 21
            $config->set('filesystems', $this->getDefaultConfig());
37
        }
38 21
    }
39
40
    /**
41
     * Returns the default application filesystems config.
42
     *
43
     * We it simple we use the `local` driver.
44
     *
45
     * @return array
46
     */
47 21
    protected function getDefaultConfig(): array
48
    {
49
        return [
50 21
            'default' => 'local',
51
            'disks' => [
52
                'local' => [
53 21
                    'driver' => 'local',
54 21
                    'root' => $this->app->storagePath('app'),
55
                ],
56
            ],
57
        ];
58
    }
59
}
60