Completed
Push — master ( 9e9e7e...b5260b )
by Jesse
02:00
created

CannotMakeMapping::missingTheLabelFor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Stratadox\TableLoader;
5
6
use function sprintf as withMessage;
7
use UnexpectedValueException;
8
9
/**
10
 * Notifies the client code that the table mapping could not be produced.
11
 *
12
 * @author Stratadox
13
 */
14
final class CannotMakeMapping
15
    extends UnexpectedValueException
16
    implements CannotMakeTableMapping
17
{
18
    public static function missingTheIdentityColumns(
19
        string $theirLabel,
20
        string $ourLabel
21
    ): CannotMakeTableMapping {
22
        return new CannotMakeMapping(withMessage(
23
            'Cannot make a mapping for the `%s` objects: ' .
24
            'Cannot resolve the identifying columns for the `%s` relation.',
25
            $ourLabel,
26
            $theirLabel
27
        ));
28
    }
29
30
    public static function missingTheLabelFor(
31
        string $choiceTrigger
32
    ): CannotMakeTableMapping {
33
        return new CannotMakeMapping(withMessage(
34
            'Cannot make a mapping for the `%s` objects: ' .
35
            'The label for the source relation was not provided.',
36
            $choiceTrigger
37
        ));
38
    }
39
}
40