mpyw\Co\Co::all PHP Method

all() public static method

Normally you don't have to use this method, just yield an array that contains yieldables. You should use only with Co::race() or Co::any().
public static all ( mixed $value ) : Generator
$value mixed
return Generator Resolved value.
    public static function all($value)
    {
        (yield Co::RETURN_WITH => (yield $value));
        // @codeCoverageIgnoreStart
    }

Usage Example

Ejemplo n.º 1
0
 public function testAll()
 {
     $a = new DummyCurl('A', 3);
     $b = new DummyCurl('B', 2);
     $r = Co::wait(Co::all([$a, $b]));
     $this->assertEquals('Response[A]', $r[0]);
     $this->assertEquals('Response[B]', $r[1]);
 }