Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Modify the Server::getMessages() API #5

Closed
wants to merge 2 commits into from

2 participants

@Lumbendil

Modified the Server::getMessages() API to make it always return an array, instead of returning false when there are no messages.

@tedivm
Owner

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

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.

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

@Lumbendil Lumbendil Update Server.php
Added a check to avoid un-necessary calls.
de664df
@tedivm
Owner

I'm closing this out, as the functionality got pulled in through another PR. Thank you for the contribution though, it's always appreciated!

@tedivm tedivm closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 18, 2012
  1. @Lumbendil
Commits on Jul 15, 2013
  1. @Lumbendil

    Update Server.php

    Lumbendil authored
    Added a check to avoid un-necessary calls.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/Fetch/Server.php
View
4 src/Fetch/Server.php
@@ -336,8 +336,8 @@ public function getMessages($limit = null)
if(isset($limit) && is_numeric($limit) && $limit < $numMessages)
$numMessages = $limit;
- if($numMessages < 1)
- return false;
+ if ($numMessages < 1)
+ return array();
$stream = $this->getImapStream();
$messages = array();
Something went wrong with that request. Please try again.