RouteCollectionTrait   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
eloc 8
c 0
b 0
f 0
dl 0
loc 41
ccs 14
cts 14
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A put() 0 3 1
A delete() 0 3 1
A post() 0 3 1
A head() 0 3 1
A patch() 0 3 1
A get() 0 3 1
A options() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace League\Route;
6
7
use League\Route\Http\Request;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
trait RouteCollectionTrait
11
{
12
    abstract public function map(
13
        string|array $method,
14
        string $path,
15
        callable|array|string|RequestHandlerInterface $handler
16
    ): Route;
17
18 3
    public function delete(string $path, callable|array|string|RequestHandlerInterface $handler): Route
19
    {
20 3
        return $this->map(Request::METHOD_DELETE, $path, $handler);
21
    }
22
23 30
    public function get(string $path, callable|array|string|RequestHandlerInterface $handler): Route
24
    {
25 30
        return $this->map(Request::METHOD_GET, $path, $handler);
26
    }
27
28 3
    public function head(string $path, callable|array|string|RequestHandlerInterface $handler): Route
29
    {
30 3
        return $this->map(Request::METHOD_HEAD, $path, $handler);
31
    }
32
33 3
    public function options(string $path, callable|array|string|RequestHandlerInterface $handler): Route
34
    {
35 3
        return $this->map(Request::METHOD_OPTIONS, $path, $handler);
36
    }
37
38 3
    public function patch(string $path, callable|array|string|RequestHandlerInterface $handler): Route
39
    {
40 3
        return $this->map(Request::METHOD_PATCH, $path, $handler);
41
    }
42
43 3
    public function post(string $path, callable|array|string|RequestHandlerInterface $handler): Route
44
    {
45 3
        return $this->map(Request::METHOD_POST, $path, $handler);
46
    }
47
48 3
    public function put(string $path, callable|array|string|RequestHandlerInterface $handler): Route
49
    {
50 3
        return $this->map(Request::METHOD_PUT, $path, $handler);
51
    }
52
}
53