RuleHandlerNotFoundException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 22
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Exception;
6
7
use RuntimeException;
8
use Throwable;
9
use Yiisoft\Validator\RuleHandlerResolver\RuleHandlerContainer;
10
11
/**
12 2
 * An exception used by {@see RuleHandlerContainer} for the case when a given class name was not found in the container.
13
 */
14 2
final class RuleHandlerNotFoundException extends RuntimeException
15 2
{
16
    public function __construct(
17
        /**
18
         * @var string A class name from failed attempt of search in the container.
19
         */
20
        string $className,
21
        /**
22
         * @var int The Exception code.
23
         */
24
        int $code = 0,
25
        /**
26
         * @var Throwable|null The previous throwable used for the exception chaining.
27
         */
28
        ?Throwable $previous = null,
29
    ) {
30
        parent::__construct(
31
            sprintf(
32
                'Handler was not found for "%s" rule or unresolved "%s" class.',
33
                $className,
34
                $className,
35
            ),
36
            $code,
37
            $previous,
38
        );
39
    }
40
}
41