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

NoClamavFileUpload::runFileUpload()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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