Completed
Pull Request — master (#5)
by Woody
03:25 queued 01:27
created

CommandException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 34
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A missingOption() 0 7 1
A missingOptions() 0 7 1
1
<?php
2
3
namespace Equip\Command;
4
5
use RuntimeException;
6
7
class CommandException extends RuntimeException
8
{
9
    const MISSING_OPTION = 500;
10
11
    /**
12
     * @param string $name
13
     *
14
     * @return static
15
     *
16
     * @deprecated 1.2.0
17
     */
18
    public static function missingOption($name)
19
    {
20
        return new static(
21
            sprintf('Required option `%s` is not defined', $name),
22
            static::MISSING_OPTION
23
        );
24
    }
25
26
    /**
27
     * @param array $names
28
     *
29
     * @return static
30
     *
31
     * @since 1.2.0
32
     */
33 1
    public static function missingOptions(array $names)
34
    {
35 1
        return new static(
36 1
            sprintf('Required options not defined: `%s`', implode('`, `', $names)),
37
            static::MISSING_OPTION
38 1
        );
39
    }
40
}
41