1 | <?php |
||
5 | final class Route implements RouteInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var string[] |
||
9 | */ |
||
10 | private $methods; |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $pattern; |
||
16 | |||
17 | /** |
||
18 | * @var mixed |
||
19 | */ |
||
20 | private $handler; |
||
21 | |||
22 | /** |
||
23 | * @param string|string[] $method The HTTP method, or an array of, to match |
||
24 | * @param string $pattern The URI pattern |
||
25 | * @param mixed $handler The handler |
||
26 | */ |
||
27 | 33 | public function __construct($method, $pattern, $handler) |
|
38 | |||
39 | /** |
||
40 | * @param string $pattern The URI pattern |
||
41 | * @param mixed $handler The handler |
||
42 | * |
||
43 | * @return Route |
||
44 | */ |
||
45 | 3 | public static function GET($pattern, $handler) |
|
49 | |||
50 | /** |
||
51 | * @param string $pattern The URI pattern |
||
52 | * @param mixed $handler The handler |
||
53 | * |
||
54 | * @return Route |
||
55 | */ |
||
56 | 3 | public static function POST($pattern, $handler) |
|
60 | |||
61 | /** |
||
62 | * @param string $pattern The URI pattern |
||
63 | * @param mixed $handler The handler |
||
64 | * |
||
65 | * @return Route |
||
66 | */ |
||
67 | 3 | public static function PUT($pattern, $handler) |
|
71 | |||
72 | /** |
||
73 | * @param string $pattern The URI pattern |
||
74 | * @param mixed $handler The handler |
||
75 | * |
||
76 | * @return Route |
||
77 | */ |
||
78 | 3 | public static function PATCH($pattern, $handler) |
|
82 | |||
83 | /** |
||
84 | * @param string $pattern The URI pattern |
||
85 | * @param mixed $handler The handler |
||
86 | * |
||
87 | * @return Route |
||
88 | */ |
||
89 | 3 | public static function DELETE($pattern, $handler) |
|
93 | |||
94 | |||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | 30 | public function getMethods() |
|
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | 27 | public function getPattern() |
|
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 21 | public function getHandler() |
|
119 | } |
||
120 |