Passed
Push — main ( e63ffd...a2ac52 )
by Breno
01:44
created

UnresolvableMessageException::message()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace OniBus\Exception;
5
6
use RuntimeException;
7
use OniBus\Message;
8
use OniBus\NamedMessage;
9
10
class UnresolvableMessageException extends RuntimeException
11
{
12
    public static function message(Message $message): self
13
    {
14
        return new self(
15
            sprintf(
16
                "Cannot resolve handler for message (%s)",
17
                $message instanceof NamedMessage ? $message->getMessageName() : get_class($message)
18
            )
19
        );
20
    }
21
}
22