Passed
Branch master (267be1)
by Eugene
03:26
created

CropImageDO::getHeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Staticus\Resources\Image;
4
5
class CropImageDO implements CropImageDOInterface
6
{
7
    /**
8
     * Position of cropped area X coordinate of image left top corner
9
     * @var int
10
     */
11
    protected $x;
12
13
    /**
14
     * Position of cropped area Y coordinate of image left top corner
15
     * @var int
16
     */
17
    protected $y;
18
19
    /**
20
     * Width of cropped area
21
     * @var int
22
     */
23
    protected $width;
24
25
    /**
26
     * Height of cropped area
27
     * @var int
28
     */
29
    protected $height;
30
31
    /**
32
     * @return int
33
     */
34
    public function getX()
35
    {
36
        return $this->x;
37
    }
38
39
    /**
40
     * @param int $x
41
     * @return CropImageDO
42
     */
43
    public function setX($x)
44
    {
45
        $this->x = $x;
46
        return $this;
47
    }
48
49
    /**
50
     * @return int
51
     */
52
    public function getY()
53
    {
54
        return $this->y;
55
    }
56
57
    /**
58
     * @param int $y
59
     * @return CropImageDO
60
     */
61
    public function setY($y)
62
    {
63
        $this->y = $y;
64
        return $this;
65
    }
66
67
    /**
68
     * @return int
69
     */
70
    public function getWidth()
71
    {
72
        return $this->width;
73
    }
74
75
    /**
76
     * @param int $width
77
     * @return CropImageDO
78
     */
79
    public function setWidth($width)
80
    {
81
        $this->width = $width;
82
        return $this;
83
    }
84
85
    /**
86
     * @return int
87
     */
88
    public function getHeight()
89
    {
90
        return $this->height;
91
    }
92
93
    /**
94
     * @param int $height
95
     * @return CropImageDO
96
     */
97
    public function setHeight($height)
98
    {
99
        $this->height = $height;
100
        return $this;
101
    }
102
103
    public function __toString()
104
    {
105
        return $this->getX() . 'x' . $this->getY() . 'x' . $this->getWidth() . 'x' . $this->getHeight();
106
    }
107
108
    public function toArray()
109
    {
110
        $ar = [];
111
        foreach ($this as $k => $p) {
0 ignored issues
show
Bug introduced by
The expression $this of type this<Staticus\Resources\Image\CropImageDO> is not traversable.
Loading history...
112
            $ar[$k] = $p;
113
        }
114
115
        return $ar;
116
    }
117
}