Test Failed
Pull Request — master (#2)
by ARP
14:31 queued 25s
created

AbstractMiddlewareTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDelegate() 0 17 1
A hp$0 ➔ handle() 0 4 1
1
<?php
2
3
4
namespace TheCodingMachine\Middlewares;
5
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
use Zend\Diactoros\Response\TextResponse;
10
11
abstract class AbstractMiddlewareTest extends TestCase
12
{
13
    protected function getDelegate() : RequestHandlerInterface
14
    {
15
        return new class implements RequestHandlerInterface {
16
17
            /**
18
             * Dispatch the next available middleware and return the response.
19
             *
20
             * @param ServerRequestInterface $request
21
             *
22
             * @return ResponseInterface
23
             */
24
            public function handle(ServerRequestInterface $request):ResponseInterface
25
            {
26
                return new TextResponse('foobar');
27
            }
28
        };
29
    }
30
}
31