Passed
Push — 3.x ( ef7dd6...5c24fe )
by Doug
01:52
created

NoBoxesAvailableException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 4
cp 0.75
crap 1.0156
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 RuntimeException;
13
14
/**
15
 * Class NoBoxesAvailableException
16
 * Exception used when an item cannot be packed into any box.
17
 */
18
class NoBoxesAvailableException extends RuntimeException
19
{
20
    /** @var Item */
21
    public $item;
22
23
    /**
24
     * NoBoxesAvailableException constructor.
25
     */
26 6
    public function __construct(string $message, Item $item)
27
    {
28 6
        $this->item = $item;
29 6
        parent::__construct($message);
30 6
    }
31
32 2
    public function getItem(): Item
33
    {
34 2
        return $this->item;
35
    }
36
}
37