Completed
Push — master ( d8ac6c...cd03ce )
by Jesse
02:57
created

MissingTheKey::inTheInput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 3
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stratadox\Hydration\Mapping\Property;
6
7
use function sprintf;
8
use InvalidArgumentException as InvalidArgument;
9
use Stratadox\Hydration\MapsProperty;
10
use Stratadox\Hydration\UnmappableInput;
11
12
class MissingTheKey extends InvalidArgument implements UnmappableInput
13
{
14
    public static function inTheInput(array $data, MapsProperty $mapping, string $key) : UnmappableInput
15
    {
16
        return new self(sprintf(
17
            'Missing the key `%s` for property `%s` the input data: %s; Mapper: %s',
18
            $key,
19
            $mapping->name(),
20
            json_encode($data),
21
            get_class($mapping)
22
        ));
23
    }
24
}
25