/** * Return literal length data located at the end of the stream. * * @return mixed Null if no literal data found, or an array with these * keys: * - binary: (boolean) True if this is a literal8. * - length: (integer) Length of the literal. */ public function getLiteralLength() { if ($this->_stream->substring(-1, 1) === '}') { $literal_data = $this->_stream->getString($this->_stream->search('{', true) - 1); $literal_len = substr($literal_data, 2, -1); if (is_numeric($literal_len)) { return array('binary' => $literal_data[0] === '~', 'length' => intval($literal_len)); } } return null; }
/** * Find the location of the end of the header text. * * @return array 1st element: Header position, 2nd element: Length of * trailing EOL. */ protected function _findHeader() { // Look for the EOL that is found first in the message. Some clients // are sending mixed EOL in S/MIME signed messages. This still doesn't // fix "Nine" currently, as they first send \r\n, but use \n\n to // separate the headers. // See: https://ninefolders.plan.io/track/10606/1dcfed switch ($this->_stream->getEOL()) { case "\n": return array($this->_stream->search("\n\n"), 2); case "\r\n": return array($this->_stream->search("\r\n\r\n"), 4); } }