Пример #1
0
 /**
  * Access headers collection
  *
  * Lazy-loads if not already attached.
  *
  * @return Headers
  */
 public function getHeaders()
 {
     if (null === $this->headers) {
         if ($this->mail) {
             $part = $this->mail->getRawHeader($this->messageNum);
             $this->headers = Headers::fromString($part);
         } else {
             $this->headers = new Headers();
         }
     }
     return $this->headers;
 }
Пример #2
0
 /**
  * Special handling for hasTop and hasUniqueid. The headers of the first message is
  * retrieved if Top wasn't needed/tried yet.
  *
  * @see AbstractStorage::__get()
  * @param  string $var
  * @return string
  */
 public function __get($var)
 {
     $result = parent::__get($var);
     if ($result !== null) {
         return $result;
     }
     if (strtolower($var) == 'hastop') {
         if ($this->protocol->hasTop === null) {
             // need to make a real call, because not all server are honest in their capas
             try {
                 $this->protocol->top(1, 0, false);
             } catch (MailException\ExceptionInterface $e) {
                 // ignoring error
             }
         }
         $this->has['top'] = $this->protocol->hasTop;
         return $this->protocol->hasTop;
     }
     if (strtolower($var) == 'hasuniqueid') {
         $id = null;
         try {
             $id = $this->protocol->uniqueid(1);
         } catch (MailException\ExceptionInterface $e) {
             // ignoring error
         }
         $this->has['uniqueid'] = $id ? true : false;
         return $this->has['uniqueid'];
     }
     return $result;
 }