Router::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace KadokWeb\Router;
4
5
6
/**
7
 * Class KadokWeb Router
8
 *
9
 * @author Robson V. Leite <https://github.com/kadokweb>
10
 * @package KadokWeb\Router
11
 */
12
13
class Router extends Dispatch
14
{
15
    /**
16
     * Router constructor.
17
     *
18
     * @param string $projectUrl
19
     * @param null|string $separator
20
     */
21
    public function __construct(string $projectUrl, ?string $separator = ":")
22
    {
23
        parent::__construct($projectUrl, $separator);
24
    }
25
26
27
    /**
28
     * @param string $route
29
     * @param string|callable $handler
30
     */
31
    public function post(string $route, $handler): void
32
    {
33
        $this->addRoute("POST", $route, $handler);
34
    }
35
36
    /**
37
     * @param string $route
38
     * @param string|callable $handler
39
     */
40
    public function get(string $route, $handler): void
41
    {
42
        $this->addRoute("GET", $route, $handler);
43
    }
44
45
    /**
46
     * @param string $route
47
     * @param string|callable $handler
48
     */
49
    public function put(string $route, $handler): void
50
    {
51
        $this->addRoute("PUT", $route, $handler);
52
    }
53
54
    /**
55
     * @param string $route
56
     * @param string|callable $handler
57
     */
58
    public function patch(string $route, $handler): void
59
    {
60
        $this->addRoute("PATCH", $route, $handler);
61
    }
62
63
    /**
64
     * @param string $route
65
     * @param string|callable $handler
66
     */
67
    public function delete(string $route, $handler): void
68
    {
69
        $this->addRoute("DELETE", $route, $handler);
70
    }
71
}