Completed
Push — develop ( 90d434...5a25e9 )
by Michael
02:38
created

UnexpectedTypeException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
1
<?php
2
3
namespace Crummy\Phlack\Common\Exception;
4
5
class UnexpectedTypeException extends \InvalidArgumentException
6
{
7
    /**
8
     * @param mixed        $value
9
     * @param string|array $expectedType
10
     */
11 2
    public function __construct($value, $expectedType)
12
    {
13 2
        parent::__construct(sprintf(
14 2
            'Expected argument of type %s, %s given.',
15 2
            is_array($expectedType) ? '('.implode(' | ', $expectedType).')' : $expectedType,
16 2
            is_object($value) ? get_class($value) : gettype($value)
17
        ));
18 2
    }
19
}
20