Passed
Pull Request — master (#353)
by
unknown
13:22
created

WorkingVolume::getMaxVolume()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
/**
3
 * Box packing (3D bin packing, knapsack problem).
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace DVDoug\BoxPacker;
10
11
use JsonSerializable;
12
13
/**
14
 * Class WorkingVolume.
15
 * @internal
16
 */
17
class WorkingVolume implements Box, JsonSerializable
18
{
19
    private int $width;
20
21
    private int $length;
22
23
    private int $depth;
24
25
    private int $maxWeight;
26
27 24
    public function __construct(
28
        int $width,
29
        int $length,
30
        int $depth,
31
        int $maxWeight
32
    ) {
33 24
        $this->width = $width;
34 24
        $this->length = $length;
35 24
        $this->depth = $depth;
36 24
        $this->maxWeight = $maxWeight;
37
    }
38
39 23
    public function getReference(): string
40
    {
41 23
        return "Working Volume {$this->width}x{$this->length}x{$this->depth}";
42
    }
43
44 1
    public function getType(): string
45
    {
46 1
        return "";
47
    }
48
49 1
    public function getOuterWidth(): int
50
    {
51 1
        return $this->width;
52
    }
53
54 1
    public function getOuterLength(): int
55
    {
56 1
        return $this->length;
57
    }
58
59 23
    public function getOuterDepth(): int
60
    {
61 23
        return $this->depth;
62
    }
63
64 23
    public function getEmptyWeight(): int
65
    {
66 23
        return 0;
67
    }
68
69 23
    public function getInnerWidth(): int
70
    {
71 23
        return $this->width;
72
    }
73
74 23
    public function getInnerLength(): int
75
    {
76 23
        return $this->length;
77
    }
78
79 23
    public function getInnerDepth(): int
80
    {
81 23
        return $this->depth;
82
    }
83
84 1
    public function getMaxWeight(): int
85
    {
86
        return $this->maxWeight;
87 1
    }
88 1
89 1
    public function setFlatBagDimensions($boxWidth, $boxLength, $boxDepth): bool
90 1
    {
91 1
        return true;
92
    }
93
94
    public function getMaxVolume(): int
95
    {
96
       return 0; 
97
    }
98
99
    public function setInnerDepth($depth): bool
100
    {
101
        return $this->innerDepth = $depth;
0 ignored issues
show
Bug Best Practice introduced by
The property innerDepth does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
102
    }
103
104
    public function jsonSerialize(): array
105
    {
106
        return [
107
            'reference' => $this->getReference(),
108
            'type' => $this->getType(),
109
            'width' => $this->width,
110
            'length' => $this->length,
111
            'depth' => $this->depth,
112
            'maxWeight' => $this->maxWeight,
113
        ];
114
    }
115
}
116