1 | <?php declare(strict_types=1); |
||
5 | trait RouteCollectionTrait |
||
6 | { |
||
7 | /** |
||
8 | * Add a route to the map. |
||
9 | * |
||
10 | * @param string $method |
||
11 | * @param string $path |
||
12 | * @param callable|string $handler |
||
13 | * |
||
14 | * @return \League\Route\Route |
||
15 | */ |
||
16 | abstract public function map(string $method, string $path, $handler); |
||
17 | |||
18 | /** |
||
19 | * Add a route that responds to GET HTTP method. |
||
20 | * |
||
21 | * @param string $path |
||
22 | * @param callable|string $handler |
||
23 | * |
||
24 | * @return \League\Route\Route |
||
25 | */ |
||
26 | 14 | public function get($path, $handler) |
|
30 | |||
31 | /** |
||
32 | * Add a route that responds to POST HTTP method. |
||
33 | * |
||
34 | * @param string $path |
||
35 | * @param callable|string $handler |
||
36 | * |
||
37 | * @return \League\Route\Route |
||
38 | */ |
||
39 | 2 | public function post($path, $handler) |
|
43 | |||
44 | /** |
||
45 | * Add a route that responds to PUT HTTP method. |
||
46 | * |
||
47 | * @param string $path |
||
48 | * @param callable|string $handler |
||
49 | * |
||
50 | * @return \League\Route\Route |
||
51 | */ |
||
52 | 2 | public function put($path, $handler) |
|
56 | |||
57 | /** |
||
58 | * Add a route that responds to PATCH HTTP method. |
||
59 | * |
||
60 | * @param string $path |
||
61 | * @param callable|string $handler |
||
62 | * |
||
63 | * @return \League\Route\Route |
||
64 | */ |
||
65 | 2 | public function patch($path, $handler) |
|
69 | |||
70 | /** |
||
71 | * Add a route that responds to DELETE HTTP method. |
||
72 | * |
||
73 | * @param string $path |
||
74 | * @param callable|string $handler |
||
75 | * |
||
76 | * @return \League\Route\Route |
||
77 | */ |
||
78 | 2 | public function delete($path, $handler) |
|
82 | |||
83 | /** |
||
84 | * Add a route that responds to HEAD HTTP method. |
||
85 | * |
||
86 | * @param string $path |
||
87 | * @param callable|string $handler |
||
88 | * |
||
89 | * @return \League\Route\Route |
||
90 | */ |
||
91 | 2 | public function head($path, $handler) |
|
95 | |||
96 | /** |
||
97 | * Add a route that responds to OPTIONS HTTP method. |
||
98 | * |
||
99 | * @param string $path |
||
100 | * @param callable|string $handler |
||
101 | * |
||
102 | * @return \League\Route\Route |
||
103 | */ |
||
104 | 2 | public function options($path, $handler) |
|
108 | } |
||
109 |