Completed
Push — master ( a303a7...df04fd )
by
unknown
03:08
created

ParameterBag   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 80
rs 10
c 0
b 0
f 0

6 Methods

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