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

CropImageDO   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 113
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 11
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 113
ccs 0
cts 28
cp 0
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getX() 0 4 1
A setX() 0 5 1
A getY() 0 4 1
A setY() 0 5 1
A getWidth() 0 4 1
A setWidth() 0 5 1
A getHeight() 0 4 1
A setHeight() 0 5 1
A __toString() 0 4 1
A toArray() 0 9 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
}