NotFoundException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Factory;
6
7
use Exception;
8
use Psr\Container\NotFoundExceptionInterface;
9
10
/**
11
 * NotFoundException is thrown when no definition or class was found in the factory for a given ID.
12
 */
13
final class NotFoundException extends Exception implements NotFoundExceptionInterface
14
{
15
    /**
16
     * @param string $id ID of the definition or name of the class that was not found.
17
     */
18 5
    public function __construct(
19
        private string $id
20
    ) {
21 5
        parent::__construct(sprintf('No definition or class found or resolvable for %s.', $id));
22
    }
23
24 1
    public function getId(): string
25
    {
26 1
        return $this->id;
27
    }
28
}
29