Completed
Push — master ( 12b419...48a936 )
by Alejandro
25s queued 18s
created

InvalidHttpMiddlewareException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromMiddleware() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Common\Http\Exception;
6
7
use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
8
9
use function get_class;
10
use function getType;
11
use function is_object;
12
use function sprintf;
13
14
class InvalidHttpMiddlewareException extends InvalidArgumentException
15
{
16
    /**
17
     * @param mixed $middleware
18
     */
19 11
    public static function fromMiddleware($middleware): self
20
    {
21 11
        return new self(sprintf(
22 11
            'Provided middleware does not have a valid type. Expected callable, %s provided',
23 11
            is_object($middleware) ? get_class($middleware) : getType($middleware),
24
        ));
25
    }
26
}
27