UnexpectedTypeException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 5
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 7
ccs 0
cts 5
cp 0
crap 6
rs 10
1
<?php
2
3
namespace ByTIC\MediaLibrary\Exceptions;
4
5
/**
6
 * Class UnexpectedTypeException.
7
 */
8
class UnexpectedTypeException extends ValidatorException
9
{
10
    /**
11
     * UnexpectedTypeException constructor.
12
     *
13
     * @param string $value
14
     * @param int    $expectedType
15
     */
16
    public function __construct($value, $expectedType)
17
    {
18
        parent::__construct(
19
            sprintf(
20
                'Expected argument of type "%s", "%s" given',
21
                $expectedType,
22
                is_object($value) ? get_class($value) : gettype($value)
0 ignored issues
show
introduced by
The condition is_object($value) is always false.
Loading history...
23
            )
24
        );
25
    }
26
}
27