Changeset View
Changeset View
Standalone View
Standalone View
src/future/FutureIterator.php
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | /* -( Basics )------------------------------------------------------------- */ | ||||
| * Create a new iterator over a list of futures. | * Create a new iterator over a list of futures. | ||||
| * | * | ||||
| * @param list List of @{class:Future}s to resolve. | * @param list List of @{class:Future}s to resolve. | ||||
| * @task basics | * @task basics | ||||
| */ | */ | ||||
| public function __construct(array $futures) { | public function __construct(array $futures) { | ||||
| assert_instances_of($futures, 'Future'); | assert_instances_of($futures, 'Future'); | ||||
| $respect_keys = !phutil_is_natural_list($futures); | |||||
| foreach ($futures as $map_key => $future) { | foreach ($futures as $map_key => $future) { | ||||
| if ($respect_keys) { | |||||
| $future->setFutureKey($map_key); | $future->setFutureKey($map_key); | ||||
| } | |||||
| $this->addFuture($future); | $this->addFuture($future); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Block until all futures resolve. | * Block until all futures resolve. | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 394 Lines • Show Last 20 Lines | |||||