Completed
Push — master ( c3fb1e...80f01e )
by Jesse
03:03
created

NoContainerAvailable   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A whilstRequiredFor() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stratadox\Hydration\Mapper;
6
7
use BadMethodCallException as BadMethodCall;
8
use function sprintf as withMessage;
9
use Stratadox\HydrationMapper\InvalidMapperConfiguration as InvalidMapper;
10
11
/**
12
 * Indicates that a container was necessary but not available.
13
 *
14
 * @package Stratadox\Hydrate
15
 * @author Stratadox
16
 */
17
final class NoContainerAvailable extends BadMethodCall implements InvalidMapper
18
{
19
    /**
20
     * Produce an exception for when there is no container defined for a class.
21
     *.
22
     * @param string $class The class that is missing a container.
23
     * @return self         The exception object.
24
     */
25
    public static function whilstRequiredFor(string $class) : NoContainerAvailable
26
    {
27
        return new NoContainerAvailable(withMessage(
28
            'Could not produce mapping due to a missing container for class `%s`',
29
            $class
30
        ));
31
    }
32
}
33