Interop\Async\Loop::createDriver PHP Method

createDriver() private static method

Create a new driver if a factory is present, otherwise throw.
private static createDriver ( ) : Driver
return Interop\Async\Loop\Driver
    private static function createDriver()
    {
        if (self::$factory === null) {
            throw new \Exception("No loop driver factory set; Either pass a driver to Loop::execute or set a factory.");
        }
        $driver = self::$factory->create();
        if (!$driver instanceof Driver) {
            $type = is_object($driver) ? "an instance of " . get_class($driver) : gettype($driver);
            throw new \Exception("Loop driver factory returned {$type}, but must return an instance of Driver.");
        }
        return $driver;
    }