Passed
Push — master ( 898f07...643d29 )
by Jonathan
13:05
created

ContainerException::circularDependency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
     * @return ContainerException
14
     */
15
    public static function circularDependency(): ContainerException
16
    {
17
        return new self('Detect Circular Dependency');
18
    }
19
20
    /**
21
     * @param string|null $type
22
     *
23
     * @return ContainerException
24
     */
25
    public static function findType(?string $type): ContainerException
26
    {
27 3
        return new self(sprintf('Unable to find type hint (%s)', ($type ?: '')));
28
    }
29 3
30
    /**
31
     * @param string $id
32
     *
33
     * @return ContainerException
34
     */
35
    public static function shareOnMake(string $id): ContainerException
36
    {
37
        return new self(sprintf('Entry is shared and cannot be called on make: %s', $id));
38
    }
39
}
40