Completed
Push — master ( d3629a...99177e )
by Dusan
02:35
created

forMiddleware()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of the http-middleware package.
4
 *
5
 * Copyright (c) Dusan Vejin
6
 *
7
 * For full copyright and license information, please refer to the LICENSE file,
8
 * located at the package root folder.
9
 */
10
11
declare(strict_types=1);
12
13
namespace WeCodeIn\Http\Server\Exception;
14
15
use Interop\Http\Server\MiddlewareInterface;
16
use Psr\Http\Message\ResponseInterface;
17
18
class InvalidMiddlewareResponseException extends OutOfBoundsException
19
{
20 1
    public static function forMiddleware(MiddlewareInterface $middleware) : self
21
    {
22 1
        return new self(sprintf(
23 1
            'Middleware %s did not return a %s',
24 1
            get_class($middleware),
25 1
            ResponseInterface::class
26
        ));
27
    }
28
}
29