Passed
Push — main ( ac25fd...00e2bd )
by Yaroslav
14:14
created

CustomExport::name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace NovaExportConfiguration\Export;
4
5
use Laravel\Nova\Nova;
6
use Maatwebsite\Excel\Concerns\Exportable;
7
use Maatwebsite\Excel\Concerns\WithEvents;
8
use Maatwebsite\Excel\Events\AfterSheet;
9
10
abstract class CustomExport implements WithEvents
11
{
12
    use Exportable, HasFileModel, WithNotification;
0 ignored issues
show
introduced by
The trait NovaExportConfiguration\Export\WithNotification requires some properties which are not provided by NovaExportConfiguration\Export\CustomExport: $name, $path, $exists
Loading history...
introduced by
The trait Maatwebsite\Excel\Concerns\Exportable requires some properties which are not provided by NovaExportConfiguration\Export\CustomExport: $disk, $diskOptions, $fileName, $filePath, $writerType, $headers
Loading history...
13
14
    public static function key(): string
15
    {
16
        return class_basename(static::class);
17
    }
18
19
    public static function name(): string
20
    {
21
        return Nova::humanize(class_basename(static::class));
22
    }
23
24
    public static function queueName(): ?string
25
    {
26
        return config('nova-export-configuration.defaults.queue');
27
    }
28
29
    public static function diskName(): ?string
30
    {
31
        return config('nova-export-configuration.defaults.disk');
32
    }
33
34
    public function registerEvents(): array
35
    {
36
        return [
37
            AfterSheet::class => function (AfterSheet $event) {
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
            AfterSheet::class => function (/** @scrutinizer ignore-unused */ AfterSheet $event) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
                $fileModel = $this->saveFileFromModel();
39
                if($fileModel?->exists) {
40
                    $this->notifyUser($fileModel);
41
                }
42
            },
43
        ];
44
    }
45
}
46