CollectionMappingFailure   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 encountered() 0 9 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Hydration\Mapping\Relation;
4
5
use RuntimeException;
6
use Stratadox\HydrationMapping\Mapping;
7
use Stratadox\HydrationMapping\MappingFailure;
8
use Throwable;
9
use function sprintf;
10
11
final class CollectionMappingFailure extends RuntimeException implements MappingFailure
12
{
13
    public static function encountered(
14
        Mapping $mapping,
15
        Throwable $exception
16
    ): MappingFailure {
17
        return new self(sprintf(
18
            'Failed to map the collection in the `%s` property: %s',
19
            $mapping->name(),
20
            $exception->getMessage()
21
        ), 0, $exception);
22
    }
23
}
24