From 5317b9955fac7887bbcd9fe4a002a409fe2266bb Mon Sep 17 00:00:00 2001 From: Lewis Cowles Date: Sun, 24 May 2015 12:53:50 +0100 Subject: [PATCH] PSR getting on my nerves again --- src/Fetch/Server.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Fetch/Server.php b/src/Fetch/Server.php index b59b731..06a2369 100644 --- a/src/Fetch/Server.php +++ b/src/Fetch/Server.php @@ -323,17 +323,16 @@ class Server */ public function numMessages($mailbox='') { + $cnt = 0; if ($mailbox==='') { - return imap_num_msg($this->getImapStream()); + $cnt = imap_num_msg($this->getImapStream()); + } elseif ($this->hasMailbox($mailbox) && $mailbox !== '') { + $oldMailbox = $this->getMailBox(); + $this->setMailbox($mailbox); + $cnt = $this->numMessages(); + $this->setMailbox($oldMailbox); } - if (!$this->hasMailbox($mailbox) && $mailbox !== '') { - return 0; - } - $oldMailbox = $this->getMailBox(); - $this->setMailbox($mailbox); - $cnt = $this->numMessages(); - $this->setMailbox($oldMailbox); - return $cnt; + return ((int)$cnt); } /**