InvalidMiddlewareException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A forMiddleware() 0 9 2
1
<?php
2
3
namespace League\Tactician\Exception;
4
5
/**
6
 * Thrown when the CommandBus was instantiated with an invalid middleware object
7
 */
8
class InvalidMiddlewareException extends \InvalidArgumentException implements Exception
9
{
10 1
    public static function forMiddleware($middleware)
11
    {
12 1
        $name = is_object($middleware) ? get_class($middleware) : gettype($middleware);
13 1
        $message = sprintf(
14 1
            'Cannot add "%s" to middleware chain as it does not implement the Middleware interface.',
15 1
            $name
16
        );
17 1
        return new static($message);
18
    }
19
}
20