AbstractMiddlewareTest::getDelegate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0

1 Method

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