Passed
Push — master ( 8e40d4...79ce76 )
by Jonathan
19:20
created

ContainerException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 3
eloc 3
dl 0
loc 20
ccs 2
cts 4
cp 0.5
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
10
final class ContainerException extends Exception implements ContainerExceptionInterface
11
{
12
    /**
13
     * @param string|null $type
14
     *
15
     * @return ContainerException
16
     */
17
    public static function findType(?string $type): ContainerException
18
    {
19
        return new self(sprintf('Unable to find type hint (%s)', ($type ?: '')));
20
    }
21
22
    /**
23
     * @param string $id
24
     *
25
     * @return ContainerException
26
     */
27 3
    public static function shareOnMake(string $id): ContainerException
28
    {
29 3
        return new self(sprintf('Entry is shared and cannot be called on make: %s', $id));
30
    }
31
}
32