Passed
Push — master ( b36cf1...75a4a8 )
by Aleksei
02:25
created

BadDeclarationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Exception;
6
7
use Exception;
8
9
class BadDeclarationException extends Exception
10
{
11 5
    public function __construct(string $parameter, string $class, $argument)
12
    {
13 5
        $type = is_object($argument) ? 'Instance of ' . get_class($argument) : ucfirst(gettype($argument));
14 5
        parent::__construct(sprintf(
15 5
            '%s should be instance of %s or its declaration. %s was received instead.',
16
            $parameter,
17
            $class,
18
            $type
19
        ));
20 5
    }
21
}
22