LeagueRoute   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
1
<?php
2
3
namespace Psr7Middlewares\Middleware;
4
5
use League\Route\RouteCollection;
6
use Psr\Http\Message\ServerRequestInterface;
7
use Psr\Http\Message\ResponseInterface;
8
9
class LeagueRoute
10
{
11
    /**
12
     * @var RouteCollection The router container
13
     */
14
    private $router;
15
16
    /**
17
     * Set the RouteCollection instance.
18
     *
19
     * @param RouteCollection $router
20
     */
21
    public function __construct(RouteCollection $router)
22
    {
23
        $this->router = $router;
24
    }
25
26
    /**
27
     * Execute the middleware.
28
     *
29
     * @param ServerRequestInterface $request
30
     * @param ResponseInterface      $response
31
     * @param callable               $next
32
     *
33
     * @return ResponseInterface
34
     */
35
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
36
    {
37
        return $next($request, $this->router->dispatch($request, $response));
38
    }
39
}
40