ServiceNotRegisteredException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getServiceId() 0 3 1
A __construct() 0 5 1
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