InvalidConfigException::invalidOptionValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 10
rs 10
1
<?php
2
3
/**
4
 * Static Analysis Results Baseliner (sarb).
5
 *
6
 * (c) Dave Liddament
7
 *
8
 * For the full copyright and licence information please view the LICENSE file distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace DaveLiddament\StaticAnalysisResultsBaseliner\Framework\Command\internal;
14
15
/**
16
 * Used for invalid user config provided.
17
 */
18
final class InvalidConfigException extends \Exception
19
{
20
    /**
21
     * @param string[] $validOptions
22
     */
23
    public static function invalidOptionValue(string $option, string $value, array $validOptions): self
24
    {
25
        $message = sprintf(
26
            'Invalid value [%s] for option [%s]. Pick one of: %s',
27
            $value,
28
            $option,
29
            implode('|', $validOptions),
30
        );
31
32
        return new self($message);
33
    }
34
}
35