private function handleMSG($line)
    {
        $parts   = explode(' ', $line);
        $subject = null;
        $length  = trim($parts[3]);
        $sid     = $parts[2];

        if (count($parts) === 5) {
            $length  = trim($parts[4]);
            $subject = $parts[3];
        } elseif (count($parts) === 4) {
            $length  = trim($parts[3]);
            $subject = $parts[1];
        }

        $payload = $this->receive($length);
        $msg     = new Message($subject, $payload, $sid, $this);

        if (isset($this->subscriptions[$sid]) === false) {
            throw Exception::forSubscriptionNotFound($sid);
        }

        $func = $this->subscriptions[$sid];
        if (is_callable($func) === true) {
            $func($msg);
        } else {
            throw Exception::forSubscriptionCallbackInvalid($sid);
        }
    }
private function handleMSG($line)
    {
        $parts   = explode(' ', $line);
        $subject = null;
        $length  = trim($parts[3]);
        $sid     = $parts[2];

        if (count($parts) === 5) {
            $length  = trim($parts[4]);
            $subject = $parts[3];
        } elseif (count($parts) === 4) {
            $length  = trim($parts[3]);
            $subject = $parts[1];
        }

        $payload = $this->receive($length);
        $msg     = new Message($subject, $payload, $sid, $this);

        if (isset($this->subscriptions[$sid]) === false) {
            throw Exception::forSubscriptionNotFound($sid);
        }

        $func = $this->subscriptions[$sid];
        if (is_callable($func) === true) {
            $func($msg);
        } else {
            throw Exception::forSubscriptionCallbackInvalid($sid);
        }
    }
private function handleMSG ( $ line ) { $ parts = explode ( ' ' , $ line ) ; $ subject = null ; $ length = trim ( $ parts [ 3 ] ) ; $ sid = $ parts [ 2 ] ; if ( count ( $ parts ) === 5 ) { $ length = trim ( $ parts [ 4 ] ) ; $ subject = $ parts [ 3 ] ; } elseif ( count ( $ parts ) === 4 ) { $ length = trim ( $ parts [ 3 ] ) ; $ subject = $ parts [ 1 ] ; } $ payload = $ this -> receive ( $ length ) ; $ msg = new Message ( $ subject , $ payload , $ sid , $ this ) ; if ( isset ( $ this -> subscriptions [ $ sid ] ) === false ) { throw Exception :: forSubscriptionNotFound ( $ sid ) ; } $ func = $ this -> subscriptions [ $ sid ] ; if ( is_callable ( $ func ) === true ) { $ func ( $ msg ) ; } else { throw Exception :: forSubscriptionCallbackInvalid ( $ sid ) ; } }
Handles MSG command.

@param string $line Message command from Nats.

@throws             Exception If subscription not found.
@return             void
@codeCoverageIgnore
Handles MSG command .