MissingHandlerException::getCommandName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace League\Tactician\Exception;
4
5
use OutOfBoundsException;
6
7
/**
8
 * No handler could be found for the given command.
9
 */
10
class MissingHandlerException extends OutOfBoundsException implements Exception
11
{
12
    /**
13
     * @var string
14
     */
15
    private $commandName;
16
17
    /**
18
     * @param string $commandName
19
     *
20
     * @return static
21
     */
22 3
    public static function forCommand($commandName)
23
    {
24 3
        $exception = new static('Missing handler for command ' . $commandName);
25 3
        $exception->commandName = $commandName;
26
27 3
        return $exception;
28
    }
29
30
    /**
31
     * @return string
32
     */
33 1
    public function getCommandName(): string
34
    {
35 1
        return $this->commandName;
36
    }
37
}
38