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

InvalidOptionsException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forInvalidKeys() 0 4 1
A forMissingMandatoryParameter() 0 7 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