NotFoundException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A getName() 0 3 1
A getSolution() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Exception;
6
7
use Exception;
8
use JetBrains\PhpStorm\Pure;
9
use Psr\Container\NotFoundExceptionInterface;
10
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
11
12
final class NotFoundException extends Exception implements NotFoundExceptionInterface, FriendlyExceptionInterface
13
{
14 3
    #[Pure]
15
    public function __construct(string $class, string $message = null, int $code = 0, Exception $previous = null)
16
    {
17 3
        if ($message === null) {
18 3
            $message = sprintf('No definition or class found or resolvable for "%s".', $class);
19
        }
20 3
        parent::__construct($message, $code, $previous);
21
    }
22
23 1
    public function getSolution(): ?string
24
    {
25 1
        return 'Check if the class exists or if the class is properly defined.';
26
    }
27
28 1
    public function getName(): string
29
    {
30 1
        return 'Repository not found';
31
    }
32
}
33