Completed
Push — master ( aafa3b...fcd775 )
by Derek Stephen
02:04 queued 17s
created

Router::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Bone\Router;
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
}