Passed
Push — repack_layers_for_new_height ( e48686 )
by Doug
03:02
created

PackedLayer::getItems()   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
 * 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
/**
12
 * A packed layer
13
 *
14
 * @author Doug Wright
15
 */
16
class PackedLayer
17
{
18
    /**
19
     * Items packed into this layer.
20
     *
21
     * @var PackedItem[]
22
     */
23
    protected $items = [];
24
25
    /**
26
     * Add a packed item to this layer.
27
     *
28
     * @param PackedItem $packedItem
29
     */
30 20
    public function insert(PackedItem $packedItem): void
31
    {
32 20
        $this->items[] = $packedItem;
33 20
    }
34
35
    /**
36
     * Get the packed items
37
     *
38
     * @return PackedItem[]
39
     */
40 20
    public function getItems(): array
41
    {
42 20
        return $this->items;
43
    }
44
}
45