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

BasicFileUpload::fileUpload()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
nc 3
nop 0
dl 0
loc 13
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Ikechukwukalu\Clamavfileupload\Support;
4
5
use Illuminate\Http\Request;
6
use Ikechukwukalu\Clamavfileupload\Models\FileUpload as FileUploadModel;
7
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
8
use Ikechukwukalu\Clamavfileupload\Foundation\FileUpload;
9
10
class BasicFileUpload extends FileUpload
11
{
12
13
    /**
14
     * Run files scan and upload.
15
     *
16
     * @return  \Ikechukwukalu\Clamavfileupload\Models\FileUpload
17
     * @return  \Illuminate\Database\Eloquent\Collection
18
     * @return  bool
19
     */
20
    public static function fileUpload(): bool|FileUploadModel|EloquentCollection
21
    {
22
        if(self::$request->file()) {
23
            self::storeFiles();
24
25
            if (is_array(self::$request->file(self::$input))) {
26
                return self::insertMultipleFiles();
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::insertMultipleFiles() returns the type Illuminate\Database\Eloquent\Collection which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
27
            }
28
29
            return self::insertSingleFile();
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::insertSingleFile() could return the type null which is incompatible with the type-hinted return Ikechukwukalu\Clamavfile...uent\Collection|boolean. Consider adding an additional type-check to rule them out.
Loading history...
30
        }
31
32
        return null;
0 ignored issues
show
Bug Best Practice introduced by
The expression return null returns the type null which is incompatible with the type-hinted return Ikechukwukalu\Clamavfile...uent\Collection|boolean.
Loading history...
33
    }
34
}
35