DispatchRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 37
ccs 7
cts 7
cp 1
rs 10
c 3
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A __invoke() 0 6 1
1
<?php
2
3
namespace Mosaic\Http\Middleware;
4
5
use Mosaic\Http\Adapters\Psr7\Response;
6
use Mosaic\Http\ResponseFactory;
7
use Mosaic\Routing\RouteDispatcher;
8
use Psr\Http\Message\RequestInterface;
9
use Psr\Http\Message\ResponseInterface;
10
11
class DispatchRequest
12
{
13
    /**
14
     * @var ResponseFactory
15
     */
16
    private $factory;
17
18
    /**
19
     * @var RouteDispatcher
20
     */
21
    private $dispatcher;
22
23
    /**
24
     * @param RouteDispatcher $dispatcher
25
     * @param ResponseFactory $factory
26
     */
27 1
    public function __construct(
28
        RouteDispatcher $dispatcher,
29
        ResponseFactory $factory
30
    ) {
31 1
        $this->factory    = $factory;
32 1
        $this->dispatcher = $dispatcher;
33 1
    }
34
35
    /**
36
     * @param  RequestInterface  $request
37
     * @param  ResponseInterface $response
38
     * @param  callable          $next
39
     * @return Response
40
     */
41 1
    public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next = null)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $next is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43 1
        return $this->factory->make(
44 1
            $this->dispatcher->dispatch($request)
45
        );
46
    }
47
}
48