src/Server/Asyn/MQTT/Message/Header/Base.php
final public function decode(& $packet_data, $remaining_length, & $payload_pos)
    {
        $cmd = Utility::ParseCommand(ord($packet_data[0]));
        $message_type = $cmd['message_type'];
        if ($this->message->getMessageType() != $message_type) {
            throw new Exception('Unexpected Control Packet Type');
        }

        $flags        = $cmd['flags'];
        $this->setFlags($flags);

        $pos = 1;
        $rl_len = strlen(($this->remaining_length_bytes = Utility::EncodeLength($remaining_length)));
        $pos += $rl_len;

        $this->remaining_length = $remaining_length;
        $this->decodeVariableHeader($packet_data, $pos);
        $payload_pos = $pos;
    }
final public function decode(& $packet_data, $remaining_length, & $payload_pos)
    {
        $cmd = Utility::ParseCommand(ord($packet_data[0]));
        $message_type = $cmd['message_type'];
        if ($this->message->getMessageType() != $message_type) {
            throw new Exception('Unexpected Control Packet Type');
        }

        $flags        = $cmd['flags'];
        $this->setFlags($flags);

        $pos = 1;
        $rl_len = strlen(($this->remaining_length_bytes = Utility::EncodeLength($remaining_length)));
        $pos += $rl_len;

        $this->remaining_length = $remaining_length;
        $this->decodeVariableHeader($packet_data, $pos);
        $payload_pos = $pos;
    }
final public function decode ( & $ packet_data , $ remaining_length , & $ payload_pos ) { $ cmd = Utility :: ParseCommand ( ord ( $ packet_data [ 0 ] ) ) ; $ message_type = $ cmd [ 'message_type' ] ; if ( $ this -> message -> getMessageType ( ) != $ message_type ) { throw new Exception ( 'Unexpected Control Packet Type' ) ; } $ flags = $ cmd [ 'flags' ] ; $ this -> setFlags ( $ flags ) ; $ pos = 1 ; $ rl_len = strlen ( ( $ this -> remaining_length_bytes = Utility :: EncodeLength ( $ remaining_length ) ) ) ; $ pos += $ rl_len ; $ this -> remaining_length = $ remaining_length ; $ this -> decodeVariableHeader ( $ packet_data , $ pos ) ; $ payload_pos = $ pos ; }
Decode Packet Header and returns payload position.

@param string & $packet_data
@param int    $remaining_length
@param int    & $payload_pos
@throws \Server\Asyn\MQTT\Exception
Decode Packet Header and returns payload position .