Issues (96)

src/Services/QueuedFileUpload.php (4 issues)

1
<?php
2
3
namespace Ikechukwukalu\Clamavfileupload\Services;
4
5
use Ikechukwukalu\Clamavfileupload\Contracts\FileUploadInterface;
6
use Ikechukwukalu\Clamavfileupload\Facades\Support\TemporaryFileUpload;
7
use Ikechukwukalu\Clamavfileupload\Events\ClamavQueuedFileScan;
8
use Ikechukwukalu\Clamavfileupload\Models\FileUpload as FileUploadModel;
9
use Ikechukwukalu\Clamavfileupload\Support\ClamavFileUpload;
10
use Ikechukwukalu\Clamavfileupload\Trait\QueuedDelete;
11
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
12
use Illuminate\Http\Request;
13
14
class QueuedFileUpload extends ClamavFileUpload implements FileUploadInterface
15
{
16
    use QueuedDelete;
17
18
    /**
19
     * Upload single or multiple files.
20
     *
21
     * @param  \Illuminate\Http\Request  $request
22
     * @param  array  $settings
23
     * @return  \Ikechukwukalu\Clamavfileupload\Models\FileUpload
24
     * @return  \Illuminate\Database\Eloquent\Collection
25
     * @return  bool
26
     */
27
    public function uploadFiles(Request $request,
28
                array $settings = []): bool|FileUploadModel|EloquentCollection
29
    {
30
        $this->customFileUploadSettings($settings);
31
        $this->fileUploadSettings($request);
32
        return $this->runFileUpload($settings);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->runFileUpload($settings) returns the type true which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
33
    }
34
35
    /**
36
     * Run files scan and upload.
37
     *
38
     * @param  array  $settings
39
     * @return  bool
40
     */
41
    protected function runFileUpload(array $settings = []): bool
42
    {
43
        $fileUpload = new TemporaryFileUpload;
44
        $fileUpload::customFileUploadSettings($settings);
0 ignored issues
show
The method customFileUploadSettings() does not exist on Ikechukwukalu\Clamavfile...ort\TemporaryFileUpload. 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

44
        $fileUpload::/** @scrutinizer ignore-call */ 
45
                     customFileUploadSettings($settings);
Loading history...
45
        $fileUpload::fileUploadSettings($this->request);
0 ignored issues
show
The method fileUploadSettings() does not exist on Ikechukwukalu\Clamavfile...ort\TemporaryFileUpload. 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

45
        $fileUpload::/** @scrutinizer ignore-call */ 
46
                     fileUploadSettings($this->request);
Loading history...
46
47
        $tmpFiles = $fileUpload::fileUpload();
0 ignored issues
show
The method fileUpload() does not exist on Ikechukwukalu\Clamavfile...ort\TemporaryFileUpload. 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
        $tmpFiles = $fileUpload::fileUpload();
Loading history...
48
        $this->ref = $this->setRef();
49
50
        ClamavQueuedFileScan::dispatch($tmpFiles, $settings, $this->ref);
51
        return true;
52
    }
53
54
55
}
56