Completed
Pull Request — master (#9)
by Adam
05:57
created

CommandException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidCommand() 0 7 1
A notFound() 0 7 1
1
<?php
2
3
namespace Equip\Queue\Exception;
4
5
use Exception;
6
7
class CommandException extends Exception
8
{
9
    const INVALID = 1000;
10
    const NOT_FOUND = 2000;
11
    /**
12
     * @param string $name
13
     *
14
     * @return static
15
     */
16 2
    public static function invalidCommand($name)
17
    {
18 2
        return new static(
19 2
            sprintf('The command for `%s` is invalid.', $name),
20
            static::INVALID
21 2
        );
22
    }
23
24
    /**
25
     * @param string $name
26
     *
27
     * @return static
28
     */
29 2
    public static function notFound($name)
30
    {
31 2
        return new static(
32 2
            sprintf('`%s` command not found.', $name),
33
            static::NOT_FOUND
34 2
        );
35
    }
36
}
37