StoragePictureHandler::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
4
namespace App\Src\UseCases\Infra\Gateway;
5
6
7
use App\Src\UseCases\Domain\Shared\Gateway\PictureHandler;
8
use Intervention\Image\Facades\Image;
9
10
class StoragePictureHandler implements PictureHandler
11
{
12
    public function add(string $path, float $width, float $height)
13
    {
14
        Image::make(public_path('test/640*360.png'))->resize($width, $height)->save($path);
0 ignored issues
show
Bug introduced by
$height of type double is incompatible with the type integer expected by parameter $height of Intervention\Image\Image::resize(). ( Ignorable by Annotation )

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

14
        Image::make(public_path('test/640*360.png'))->resize($width, /** @scrutinizer ignore-type */ $height)->save($path);
Loading history...
Bug introduced by
$width of type double is incompatible with the type integer expected by parameter $width of Intervention\Image\Image::resize(). ( Ignorable by Annotation )

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

14
        Image::make(public_path('test/640*360.png'))->resize(/** @scrutinizer ignore-type */ $width, $height)->save($path);
Loading history...
15
    }
16
17
    public function widen(string $source, string $dest, float $width)
18
    {
19
        $img = Image::make($source)->widen($width);
0 ignored issues
show
Bug introduced by
$width of type double is incompatible with the type integer expected by parameter $width of Intervention\Image\Image::widen(). ( Ignorable by Annotation )

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

19
        $img = Image::make($source)->widen(/** @scrutinizer ignore-type */ $width);
Loading history...
20
        $img->save($dest);
21
    }
22
23
    public function heighten(string $source, string $dest, float $height)
24
    {
25
        $img = Image::make($source)->heighten($height);
0 ignored issues
show
Bug introduced by
$height of type double is incompatible with the type integer expected by parameter $height of Intervention\Image\Image::heighten(). ( Ignorable by Annotation )

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

25
        $img = Image::make($source)->heighten(/** @scrutinizer ignore-type */ $height);
Loading history...
26
        $img->save($dest);
27
    }
28
29
    public function width(string $path)
30
    {
31
        return Image::make($path)->width();
32
    }
33
34
    public function height(string $path)
35
    {
36
        return Image::make($path)->height();
37
    }
38
39
    public function write(string $source, string $dest)
40
    {
41
        $img = Image::make($source);
42
        $img->save($dest);
43
    }
44
45
}
46