Kraken\Root\Console\Server\Provider\ChannelProvider::executeProtocol PHP Method

executeProtocol() private method

private executeProtocol ( Kraken\Channel\ChannelCompositeInterface $composite, Kraken\Channel\Protocol\ProtocolInterface $protocol )
$composite Kraken\Channel\ChannelCompositeInterface
$protocol Kraken\Channel\Protocol\ProtocolInterface
    private function executeProtocol(ChannelCompositeInterface $composite, ProtocolInterface $protocol)
    {
        $params = json_decode($protocol->getMessage(), true);
        $command = array_shift($params);
        $params['origin'] = $protocol->getOrigin();
        $promise = $this->executeCommand($command, $params);
        if ($protocol->getType() === Channel::TYPE_REQ) {
            $promise->then(function ($response) use($composite, $protocol, $command) {
                return (new Response($composite, $protocol, $response))->call();
            }, function ($reason) use($composite, $protocol) {
                return (new Response($composite, $protocol, $reason))->call();
            }, function ($reason) use($composite, $protocol) {
                return (new Response($composite, $protocol, $reason))->call();
            });
        }
    }