Package   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 52
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 8 1
A __construct() 0 7 1
A getInsurance() 0 3 1
A setInsurance() 0 3 1
1
<?php
2
3
namespace MelhorEnvio\Resources\Shipment;
4
5
class Package extends Volume
6
{
7
    /**
8
     * @var int|float
9
     */
10
    protected $insurance;
11
12
    /**
13
     * Package constructor
14
     *
15
     * @param $height
16
     * @param $width
17
     * @param $length
18
     * @param $weight
19
     * @param $insurance
20
     */
21
    public function __construct($height, $width, $length, $weight, $insurance)
22
    {
23
        $this->setHeight($height);
24
        $this->setWidth($width);
25
        $this->setLength($length);
26
        $this->setWeight($weight);
27
        $this->setInsurance($insurance);
28
    }
29
30
    /**
31
     * @return int|float
32
     */
33
    public function getInsurance()
34
    {
35
        return $this->insurance;
36
    }
37
38
    /**
39
     * @param int|float $insurance
40
     */
41
    public function setInsurance($insurance)
42
    {
43
        $this->insurance = $insurance;
44
    }
45
46
    /**
47
     * @return array
48
     */
49
    public function toArray()
50
    {
51
        return [
52
            'height' => $this->getHeight(),
53
            'width' => $this->getWidth(),
54
            'length' => $this->getLength(),
55
            'weight' => $this->getWeight(),
56
            'insurance' => $this->getInsurance(),
57
        ];
58
    }
59
}
60