UnexpectedPropertyType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A expectedThe() 0 13 2
1
<?php
2
3
namespace Stratadox\Hydration\Proxying;
4
5
use function get_class;
6
use function gettype;
7
use InvalidArgumentException;
8
use function is_object;
9
use function sprintf;
10
use Stratadox\Hydration\UnmappableInput;
11
12
class UnexpectedPropertyType extends InvalidArgumentException implements UnmappableInput
13
{
14
    public static function expectedThe(
15
        string $interface,
16
        $object,
17
        $actual,
18
        string $property
19
    ) : UnmappableInput
20
    {
21
        return new static(sprintf(
22
            'Could not assign the value for `%s::%s`, got an `%s` instead of `%s`',
23
            get_class($object),
24
            $property,
25
            is_object($actual) ? get_class($actual) : gettype($actual),
26
            $interface
27
        ));
28
    }
29
}
30