Passed
Push — master ( 1a2aa4...b3c82e )
by Alexander
04:24 queued 02:19
created

NotFoundException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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
    private string $id;
16
17
    /**
18
     * @param string $id ID of the definition or name of the class that was not found.
19
     */
20 5
    public function __construct(string $id)
21
    {
22 5
        $this->id = $id;
23 5
        parent::__construct(sprintf('No definition or class found or resolvable for %s.', $id));
24 5
    }
25
26 1
    public function getId(): string
27
    {
28 1
        return $this->id;
29
    }
30
}
31