Completed
Push — dev-master ( 511541...a305b0 )
by Derek Stephen
06:18
created

Router   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 22.22%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 31
ccs 2
cts 9
cp 0.2222
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\Router as LeagueRouter;
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
class Router extends LeagueRouter implements RequestHandlerInterface
11
{
12
    /**
13
     * @return Route[]
14
     */
15
    public function getRoutes(): array
16
    {
17
        return $this->routes;
18
    }
19
20
    /**
21
     * @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...
22
     */
23
    public function removeRoute(Route $routeToRemove): void
24
    {
25
        foreach ($this->routes as $index => $route) {
26
            if ($route === $routeToRemove) {
27
                unset($this->routes[$index]);
28
            }
29
        }
30
    }
31
32
    /**
33
     * @param ServerRequestInterface $request
34
     * @return ResponseInterface
35
     */
36 8
    public function handle(ServerRequestInterface $request): ResponseInterface
37
    {
38 8
        return $this->dispatch($request);
39
    }
40
}