InvalidArgumentException::wrongType()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
rs 9.4285
cc 2
eloc 7
nc 1
nop 3
1
<?php
2
3
namespace PhpDDD\DomainDrivenDesign\Exception;
4
5
/**
6
 *
7
 */
8
final class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
9
{
10
    public static function wrongType($argumentName, $value, $expectedType)
11
    {
12
        return new self(
13
            sprintf(
14
                'The parameter "%s" expect to be of type %s, %s given.',
15
                $argumentName,
16
                $expectedType,
17
                is_object($value) ? get_class($value) : gettype($value)
18
            )
19
        );
20
    }
21
}
22