Passed
Push — master ( 3ad7fe...719238 )
by Alexander
01:23
created

ArgumentException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Injector;
6
7
abstract class ArgumentException extends \InvalidArgumentException
8
{
9
    protected const EXCEPTION_MESSAGE = 'Something is wrong with argument "%s" when calling "%s".';
10
11 9
    public function __construct(\ReflectionFunctionAbstract $reflection, string $parameter)
12
    {
13 9
        $function = $reflection->getName();
14 9
        $class = $reflection->class ?? null;
15 9
        $method = $class !== null ? "{$class}::{$function}" : $function;
16
17 9
        parent::__construct(sprintf(static::EXCEPTION_MESSAGE, $parameter, $method));
18
    }
19
}
20