Completed
Pull Request — master (#59)
by
unknown
06:54
created

FitBox::getInnerWidth()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace DVDoug\BoxPacker;
4
5
6
class FitBox implements Box
7
{
8
9
    /**
10
     * FitBox constructor.
11
     * @param Item $item
12
     */
13 2
    public function __construct(Item $item)
14
    {
15 2
        $this->item = $item;
16 2
    }
17
18
    /**
19
     * @var Item
20
     */
21
    protected $item;
22
23
    /**
24
     * Reference for box type (e.g. SKU or description)
25
     * @return string
26
     */
27 2
    public function getReference()
28
    {
29 2
        return $this->item->getDescription();
30
    }
31
32
    /**
33
     * Outer width in mm
34
     * @return int
35
     */
36
    public function getOuterWidth()
37
    {
38
        return $this->item->getWidth() + 1;
39
    }
40
41
    /**
42
     * Outer length in mm
43
     * @return int
44
     */
45
    public function getOuterLength()
46
    {
47
        return $this->item->getLength() + 1;
48
    }
49
50
    /**
51
     * Outer depth in mm
52
     * @return int
53
     */
54
    public function getOuterDepth()
55
    {
56
        return $this->item->getDepth() + 1;
57
    }
58
59
    /**
60
     * Empty weight in g
61
     * @return int
62
     */
63 2
    public function getEmptyWeight()
64
    {
65 2
        return 0;
66
    }
67
68
    /**
69
     * Inner width in mm
70
     * @return int
71
     */
72 2
    public function getInnerWidth()
73
    {
74 2
        return $this->item->getWidth() + 1;
75
    }
76
77
    /**
78
     * Inner length in mm
79
     * @return int
80
     */
81 2
    public function getInnerLength()
82
    {
83 2
        return $this->item->getLength() + 1;
84
    }
85
86
    /**
87
     * Inner depth in mm
88
     * @return int
89
     */
90 2
    public function getInnerDepth()
91
    {
92 2
        return $this->item->getDepth() + 1;
93
    }
94
95
    /**
96
     * Total inner volume of packing in mm^3
97
     * @return int
98
     */
99 2
    public function getInnerVolume()
100
    {
101 2
        return $this->getInnerDepth() * $this->getInnerLength() * $this->getInnerWidth();
102
    }
103
104
    /**
105
     * Max weight the packaging can hold in g
106
     * @return int
107
     */
108 2
    public function getMaxWeight()
109
    {
110 2
        return $this->item->getWeight() + 1;
111
    }
112
}