public function handle($name, ProtocolInterface $protocol, $flags = 0, callable $success = null, callable $failure = null, callable $cancel = null, $timeout = 0.0)
{
$status = $this->flags === Router::MODE_ROUTER;
$handled = !$status;
foreach ($this->rules as $handler) {
if ($handler->match($name, $protocol) === true) {
if ($handler->handle($name, $protocol, $flags, $success, $failure, $cancel, $timeout) === false) {
return $status;
}
$handled = $status;
}
}
if ($handled === $status) {
return $handled;
}
foreach ($this->anchors as $anchor) {
if ($anchor->handle($name, $protocol, $flags, $success, $failure, $cancel, $timeout) === false) {
return $status;
}
$handled = $status;
}
return $handled;
}