MissingHandlerException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 28
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forCommand() 0 7 1
A getCommandName() 0 4 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