ImageUploadEntity::img()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 10
rs 10
1
<?php
2
3
namespace Mostafaznv\Larupload\Concerns\Storage\UploadEntity;
4
5
6
use Illuminate\Http\UploadedFile;
7
use Mostafaznv\Larupload\Enums\LaruploadImageLibrary;
8
use Mostafaznv\Larupload\Storage\Image;
9
use Mostafaznv\Larupload\UploadEntities;
10
11
trait ImageUploadEntity
12
{
13
    /**
14
     * Image instance
15
     */
16
    protected Image $image;
17
18
    protected LaruploadImageLibrary $imageProcessingLibrary;
19
20
21
    protected function img(UploadedFile $file): Image
22
    {
23
        $this->image = new Image(
24
            file: $file,
25
            disk: $this->disk,
26
            library: $this->imageProcessingLibrary,
27
            dominantColorQuality: $this->dominantColorQuality
28
        );
29
30
        return $this->image;
31
    }
32
33
    public function imageProcessingLibrary(LaruploadImageLibrary $library): UploadEntities
34
    {
35
        $this->imageProcessingLibrary = $library;
36
37
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Mostafaznv\Larupload\Con...ntity\ImageUploadEntity which includes types incompatible with the type-hinted return Mostafaznv\Larupload\UploadEntities.
Loading history...
38
    }
39
}
40