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

ArgumentException::getParameter()   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 2
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 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