Skip to content

Commit

Permalink
Added a recursive option to all() function.
Browse files Browse the repository at this point in the history
Fixes guzzle#46
  • Loading branch information
bpolaszek committed Oct 26, 2017
1 parent e9cdab6 commit c427866
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,15 @@ function ($reason, $idx, Promise $aggregate) {
)->then(function () use (&$results) {
ksort($results);
return $results;
})->then(function ($results) use ($recursive, &$promises) {
if (true === $recursive && !$promises instanceof \Generator) {
foreach ($promises AS $promise) {
if (\GuzzleHttp\Promise\PromiseInterface::PENDING === $promise->getState()) {
return all($promises, $recursive);
}
}
}
return $results;
});

if (true === $recursive) {
Expand Down

0 comments on commit c427866

Please # to comment.