RouteCollection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 10 1
1
<?php
2
3
namespace Albert221\Blog\Route;
4
5
use League\Route\RouteCollection as LeagueRouteCollection;
6
7
class RouteCollection extends LeagueRouteCollection
8
{
9
    /**
10
     * @param array|string $method
11
     * @param string $path
12
     * @param callable|string $handler
13
     * @return Route
14
     */
15
    public function map($method, $path, $handler)
16
    {
17
        $path = sprintf('/%s', ltrim($path, '/'));
18
19
        $route = (new Route)->setMethods((array) $method)->setPath($path)->setCallable($handler);
20
21
        $this->routes[] = $route;
22
23
        return $route;
24
    }
25
}
26