NoContainerAvailable   A
last analyzed

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