ItemTooLargeException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
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
declare(strict_types=1);
9
10
namespace DVDoug\BoxPacker;
11
12
use RuntimeException;
13
14
/**
15
 * Class ItemTooLargeException
16
 * Exception used when an item is too large to pack.
17
 */
18
class ItemTooLargeException extends RuntimeException
19
{
20
    /** @var Item */
21
    public $item;
22
23
    /**
24
     * ItemTooLargeException constructor.
25
     *
26
     * @param string $message
27
     * @param Item   $item
28
     */
29 3
    public function __construct(string $message, Item $item)
30
    {
31 3
        $this->item = $item;
32 3
        parent::__construct($message);
33 3
    }
34
35
    /**
36
     * @return Item
37
     */
38 3
    public function getItem(): Item
39
    {
40 3
        return $this->item;
41
    }
42
}
43