Kraken\Channel\Protocol\ProtocolInterface::setType PHP Method

setType() public method

This method sets type only if it was not set already. To force replacement $reassing flag needs to be set to true.
public setType ( string $type, boolean $reassign = false ) : Kraken\Channel\Protocol\ProtocolInterface
$type string
$reassign boolean
return Kraken\Channel\Protocol\ProtocolInterface
    public function setType($type, $reassign = false);

Usage Example

 /**
  * @param string $name
  * @param ProtocolInterface $message
  * @param int $flags
  * @return bool
  */
 protected function handleSendAsync($name, $message, $flags = Channel::MODE_DEFAULT)
 {
     if ($message->getType() === '') {
         $message->setType(Channel::TYPE_SND);
     }
     if ($message->getDestination() === '') {
         $message->setDestination($name);
     }
     return $this->getOutput()->handle($name, $message, $flags);
 }