Completed
Push — master ( 3c559e...05a21e )
by Nikola
02:55
created

InvalidOptionsException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 16
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forInvalidKeys() 0 4 1
A forMissingMandatoryParameter() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cascader\Exception;
6
7
use InvalidArgumentException;
8
9
class InvalidOptionsException extends InvalidArgumentException implements ExceptionInterface
10
{
11 1
    public static function forInvalidKeys()
12
    {
13 1
        return new static('Options should be in form of an associate array (string keys)');
14
    }
15
16 1
    public static function forMissingMandatoryParameter(string $className, string $parameterName)
17
    {
18 1
        return new static(sprintf(
19 1
            'Mandatory parameter: \'%2$s\' of class: %1$s is missing from options',
20
            $className,
21 1
            $parameterName
22
        ));
23
    }
24
}
25