ImageParameterBag   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 69
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getWidth() 0 4 1
A setWidth() 0 4 1
A getHeight() 0 4 1
A setHeight() 0 4 1
A toArray() 0 7 1
1
<?php
2
3
namespace MediaMonks\SonataMediaBundle\ParameterBag;
4
5
use MediaMonks\SonataMediaBundle\Model\MediaInterface;
6
7
class ImageParameterBag extends AbstractMediaParameterBag
8
{
9
    /**
10
     * @var int
11
     */
12
    protected $width;
13
14
    /**
15
     * @var int
16
     */
17
    protected $height;
18
19
    /**
20
     * @param int $width
21
     * @param int $height
22
     * @param array $extra
23
     */
24 20
    public function __construct($width, $height, array $extra = [])
25
    {
26 20
        $this->width = $width;
27 20
        $this->height = $height;
28
29 20
        parent::__construct($extra);
30 20
    }
31
32
    /**
33
     * @return int
34
     */
35 17
    public function getWidth()
36
    {
37 17
        return $this->width;
38
    }
39
40
    /**
41
     * @param int $width
42
     */
43 1
    public function setWidth($width)
44
    {
45 1
        $this->width = $width;
46 1
    }
47
48
    /**
49
     * @return int
50
     */
51 17
    public function getHeight()
52
    {
53 17
        return $this->height;
54
    }
55
56
    /**
57
     * @param int $height
58
     */
59 1
    public function setHeight($height)
60
    {
61 1
        $this->height = $height;
62 1
    }
63
64
    /**
65
     * @param MediaInterface $media
66
     * @return array
67
     */
68 15
    public function toArray(MediaInterface $media)
69
    {
70 15
        return array_merge(parent::toArray($media), [
71 15
            'width' => $this->getWidth(),
72 15
            'height' => $this->getHeight(),
73
        ]);
74
    }
75
}
76