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

NoLoaderAvailable::for()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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 loader was necessary but not available.
13
 *
14
 * @package Stratadox\Hydrate
15
 * @author Stratadox
16
 */
17
final class NoLoaderAvailable extends BadMethodCall implements InvalidMapper
18
{
19
    /**
20
     * Produce an exception for when there is no loader defined for a class.
21
     *.
22
     * @param string $class The class that is missing a loader.
23
     * @return self         The exception object.
24
     */
25
    public static function whilstRequiredFor(string $class) : NoLoaderAvailable
26
    {
27
        return new NoLoaderAvailable(withMessage(
28
            'Could not produce mapping due to a missing loader for class `%s`',
29
            $class
30
        ));
31
    }
32
}
33