| @@ 58-66 (lines=9) @@ | ||
| 55 | * @param array $opts Options |
|
| 56 | * @return boolean Success. |
|
| 57 | */ |
|
| 58 | public function setRouteOptions($path, $opts) |
|
| 59 | { |
|
| 60 | $routeName = ltrim($path, '/'); |
|
| 61 | if (!isset($this->routes[$routeName])) { |
|
| 62 | Daemon::log(__METHOD__ . ': Route \'' . $path . '\' is not found.'); |
|
| 63 | return false; |
|
| 64 | } |
|
| 65 | $this->routeOptions[$routeName] = $opts; |
|
| 66 | return true; |
|
| 67 | } |
|
| 68 | ||
| 69 | ||
| @@ 91-99 (lines=9) @@ | ||
| 88 | * @callback $cb ( ) |
|
| 89 | * @return boolean Success. |
|
| 90 | */ |
|
| 91 | public function addRoute($path, $cb) |
|
| 92 | { |
|
| 93 | $routeName = ltrim($path, '/'); |
|
| 94 | if (isset($this->routes[$routeName])) { |
|
| 95 | Daemon::log(__METHOD__ . ': Route \'' . $path . '\' is already defined.'); |
|
| 96 | return false; |
|
| 97 | } |
|
| 98 | $this->routes[$routeName] = $cb; |
|
| 99 | return true; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|