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.

ExportServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 10 1
A boot() 0 19 2
A getDisk() 0 15 2
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
use Spatie\Export\Destinations\FilesystemDestination;
10
11
class ExportServiceProvider extends ServiceProvider
12
{
13
    public function register(): void
14
    {
15
        $this->mergeConfigFrom(__DIR__.'/../config/export.php', 'export');
16
17
        $this->app->singleton(Destination::class, function () {
18
            return new FilesystemDestination($this->getDisk());
19
        });
20
21
        $this->app->singleton(Exporter::class);
22
    }
23
24
    public function boot(): void
25
    {
26
        if ($this->app->runningInConsole()) {
27
            $this->publishes([
28
                __DIR__.'/../config/export.php' => config_path('export.php'),
29
            ], 'config');
30
31
            $this->commands([
32
                ExportCommand::class,
33
            ]);
34
        }
35
36
        $this->app->make(Exporter::class)
37
            ->cleanBeforeExport(config('export.clean_before_export', false))
38
            ->crawl(config('export.crawl', false))
39
            ->paths(config('export.paths', []))
40
            ->includeFiles(config('export.include_files', []))
41
            ->excludeFilePatterns(config('export.exclude_file_patterns', []));
42
    }
43
44
    protected function getDisk(): Filesystem
45
    {
46
        if (! config('export.disk')) {
47
            config([
48
                'filesystems.disks.laravel_export' => [
49
                    'driver' => 'local',
50
                    'root' => base_path('dist'),
51
                ],
52
            ]);
53
54
            return Storage::disk('laravel_export');
55
        }
56
57
        return Storage::disk(config('export.disk'));
58
    }
59
}
60