Passed
Push — main ( 7e57b3...985f30 )
by Vasil
03:35
created

Size::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Model;
6
7
use VasilDakov\Speedy\Property;
8
use JMS\Serializer\Annotation as Serializer;
9
10
/**
11
 * Class Size.
12
 *
13
 * @author Vasil Dakov <[email protected]>
14
 * @copyright 2009-2022 Neutrino.bg
15
 *
16
 * @version 1.0
17
 */
18
class Size
19
{
20
    /**
21
     * @Serializer\Type("int")
22
     */
23
    private int $width;
24
25
    /**
26
     * @Serializer\Type("int")
27
     */
28
    private int $depth;
29
30
    /**
31
     * @Serializer\Type("int")
32
     */
33
    private int $height;
34
35 5
    public function __construct(int $width, int $depth, int $height)
36
    {
37 5
        $this->width = $width;
38 5
        $this->depth = $depth;
39 5
        $this->height = $height;
40
    }
41
42 3
    public function getWidth(): int
43
    {
44 3
        return $this->width;
45
    }
46
47
    public function setWidth(int $width): void
48
    {
49
        $this->width = $width;
50
    }
51
52 3
    public function getDepth(): int
53
    {
54 3
        return $this->depth;
55
    }
56
57
    public function setDepth(int $depth): void
58
    {
59
        $this->depth = $depth;
60
    }
61
62 3
    public function getHeight(): int
63
    {
64 3
        return $this->height;
65
    }
66
67
    public function setHeight(int $height): void
68
    {
69
        $this->height = $height;
70
    }
71
72 2
    public function toArray(): array
73
    {
74 2
        return [
75 2
            Property::WIDTH->value => $this->getWidth(),
76 2
            Property::DEPTH->value => $this->getDepth(),
77 2
            Property::HEIGHT->value => $this->getHeight(),
78 2
        ];
79
    }
80
}
81