Interop\Async\Loop::get PHP Method

get() public static method

Retrieve the event loop driver that is in scope.
public static get ( ) : Driver
return Interop\Async\Loop\Driver
    public static function get()
    {
        if (self::$driver) {
            return self::$driver;
        }
        return self::$driver = self::createDriver();
    }

Usage Example

Beispiel #1
0
 /** @test */
 public function executeStackReturnsScopedDriver()
 {
     $driver1 = new DummyDriver();
     $driver2 = new DummyDriver();
     Loop::execute(function () use($driver1, $driver2) {
         $this->assertSame($driver1, Loop::get());
         Loop::execute(function () use($driver2) {
             $this->assertSame($driver2, Loop::get());
         }, $driver2);
         $this->assertSame($driver1, Loop::get());
     }, $driver1);
 }
All Usage Examples Of Interop\Async\Loop::get