ServiceNotRegisteredException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
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 3
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
/*
4
 *  This file is part of the Micro framework package.
5
 *
6
 *  (c) Stanislau Komar <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace Micro\Component\DependencyInjection\Exception;
13
14
use Psr\Container\NotFoundExceptionInterface;
15
16
class ServiceNotRegisteredException extends \RuntimeException implements NotFoundExceptionInterface
17
{
18
    private string $serviceId;
19
20 2
    public function __construct(string $serviceId, int $code = 0, \Throwable $previous = null)
21
    {
22 2
        $this->serviceId = $serviceId;
23
24 2
        parent::__construct(sprintf('Service "%s" not registered.', $this->serviceId), $code, $previous);
25
    }
26
27 1
    public function getServiceId(): string
28
    {
29 1
        return $this->serviceId;
30
    }
31
}
32