@@ 106-119 (lines=14) @@ | ||
103 | * @param string $route |
|
104 | * @return bool true if the static route map contains a mapping for the specified method & route. |
|
105 | */ |
|
106 | public function contains($method, $route) |
|
107 | { |
|
108 | if (!array_key_exists($method, $this->routes)) { |
|
109 | return false; |
|
110 | } |
|
111 | ||
112 | foreach ($this->routes[$method] as $entry) { |
|
113 | if ($entry->route == $route) { |
|
114 | return true; |
|
115 | } |
|
116 | } |
|
117 | ||
118 | return false; |
|
119 | } |
|
120 | ||
121 | /** |
|
122 | * Returns true if the router map maps one or more routes to the specified callable. |
|
@@ 148-161 (lines=14) @@ | ||
145 | * @param string $route |
|
146 | * @return callable the callable to which the specified route is mapped, or null if the router map contains no mapping for the route. |
|
147 | */ |
|
148 | public function get($method, $route) |
|
149 | { |
|
150 | if (!array_key_exists($method, $this->routes)) { |
|
151 | return null; |
|
152 | } |
|
153 | ||
154 | foreach ($this->routes[$method] as $key => $entry) { |
|
155 | if ($entry->route == $route) { |
|
156 | return $entry->callable; |
|
157 | } |
|
158 | } |
|
159 | ||
160 | return null; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Associates the specified callable with the specified method & route in the route map. |