CommandNotRecognised::triedToHandle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CommandHandling;
4
5
use function get_class;
6
use InvalidArgumentException as InvalidArgument;
7
use function sprintf;
8
9
/**
10
 * Exception to throw when trying to handle a command that has no corresponding
11
 * command handler.
12
 */
13
final class CommandNotRecognised extends InvalidArgument
14
{
15
    public static function triedToHandle(object $command): self
16
    {
17
        return new self(sprintf(
18
            'No command handler is configured to handle the command `%s`.',
19
            get_class($command)
20
        ));
21
    }
22
}
23