Swift_Mime_SimpleMessage::toByteStream PHP Method

toByteStream() public method

Write this message to a {@link Swift_InputByteStream}.
public toByteStream ( Swift_InputByteStream $is )
$is Swift_InputByteStream
    public function toByteStream(Swift_InputByteStream $is)
    {
        if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {
            $this->setChildren(array_merge(array($this->becomeMimePart()), $children));
            parent::toByteStream($is);
            $this->setChildren($children);
        } else {
            parent::toByteStream($is);
        }
    }

Usage Example

 /**
  * Write this message to a {@link Swift_InputByteStream}.
  *
  * @param Swift_InputByteStream $is
  */
 public function toByteStream(Swift_InputByteStream $is)
 {
     if (empty($this->headerSigners) && empty($this->bodySigners)) {
         parent::toByteStream($is);
         return;
     }
     $this->saveMessage();
     $this->doSign();
     parent::toByteStream($is);
     $this->restoreMessage();
 }