-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoute.php
49 lines (44 loc) · 1.03 KB
/
Route.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Class Route
*/
class Route {
private $callback;
private $regex;
private $method;
/**
* Route constructor.
* @param string $regex
* The regex that the route must match
* @param string $method
* The method that the route must match
* @param callable $callback
* The function return by the route
*/
public function __construct(string $regex,string $method,callable $callback) {
$this->regex = $regex;
$this->method = $method;
$this->callback = $callback;
}
/**
* @return string
* Return the regex to match
*/
public function getRegex(): string {
return $this->regex;
}
/**
* @return string
* Return the http method to regex
*/
public function getMethod(): string {
return $this->method;
}
/**
* @return callable
* Return the callback function
*/
public function getCallback(): callable {
return$this->callback;
}
}