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

BadDeclarationException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 3
crap 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