Browse files

Made Server::getMessages() api more consistent by making it allways r…

…eturn an array.
  • Loading branch information...
1 parent 812e4eb commit fe83d77ed89004cb1ebd749c9a696664ed1b5e69 @Lumbendil Lumbendil committed Sep 18, 2012
Showing with 0 additions and 3 deletions.
  1. +0 −3 src/Fetch/Server.php
@@ -336,9 +336,6 @@ public function getMessages($limit = null)
if(isset($limit) && is_numeric($limit) && $limit < $numMessages)
$numMessages = $limit;
- if($numMessages < 1)
- return false;
$stream = $this->getImapStream();
$messages = array();
for($i = 1; $i <= $numMessages; $i++)

3 comments on commit fe83d77

Instead of removing those lines we should just return an empty array directly, rather than continuing those other calls against nothing.


Lumbendil replied Oct 8, 2012

I can do it. I just took the simpler option. It added close to no overhead, since it just got something already calculated, initializated an array, and then skipped the loop, but I'll change it to return an array.


Lumbendil replied Jul 15, 2013

@tedivm I had forgotten about this PR. I've updated the branch in order to make it mergeable.

Please sign in to comment.