NotValidRequestException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2
ccs 6
cts 6
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of FlexPHP.
4
 *
5
 * (c) Freddie Gar <[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
namespace FlexPHP\UseCases\Exception;
11
12
class NotValidRequestException extends \Exception implements UseCaseExceptionInterface
13
{
14
    /**
15
     * @param string $function
16
     * @param string $expected
17
     * @param mixed $used
18
     */
19 2
    public function __construct($function, $expected, $used)
20
    {
21 2
        $used = \is_object($used)
22 1
            ? \get_class($used)
23 2
            : \gettype($used);
24
25 2
        $message = \sprintf('Request for [%1$s] expected [%2$s] but used [%3$s]', $function, $expected, $used);
26
27 2
        parent::__construct($message);
28 2
    }
29
}
30