Passed
Push — master ( 41e710...91ffae )
by Aleksei
06:19 queued 21s
created

ArgumentException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 7
dl 0
loc 26
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A getContext() 0 3 1
A getParameter() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Exception\Container;
6
7
/**
8
 * @deprecated
9
 */
10
class ArgumentException extends AutowireException
11
{
12
    /**
13
     * @param \ReflectionParameter $parameter Parameter caused error.
14
     * @param \ReflectionFunctionAbstract $context Context method or constructor or function.
15
     */
16
    public function __construct(
17
        protected \ReflectionParameter $parameter,
18
        protected \ReflectionFunctionAbstract $context,
19
    ) {
20
        $name = $context->getName();
21
        if ($context instanceof \ReflectionMethod) {
22
            $name = $context->class . '::' . $name;
23
        }
24
25
        parent::__construct(\sprintf("Unable to resolve '%s' argument in '%s'", $parameter->name, $name));
26
    }
27
28
    public function getParameter(): \ReflectionParameter
29
    {
30
        return $this->parameter;
31
    }
32
33
    public function getContext(): \ReflectionFunctionAbstract
34
    {
35
        return $this->context;
36
    }
37
}
38