InvalidDefinitionException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 5
cts 5
cp 1
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
/**
4
 * This file is part of the Container package.
5
 *
6
 * Copyright (c) Miloš Đurić <[email protected]>
7
 *
8
 * For full copyright and license information, please refer to the LICENSE file,
9
 * located at the package root folder.
10
 */
11
12
namespace Laganica\Di\Exception;
13
14
use Closure;
15
use Laganica\Di\Definition\DefinitionInterface;
16
17
/**
18
 * Class InvalidDefinitionException
19
 *
20
 * @package Laganica\Di\Exception
21
 */
22
class InvalidDefinitionException extends ContainerException
23
{
24
    /**
25
     * @param $definition
26
     *
27
     * @return self
28
     */
29 1
    public static function create($definition): self
30
    {
31 1
        return new self(vsprintf('Argument $definition must be either %s, %s or %s, %s given', [
32 1
            DefinitionInterface::class,
33
            Closure::class,
34 1
            'string',
35 1
            is_object($definition) ? get_class($definition) : gettype($definition)
36
        ]));
37
    }
38
}
39