Updated class names to reflect new namespacing, and removed custom exceptions for built in ones.

This commit is contained in:
Robert Hafner 2012-06-10 18:38:48 -07:00
parent 1e8059d5bd
commit e78fe27527
3 changed files with 11 additions and 11 deletions

View File

@ -81,7 +81,7 @@ class Attachment
* @param stdClass $structure
* @param string $partIdentifier
*/
public function __construct(ImapMessage $message, $structure, $partIdentifier = null)
public function __construct(Message $message, $structure, $partIdentifier = null)
{
$this->messageId = $message->getUid();
$this->imapStream = $message->getImapBox()->getImapStream();
@ -90,7 +90,7 @@ class Attachment
if(isset($partIdentifier))
$this->partId = $partIdentifier;
$parameters = ImapMessage::getParametersFromStructure($structure);
$parameters = Message::getParametersFromStructure($structure);
if(isset($parameters['filename']))
{
@ -101,7 +101,7 @@ class Attachment
$this->size = $structure->bytes;
$this->mimeType = ImapMessage::typeIdToString($structure->type);
$this->mimeType = Message::typeIdToString($structure->type);
if(isset($structure->subtype))
$this->mimeType .= '/' . strtolower($structure->subtype);
@ -123,7 +123,7 @@ class Attachment
imap_fetchbody($this->imapStream, $this->messageId, $this->partId, FT_UID)
: imap_body($this->imapStream, $this->messageId, FT_UID);
$messageBody = ImapMessage::decode($messageBody, $this->encoding);
$messageBody = Message::decode($messageBody, $this->encoding);
$this->data = $messageBody;
}
return $this->data;

View File

@ -156,7 +156,7 @@ class ImapMessage
* @param int $messageUniqueId
* @param Imap $mailbox
*/
public function __construct($messageUniqueId, Imap $mailbox)
public function __construct($messageUniqueId, Server $mailbox)
{
$this->imapConnection = $mailbox;
$this->uid = $messageUniqueId;
@ -402,7 +402,7 @@ class ImapMessage
if(isset($parameters['name']) || isset($parameters['filename']))
{
$attachment = new ImapAttachment($this, $structure, $partIdentifier);
$attachment = new Attachment($this, $structure, $partIdentifier);
$this->attachments[] = $attachment;
}elseif($structure->type == 0 || $structure->type == 1){
@ -624,7 +624,7 @@ class ImapMessage
public function setFlag($flag, $enable = true)
{
if(!in_array($flag, self::$flagTypes) || $flag == 'recent')
throw new ImapException('Unable to set invalid flag "' . $flag . '"');
throw new \InvalidArgumentException('Unable to set invalid flag "' . $flag . '"');
$flag = '\\' . ucfirst($flag);

View File

@ -261,12 +261,12 @@ class Imap
if(isset($this->imapStream))
{
if(!imap_reopen($this->imapStream, $this->mailbox, $this->options, 1))
throw new ImapException(imap_last_error());
throw new \RuntimeException(imap_last_error());
}else{
$imapStream = imap_open($this->getServerString(), $this->username, $this->password, $this->options, 1);
if($imapStream === false)
throw new ImapException(imap_last_error());
throw new \RuntimeException(imap_last_error());
$this->imapStream = $imapStream;
}
@ -304,7 +304,7 @@ class Imap
$messages = array();
foreach($results as $messageId)
$messages[] = new ImapMessage($messageId, $this);
$messages[] = new Message($messageId, $this);
return $messages;
}else{
@ -344,7 +344,7 @@ class Imap
for($i = 1; $i <= $numMessages; $i++)
{
$uid = imap_uid($stream, $i);
$messages[] = new ImapMessage($uid, $this);
$messages[] = new Message($uid, $this);
}
return $messages;