InvalidCommandException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
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 30
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInvalidCommand() 0 4 1
A forUnknownValue() 0 9 1
1
<?php
2
3
namespace League\Tactician\Exception;
4
5
/**
6
 * Thrown when the command bus is given an non-object to use as a command.
7
 */
8
class InvalidCommandException extends \RuntimeException implements Exception
9
{
10
    /**
11
     * @var mixed
12
     */
13
    private $invalidCommand;
14
15
    /**
16
     * @param mixed $invalidCommand
17
     *
18
     * @return static
19
     */
20 2
    public static function forUnknownValue($invalidCommand)
21
    {
22 2
        $exception = new static(
23 2
            'Commands must be an object but the value given was of type: ' . gettype($invalidCommand)
24
        );
25 2
        $exception->invalidCommand = $invalidCommand;
26
27 2
        return $exception;
28
    }
29
30
    /**
31
     * @return mixed
32
     */
33 1
    public function getInvalidCommand()
34
    {
35 1
        return $this->invalidCommand;
36
    }
37
}
38