Completed
Pull Request — master (#14)
by Benoît
06:43 queued 01:48
created

UnexpectedTypeException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Webmozart JSON package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webmozart\Json;
13
14
class UnexpectedTypeException extends \InvalidArgumentException
15
{
16
    /**
17
     * UnexpectedTypeException constructor.
18
     *
19
     * @param string $value
20
     * @param int    $expectedType
21
     */
22 1
    public function __construct($value, $expectedType)
23
    {
24 1
        parent::__construct(sprintf(
25 1
            'Expected argument of type "%s", "%s" given',
26 1
            $expectedType,
27 1
            is_object($value) ? get_class($value) : gettype($value)
28 1
        ));
29 1
    }
30
}
31