Swift_Mime_SimpleMimeEntity::bodyToString PHP Method

bodyToString() protected method

Get this entire entity as a string.
protected bodyToString ( ) : string
return string
    protected function bodyToString()
    {
        $string = '';
        if (isset($this->body) && empty($this->immediateChildren)) {
            if ($this->cache->hasKey($this->cacheKey, 'body')) {
                $body = $this->cache->getString($this->cacheKey, 'body');
            } else {
                $body = "\r\n" . $this->encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength());
                $this->cache->setString($this->cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE);
            }
            $string .= $body;
        }
        if (!empty($this->immediateChildren)) {
            foreach ($this->immediateChildren as $child) {
                $string .= "\r\n\r\n--" . $this->getBoundary() . "\r\n";
                $string .= $child->toString();
            }
            $string .= "\r\n\r\n--" . $this->getBoundary() . "--\r\n";
        }
        return $string;
    }