Passed
Pull Request — master (#93)
by Sergei
04:47 queued 02:36
created

NotFoundException::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Factory\Exception;
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 2
    public function __construct(string $id)
18
    {
19 2
        $this->id = $id;
20 2
        parent::__construct("No definition or class found for \"$id\".");
21 2
    }
22
23 1
    public function getId(): string
24
    {
25 1
        return $this->id;
26
    }
27
}
28