WorkingVolume::getOuterDepth()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
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 2
cts 2
cp 1
crap 1
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
readonly class WorkingVolume implements Box, JsonSerializable
18
{
19 21
    public function __construct(
20
        private int $width,
21
        private int $length,
22
        private int $depth,
23
        private int $maxWeight
24
    ) {
25 21
    }
26
27 20
    public function getReference(): string
28
    {
29 20
        return "Working Volume {$this->width}x{$this->length}x{$this->depth}";
30
    }
31
32 1
    public function getOuterWidth(): int
33
    {
34 1
        return $this->width;
35
    }
36
37 1
    public function getOuterLength(): int
38
    {
39 1
        return $this->length;
40
    }
41
42 1
    public function getOuterDepth(): int
43
    {
44 1
        return $this->depth;
45
    }
46
47 20
    public function getEmptyWeight(): int
48
    {
49 20
        return 0;
50
    }
51
52 20
    public function getInnerWidth(): int
53
    {
54 20
        return $this->width;
55
    }
56
57 20
    public function getInnerLength(): int
58
    {
59 20
        return $this->length;
60
    }
61
62 20
    public function getInnerDepth(): int
63
    {
64 20
        return $this->depth;
65
    }
66
67 20
    public function getMaxWeight(): int
68
    {
69 20
        return $this->maxWeight;
70
    }
71
72 1
    public function jsonSerialize(): array
73
    {
74 1
        return [
75 1
            'reference' => $this->getReference(),
76 1
            'width' => $this->width,
77 1
            'length' => $this->length,
78 1
            'depth' => $this->depth,
79 1
            'maxWeight' => $this->maxWeight,
80 1
        ];
81
    }
82
}
83