Passed
Pull Request — master (#53)
by Alexander
15:02
created

BadDeclarationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 7
c 1
b 0
f 1
dl 0
loc 10
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
    public function __construct(string $parameter, string $class, $argument)
12
    {
13
        $type = is_object($argument) ? 'Instance of ' . get_class($argument) : ucfirst(getType($argument));
14
        parent::__construct(sprintf(
15
            '%s should be instance of %s or its declaration. %s was received instead.',
16
            $parameter,
17
            $class,
18
            $type
19
        ));
20
    }
21
}
22