Kraken\Channel\Router\Router::handle PHP Метод

handle() публичный Метод

public handle ( $name, Kraken\Channel\Protocol\ProtocolInterface $protocol, $flags, callable $success = null, callable $failure = null, callable $cancel = null, $timeout )
$protocol Kraken\Channel\Protocol\ProtocolInterface
$success callable
$failure callable
$cancel callable
    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;
    }