RouteCollectionTrait::options()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 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