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

CannotMakeMapping   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A missingTheIdentityColumns() 0 9 1
A missingTheLabelFor() 0 7 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