public function dispatch($request)
{
foreach ($this->rules as $rule) {
//JAXLLogger::debug("matching $request->path with pattern $rule->pattern");
if (($matches = $rule->match($request->path, $request->method)) !== false) {
JAXLLogger::debug("matching rule found, dispatching");
$params = array($request);
// TODO: a bad way to restrict on 'pk', fix me for generalization
if (isset($matches['pk'])) {
$params[] = $matches['pk'];
}
call_user_func_array($rule->cb, $params);
return true;
}
}
return false;
}