src/Parallel.php
static function map(\CharlotteDunois\Phoebe\Pool $pool, array $array, callable $function) {
        $promises = array();
        
        foreach($array as $id => $arg) {
            $promises[$id] = static::parallelize($pool, $function, array($arg))->then(null, function (\Throwable $e) {
                return $e;
            });
        }
        
        return \React\Promise\all($promises)->then(\Closure::fromCallable(array(self::class, 'convertResult')));
    }
static function map(\CharlotteDunois\Phoebe\Pool $pool, array $array, callable $function) {
        $promises = array();
        
        foreach($array as $id => $arg) {
            $promises[$id] = static::parallelize($pool, $function, array($arg))->then(null, function (\Throwable $e) {
                return $e;
            });
        }
        
        return \React\Promise\all($promises)->then(\Closure::fromCallable(array(self::class, 'convertResult')));
    }
Parallelizes a given function across a number of available workers, collects their return values and reconstructs the array.

Internally this method makes use of `AsyncTask`s. The pool schedules the tasks across the workers automatically.
@param \CharlotteDunois\Phoebe\Pool  $pool
@param array                         $array     Must be serializable.
@param callable                      $function
@return \React\Promise\PromiseInterface
@throws \CharlotteDunois\Phoebe\MultiReasonException  The exception the promise gets rejected with.