Passed
Push — 1.x ( 457fa0...308477 )
by Doug
03:11
created

NoBoxesAvailableException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 4
cts 6
cp 0.6667
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getItem() 0 3 1
1
<?php
2
3
/**
4
 * Box packing (3D bin packing, knapsack problem).
5
 *
6
 * @author Doug Wright
7
 */
8
namespace DVDoug\BoxPacker;
9
10
use RuntimeException;
11
12
/**
13
 * Class NoBoxesAvailableException
14
 * Exception used when an item cannot be packed into any box.
15
 */
16
class NoBoxesAvailableException extends RuntimeException
17
{
18
    /** @var Item */
19
    public $item;
20
21
    /**
22
     * NoBoxesAvailableException constructor.
23
     */
24 3
    public function __construct($message, Item $item)
25
    {
26 3
        $this->item = $item;
27 3
        parent::__construct($message);
28 3
    }
29
30
    public function getItem()
31
    {
32
        return $this->item;
33
    }
34
}
35