CompositeMappingFailure   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A both() 0 9 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Hydration\Mapping\Composite;
4
5
use RuntimeException;
6
use Stratadox\HydrationMapping\MappingFailure;
7
use function lcfirst;
8
use function sprintf;
9
10
final class CompositeMappingFailure extends RuntimeException implements MappingFailure
11
{
12
    public static function both(
13
        MappingFailure $first,
14
        MappingFailure $second
15
    ): MappingFailure {
16
        return new self(sprintf(
17
            '%s When tried as alternative, %s',
18
            $first->getMessage(),
19
            lcfirst($second->getMessage())
20
        ), 0, $second);
21
    }
22
}
23