CompositeMappingFailure::both()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 9
rs 10
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