missingMandatoryParameter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

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