Completed
Push — master ( 81b7a1...80c875 )
by Derek Stephen
01:34
created

Router   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 31
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoutes() 0 4 1
A removeRoute() 0 8 3
A handle() 0 4 1
1
<?php
2
3
namespace Bone\Mvc;
4
5
use League\Route\Route;
6
use League\Route\Router as LeagueRouter;
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Psr\Http\Server\RequestHandlerInterface;
10
11
class Router extends LeagueRouter implements RequestHandlerInterface
12
{
13
    /**
14
     * @return Route[]
15
     */
16
    public function getRoutes(): array
17
    {
18
        return $this->routes;
19
    }
20
21
    /**
22
     * @param Route $route
0 ignored issues
show
Bug introduced by
There is no parameter named $route. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
23
     */
24
    public function removeRoute(Route $routeToRemove): void
25
    {
26
        foreach ($this->routes as $index => $route) {
27
            if ($route === $routeToRemove) {
28
                unset($this->routes[$index]);
29
            }
30
        }
31
    }
32
33
    /**
34
     * @param ServerRequestInterface $request
35
     * @return ResponseInterface
36
     */
37
    public function handle(ServerRequestInterface $request): ResponseInterface
38
    {
39
        return $this->dispatch($request);
40
    }
41
}