/** * 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; }
/** * Get all headers * * The returned headers are as saved internally. All names are lowercased. The value is a string or an array * if a header with the same name occurs more than once. * * @return array headers as array(name => value) */ public function getHeaders() { if ($this->_headers === null) { if (!$this->_mail) { $this->_headers = array(); } else { $part = $this->_mail->getRawHeader($this->_messageNum); $body = null; // "Declare" variable since it's passed by reference Mime\Decode::splitMessage($part, $this->_headers, $body); } } return $this->_headers; }