Completed
Push — master ( fab006...1c4cac )
by Miloš
01:47
created

InvalidDefinitionException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 2
1
<?php
2
3
namespace Laganica\Di\Exception;
4
5
use Closure;
6
use Laganica\Di\Definition\DefinitionInterface;
7
use Psr\Container\NotFoundExceptionInterface;
8
9
/**
10
 * Class InvalidDefinitionException
11
 *
12
 * @package Laganica\Di\Exception
13
 */
14
class InvalidDefinitionException extends ContainerException implements NotFoundExceptionInterface
15
{
16
    /**
17
     * @param $definition
18
     *
19
     * @return self
20
     */
21
    public static function create($definition): self
22
    {
23
        return new self(vsprintf('Argument $definition must be either %s, %s or %s, %s given', [
24
            DefinitionInterface::class,
25
            Closure::class,
26
            'string',
27
            get_class($definition) ?: gettype($definition)
28
        ]));
29
    }
30
}
31