UnexpectedPropertyType::expectedThe()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 1
nop 4
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