GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 406932...992642 )
by Sebastian
02:26 queued 01:02
created

ExportServiceProvider::getDisk()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Spatie\Export;
4
5
use Illuminate\Contracts\Filesystem\Filesystem;
6
use Illuminate\Support\Facades\Storage;
7
use Illuminate\Support\ServiceProvider;
8
use Spatie\Export\Console\ExportCommand;
9
10
class ExportServiceProvider extends ServiceProvider
11
{
12
    public function register()
13
    {
14
        $this->mergeConfigFrom(__DIR__.'/../config/export.php', 'export');
15
16
        $this->app->singleton(Exporter::class, function () {
17
            return (new Exporter($this->getDisk()))
18
                ->entries(config('export.entries', []))
19
                ->include(config('export.include', []))
20
                ->exclude(config('export.exclude', []));
21
        });
22
23
        $this->commands([
24
            ExportCommand::class,
25
        ]);
26
    }
27
28
    public function boot()
29
    {
30
        if ($this->app->runningInConsole()) {
31
            $this->publishes([
32
                __DIR__.'/../config/export.php' => config_path('export.php'),
33
            ], 'config');
34
        }
35
    }
36
37
    protected function getDisk(): Filesystem
38
    {
39
        if (! config('export.disk')) {
40
            config([
41
                'filesystems.disks.laravel_export' => [
42
                    'driver' => 'local',
43
                    'root' => base_path('dist'),
44
                ],
45
            ]);
46
47
            return Storage::disk('laravel_export');
48
        }
49
50
        return Storage::disk(config('export.disk'));
51
    }
52
}
53