Passed
Pull Request — master (#78)
by Alexander
02:50
created

NotFoundException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 13
ccs 0
cts 5
cp 0
rs 10
wmc 2

2 Methods

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