Passed
Push — master ( 1d8942...b5d582 )
by Jonathan
03:58
created

ContainerException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 3
dl 0
loc 20
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shareOnMake() 0 3 1
A findType() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gravatalonga\Container;
6
7
use Exception;
8
use Psr\Container\ContainerExceptionInterface;
9
use ReflectionNamedType;
10
11
final class ContainerException extends Exception implements ContainerExceptionInterface
12
{
13
    /**
14
     * @param ReflectionNamedType|null $type
15
     *
16
     * @return ContainerException
17
     */
18 6
    public static function findType(?ReflectionNamedType $type): ContainerException
19
    {
20 6
        return new self(sprintf('Unable to find type hint (%s)', ($type ? $type->getName() : '')));
21
    }
22
23
    /**
24
     * @param string $id
25
     *
26
     * @return ContainerException
27
     */
28 3
    public static function shareOnMake(string $id): ContainerException
29
    {
30 3
        return new self(sprintf('Entry is shared and cannot be called on make: %s', $id));
31
    }
32
}
33