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

CommandException::invalidCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 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