UnexpectedTypeException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 1
nop 2
1
<?php
2
/*
3
 * This file is part of cwdFancyGridBundle
4
 *
5
 * (c)2017 cwd.at GmbH <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
declare(strict_types=1);
11
namespace Cwd\FancyGridBundle\Grid\Exception;
12
13
/**
14
 * Class UnexpectedTypeException
15
 * @package Cwd\FancyGridBundle\Grid\Exception
16
 * @author Ludwig Ruderstaler <[email protected]>
17
 */
18
class UnexpectedTypeException extends InvalidArgumentException
19
{
20
    /**
21
     * UnexpectedTypeException constructor.
22
     * @param string $value
23
     * @param int    $expectedType
24
     */
25
    public function __construct($value, $expectedType)
26
    {
27
        parent::__construct(
28
            sprintf('Expected argument of type "%s", "%s" given',
29
                $expectedType,
30
                is_object($value) ? get_class($value) : gettype($value)
31
            )
32
        );
33
    }
34
}
35