MandatoryOptionNotFoundException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 6
c 1
b 0
f 1
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A missingOption() 0 9 2
1
<?php
2
/**
3
 * Sandro Keil (https://sandro-keil.de)
4
 *
5
 * @link      http://github.com/sandrokeil/interop-config for the canonical source repository
6
 * @copyright Copyright (c) 2015-2020 Sandro Keil
7
 * @license   http://github.com/sandrokeil/interop-config/blob/master/LICENSE.md New BSD License
8
 */
9
10
declare(strict_types = 1);
11
12
namespace Interop\Config\Exception;
13
14
/**
15
 * Mandatory option not found exception
16
 *
17
 * Use this exception if a mandatory option was not found in the config
18
 */
19
class MandatoryOptionNotFoundException extends OutOfBoundsException
20
{
21 7
    public static function missingOption(iterable $dimensions, $option) : self
22
    {
23 7
        $depth = '';
24
25 7
        foreach ($dimensions as $dimension) {
26 7
            $depth .= '.' . $dimension;
27
        }
28 7
        return new static(
29 7
            sprintf('Mandatory option "%s" was not set for configuration "%s"', $option, $depth)
30
        );
31
    }
32
}
33