Exemple #1
0
 public function getRawContent($id, $part = null)
 {
     if ($part !== null) {
         // TODO: implement
         throw new Exception\RuntimeException('not implemented');
     }
     $content = $this->protocol->retrieve($id);
     // TODO: find a way to avoid decoding the headers
     $headers = null;
     // "Declare" variable since it's passed by reference
     $body = null;
     // "Declare" variable before first usage.
     Mime\Decode::splitMessage($content, $headers, $body);
     return $body;
 }
Exemple #2
0
 /**
  * Instantiate from raw message string
  *
  * @todo   Restore body to Mime\Message
  * @param  string $rawMessage
  * @return Message
  */
 public static function fromString($rawMessage)
 {
     $message = new static();
     $headers = null;
     $content = null;
     Mime\Decode::splitMessage($rawMessage, $headers, $content);
     if ($headers->has('mime-version')) {
         // todo - restore body to mime\message
     }
     $message->setHeaders($headers);
     $message->setBody($content);
     return $message;
 }
Exemple #3
0
 /**
  * Get a specific field from a header like content type or all fields as array
  *
  * If the header occurs more than once, only the value from the first header
  * is returned.
  *
  * Throws an Exception if the requested header does not exist. If
  * the specific header field does not exist, returns null.
  *
  * @param  string $name       name of header, like in getHeader()
  * @param  string $wantedPart the wanted part, default is first, if null an array with all parts is returned
  * @param  string $firstName  key name for the first part
  * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
  * @throws \Zend\Mime\Exception\RuntimeException
  */
 public function getHeaderField($name, $wantedPart = '0', $firstName = '0')
 {
     return Mime\Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName);
 }