Issues (96)

src/Services/NoClamavFileUpload.php (8 issues)

1
<?php
2
3
namespace Ikechukwukalu\Clamavfileupload\Services;
4
5
use Ikechukwukalu\Clamavfileupload\Contracts\FileUploadInterface;
6
use Ikechukwukalu\Clamavfileupload\Facades\Support\BasicFileUpload;
7
use Ikechukwukalu\Clamavfileupload\Models\FileUpload as FileUploadModel;
8
use Ikechukwukalu\Clamavfileupload\Support\ClamavFileUpload;
9
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
10
use Illuminate\Http\Request;
11
12
class NoClamavFileUpload extends ClamavFileUpload implements FileUploadInterface
13
{
14
15
    private BasicFileUpload $fileUpload;
16
17
    /**
18
     * Upload single or multiple files.
19
     *
20
     * @param  \Illuminate\Http\Request  $request
21
     * @param  array  $settings
22
     * @return  \Ikechukwukalu\Clamavfileupload\Models\FileUpload
23
     * @return  \Illuminate\Database\Eloquent\Collection
24
     * @return  bool
25
     */
26
    public function uploadFiles(Request $request,
27
                array $settings = []): bool|FileUploadModel|EloquentCollection
28
    {
29
        $this->fileUpload = new BasicFileUpload;
30
        $this->fileUpload::customFileUploadSettings($settings);
0 ignored issues
show
The method customFileUploadSettings() does not exist on Ikechukwukalu\Clamavfile...Support\BasicFileUpload. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

30
        $this->fileUpload::/** @scrutinizer ignore-call */ 
31
                           customFileUploadSettings($settings);
Loading history...
31
        $this->fileUpload::fileUploadSettings($request);
0 ignored issues
show
The method fileUploadSettings() does not exist on Ikechukwukalu\Clamavfile...Support\BasicFileUpload. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

31
        $this->fileUpload::/** @scrutinizer ignore-call */ 
32
                           fileUploadSettings($request);
Loading history...
32
33
        return $this->runFileUpload($settings);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->runFileUpload($settings) also could return the type Illuminate\Database\Eloquent\Collection|boolean which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
34
    }
35
36
    /**
37
     * Run files scan and upload.
38
     *
39
     * @param  array $settings
40
     * @return  \Ikechukwukalu\Clamavfileupload\Models\FileUpload
41
     * @return  \Illuminate\Database\Eloquent\Collection
42
     * @return  bool
43
     */
44
    protected function runFileUpload($settings = []): bool|FileUploadModel|EloquentCollection
45
    {
46
        if ($data = $this->fileUpload::fileUpload()) {
0 ignored issues
show
The method fileUpload() does not exist on Ikechukwukalu\Clamavfile...Support\BasicFileUpload. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

46
        if ($data = $this->fileUpload::/** @scrutinizer ignore-call */ fileUpload()) {
Loading history...
47
            $this->ref = $this->fileUpload::getRef();
0 ignored issues
show
The method getRef() does not exist on Ikechukwukalu\Clamavfile...Support\BasicFileUpload. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

47
            /** @scrutinizer ignore-call */ 
48
            $this->ref = $this->fileUpload::getRef();
Loading history...
48
            $this->success = $this->fileUpload::isSuccessful();
0 ignored issues
show
The method isSuccessful() does not exist on Ikechukwukalu\Clamavfile...Support\BasicFileUpload. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

48
            /** @scrutinizer ignore-call */ 
49
            $this->success = $this->fileUpload::isSuccessful();
Loading history...
49
50
            return $data;
51
        }
52
53
        $this->failedUpload($this->fileUpload::getErrorMessage());
0 ignored issues
show
The method getErrorMessage() does not exist on Ikechukwukalu\Clamavfile...Support\BasicFileUpload. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

53
        $this->failedUpload($this->fileUpload::/** @scrutinizer ignore-call */ getErrorMessage());
Loading history...
54
        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...
55
    }
56
57
}
58