WorkingVolume::getOuterWidth()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * Box packing (3D bin packing, knapsack problem).
5
 *
6
 * @author Doug Wright
7
 */
8
declare(strict_types=1);
9
10
namespace DVDoug\BoxPacker;
11
12
use JsonSerializable;
13
14
/**
15
 * Class WorkingVolume.
16
 * @internal
17
 */
18
readonly class WorkingVolume implements Box, JsonSerializable
19 21
{
20
    public function __construct(
21
        private int $width,
22
        private int $length,
23
        private int $depth,
24
        private int $maxWeight
25 21
    ) {
26
    }
27 20
28
    public function getReference(): string
29 20
    {
30
        return "Working Volume {$this->width}x{$this->length}x{$this->depth}";
31
    }
32 1
33
    public function getOuterWidth(): int
34 1
    {
35
        return $this->width;
36
    }
37 1
38
    public function getOuterLength(): int
39 1
    {
40
        return $this->length;
41
    }
42 1
43
    public function getOuterDepth(): int
44 1
    {
45
        return $this->depth;
46
    }
47 20
48
    public function getEmptyWeight(): int
49 20
    {
50
        return 0;
51
    }
52 20
53
    public function getInnerWidth(): int
54 20
    {
55
        return $this->width;
56
    }
57 20
58
    public function getInnerLength(): int
59 20
    {
60
        return $this->length;
61
    }
62 20
63
    public function getInnerDepth(): int
64 20
    {
65
        return $this->depth;
66
    }
67 20
68
    public function getMaxWeight(): int
69 20
    {
70
        return $this->maxWeight;
71
    }
72 1
73
    public function jsonSerialize(): array
74 1
    {
75 1
        return [
76 1
            'reference' => $this->getReference(),
77 1
            'width' => $this->width,
78 1
            'length' => $this->length,
79 1
            'depth' => $this->depth,
80 1
            'maxWeight' => $this->maxWeight,
81
        ];
82
    }
83
}
84