Completed
Push — master ( 05a21e...215a06 )
by Nikola
03:52
created

InvalidOptionsException::forInvalidKeys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cascader\Exception;
6
7
use InvalidArgumentException;
8
use BetterReflection\Reflection\ReflectionParameter;
9
10
class InvalidOptionsException extends InvalidArgumentException implements ExceptionInterface
11
{
12 1
    public static function forInvalidKeys()
13
    {
14 1
        return new static('Options should be in form of an associate array (string keys)');
15
    }
16
17 1
    public static function forMissingMandatoryParameter(ReflectionParameter $parameter)
18
    {
19 1
        $className = $parameter->getDeclaringClass()->getName();
20 1
        $parameterName = $parameter->getName();
21
22 1
        return new static(sprintf('Mandatory parameter: \'%2$s\' of class: %1$s is missing from options', $className, $parameterName));
23
    }
24
}
25