Resize   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 0
dl 0
loc 48
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A maintainAspectRatio() 0 4 1
A allowUpSizing() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\GuidedImage\Demand;
6
7
use Illuminate\Http\Request;
8
use ReliqArts\GuidedImage\Contract\GuidedImage;
9
10
final class Resize extends ExistingImage
11
{
12
    public const ROUTE_TYPE_NAME = 'resize';
13
14
    /**
15
     * @var mixed
16
     */
17
    private $maintainAspectRatio;
18
19
    /**
20
     * @var mixed
21
     */
22
    private $allowUpSizing;
23
24
    /**
25
     * Resized constructor.
26
     *
27
     * @param mixed $width
28
     * @param mixed $height
29
     * @param mixed $aspect
30
     * @param mixed $upSize
31
     * @param mixed $returnObject
32
     */
33
    public function __construct(
34
        Request $request,
35
        GuidedImage $guidedImage,
36
        $width,
37
        $height,
38
        $aspect = true,
39
        $upSize = null,
40
        $returnObject = null
41
    ) {
42
        parent::__construct($request, $guidedImage, $width, $height, $returnObject);
43
44
        $this->maintainAspectRatio = $aspect;
45
        $this->allowUpSizing = $upSize;
46
    }
47
48
    public function maintainAspectRatio(): bool
49
    {
50
        return !$this->isValueConsideredNull($this->maintainAspectRatio);
51
    }
52
53
    public function allowUpSizing(): bool
54
    {
55
        return !$this->isValueConsideredNull($this->allowUpSizing);
56
    }
57
}
58