Image   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getSimpleName() 0 4 1
A getFilepath() 0 4 1
A getImage() 0 4 1
A getWidth() 0 4 1
A getHeight() 0 4 1
A getX() 0 4 1
A getY() 0 4 1
A getSurface() 0 4 1
A setX() 0 6 1
A setY() 0 6 1
1
<?php
2
3
namespace CSSPrites;
4
5
class Image
6
{
7
    protected $filepath;
8
    protected $image;
9
10
    protected $width;
11
    protected $height;
12
13
    protected $x = null;
14
    protected $y = null;
15
16 21
    public function __construct($filepath, $image)
17
    {
18 21
        $this->filepath = $filepath;
19 21
        $this->image    = $image;
20 21
        $this->width    = (int) $this->image->getWidth();
21 21
        $this->height   = (int) $this->image->getHeight();
22 21
    }
23
24 27
    public function getSimpleName()
25
    {
26 27
        return pathinfo($this->filepath, PATHINFO_FILENAME);
27
    }
28
29 21
    public function getFilepath()
30
    {
31 21
        return $this->filepath;
32
    }
33
34 3
    public function getImage()
35
    {
36 3
        return $this->image;
37
    }
38
39 24
    public function getWidth()
40
    {
41 24
        return $this->width;
42
    }
43
44 24
    public function getHeight()
45
    {
46 24
        return $this->height;
47
    }
48
49 24
    public function getX()
50
    {
51 24
        return $this->x;
52
    }
53
54 24
    public function getY()
55
    {
56 24
        return $this->y;
57
    }
58
59 24
    public function getSurface()
60
    {
61 24
        return $this->width * $this->height;
62
    }
63
64 21
    public function setX($x)
65
    {
66 21
        $this->x = (int) $x;
67
68 21
        return $this;
69
    }
70
71 21
    public function setY($y)
72
    {
73 21
        $this->y = (int) $y;
74
75 21
        return $this;
76
    }
77
}
78