Completed
Push — 1.x-dev ( 423a53...2f7d84 )
by Doug
48:23 queued 46:55
created

TestItem   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 101
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 101
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getDescription() 0 4 1
A getWidth() 0 4 1
A getLength() 0 4 1
A getDepth() 0 4 1
A getWeight() 0 4 1
A getVolume() 0 4 1
1
<?php
2
/**
3
 * Box packing (3D bin packing, knapsack problem)
4
 * @package BoxPacker
5
 * @author Doug Wright
6
 */
7
8
namespace DVDoug\BoxPacker\Test;
9
10
use DVDoug\BoxPacker\Item;
11
12
class TestItem implements Item
13
{
14
15
    /**
16
     * @var string
17
     */
18
    private $description;
19
20
    /**
21
     * @var int
22
     */
23
    private $width;
24
25
    /**
26
     * @var int
27
     */
28
    private $length;
29
30
    /**
31
     * @var int
32
     */
33
    private $depth;
34
35
    /**
36
     * @var int
37
     */
38
    private $weight;
39
40
    /**
41
     * @var int
42
     */
43
    private $volume;
44
45
    /**
46
     * TestItem constructor.
47
     *
48
     * @param string $description
49
     * @param int    $width
50
     * @param int    $length
51
     * @param int    $depth
52
     * @param int    $weight
53
     */
54
    public function __construct($description, $width, $length, $depth, $weight)
55
    {
56
        $this->description = $description;
57
        $this->width = $width;
58
        $this->length = $length;
59
        $this->depth = $depth;
60
        $this->weight = $weight;
61
62
        $this->volume = $this->width * $this->length * $this->depth;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getDescription()
69
    {
70
        return $this->description;
71
    }
72
73
    /**
74
     * @return int
75
     */
76
    public function getWidth()
77
    {
78
        return $this->width;
79
    }
80
81
    /**
82
     * @return int
83
     */
84
    public function getLength()
85
    {
86
        return $this->length;
87
    }
88
89
    /**
90
     * @return int
91
     */
92
    public function getDepth()
93
    {
94
        return $this->depth;
95
    }
96
97
    /**
98
     * @return int
99
     */
100
    public function getWeight()
101
    {
102
        return $this->weight;
103
    }
104
105
    /**
106
     * @return int
107
     */
108
    public function getVolume()
109
    {
110
        return $this->volume;
111
    }
112
}
113
114
115