UnresolvableParameterException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createForFunction() 0 15 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Habemus\Exception;
5
6
use ReflectionFunctionAbstract;
7
use ReflectionMethod;
8
9
class UnresolvableParameterException extends ContainerException
10
{
11
    public static function createForFunction(ReflectionFunctionAbstract $function, string $parameter) : self
12
    {
13
        if ($function instanceof ReflectionMethod) {
14
            return new self(
15
                sprintf(
16
                    "Container cannot resolve parameter (%s) in (%s::%s)",
17
                    $parameter,
18
                    $function->getDeclaringClass(),
19
                    $function->getName()
20
                )
21
            );
22
        }
23
24
        return new self(
25
            sprintf("Container cannot resolve parameter (%s)", $parameter)
26
        );
27
    }
28
}
29