Passed
Pull Request — master (#78)
by Dmitriy
02:32
created

NotInstantiableException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 4
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Factory\Exception;
6
7
use Exception;
8
use Psr\Container\ContainerExceptionInterface;
9
10
/**
11
 * NotInstantiableException represents an exception caused by incorrect dependency injection container
12
 * configuration or usage.
13
 */
14
class NotInstantiableException extends Exception implements ContainerExceptionInterface
15
{
16 5
    public function __construct(string $class, string $message = null, int $code = 0, Exception $previous = null)
17
    {
18 5
        if ($message === null) {
19 5
            $message = "Can not instantiate $class.";
20
        }
21 5
        parent::__construct($message, $code, $previous);
22 5
    }
23
}
24