NoLoaderAvailable::whilstRequiredFor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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