Test Failed
Push — main ( 680892...12263f )
by ikechukwu
12:25
created

QueuedFileUpload::runFileUpload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Ikechukwukalu\Clamavfileupload\Facade;
4
5
use Ikechukwukalu\Clamavfileupload\Events\ClamavQueuedFileScan;
6
use Ikechukwukalu\Clamavfileupload\Models\FileUpload as FileUploadModel;
7
use Ikechukwukalu\Clamavfileupload\Support\ClamavFileUpload as ClamavFileUploadSupport;
8
use Ikechukwukalu\Clamavfileupload\Support\TemporaryFileUpload;
9
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
10
use Illuminate\Http\Request;
11
12
class QueuedFileUpload extends FileUploadLogic
13
{
14
    /**
15
     * Upload single or multiple files.
16
     *
17
     * @param  \Illuminate\Http\Request  $request
18
     * @param  array  $settings
19
     * @return  \Ikechukwukalu\Clamavfileupload\Models\FileUpload
20
     * @return  \Illuminate\Database\Eloquent\Collection
21
     * @return  bool
22
     */
23
    public static function uploadFiles(Request $request,
24
                array $settings = []): bool|FileUploadModel|EloquentCollection
25
    {
26
        self::customFileUploadSettings($settings);
27
        self::fileUploadSettings($request);
28
        return self::runFileUpload($settings);
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::runFileUpload($settings) returns the type true which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
29
    }
30
31
    /**
32
     * Run files scan and upload.
33
     *
34
     * @param  array  $settings
35
     * @return  bool
36
     */
37
    protected static function runFileUpload(array $settings = []): bool
38
    {
39
        $tmpFiles = TemporaryFileUpload::storeFiles();
40
        self::$ref = self::setRef();
41
42
        ClamavQueuedFileScan::dispatch($tmpFiles, $settings, self::$ref);
43
        return true;
44
    }
45
46
}
47