1 | <?php |
||
9 | class CRouteBasic |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * Properties |
||
14 | * |
||
15 | */ |
||
16 | private $name; // A name for this route |
||
17 | private $rule; // The rule for this route |
||
18 | private $action; // The controller action to handle this route |
||
19 | |||
20 | |||
21 | |||
22 | /** |
||
23 | * Set values for route. |
||
24 | * |
||
25 | * @param string $rule for this route |
||
26 | * @param callable $action callable to implement a controller for the route |
||
27 | * |
||
28 | * @return $this |
||
29 | */ |
||
30 | public function set($rule, $action) |
||
37 | |||
38 | |||
39 | |||
40 | /** |
||
41 | * Check if the route matches a query |
||
42 | * |
||
43 | * @param string $query to match against |
||
44 | * |
||
45 | * @return boolean true if query matches the route |
||
46 | */ |
||
47 | public function match($query) |
||
54 | |||
55 | |||
56 | |||
57 | /** |
||
58 | * Handle the action for the route. |
||
59 | * |
||
60 | * @return void |
||
61 | */ |
||
62 | public function handle() |
||
66 | |||
67 | |||
68 | |||
69 | /** |
||
70 | * Set the name of the route. |
||
71 | * |
||
72 | * @param string $name set a name for the route |
||
73 | * |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function setName($name) |
||
81 | } |
||
82 |