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

UnresolvableMessageException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A message() 0 6 2
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