src/Loop.php
public static function setFactory(DriverFactory $factory = null)
    {
        if (self::$level > 0) {
            throw new \RuntimeException("Setting a new factory while running isn't allowed!");
        }

        self::$factory = $factory;

        // reset it here, it will be actually instantiated inside execute() or get()
        self::$driver = null;
    }
public static function setFactory(DriverFactory $factory = null)
    {
        if (self::$level > 0) {
            throw new \RuntimeException("Setting a new factory while running isn't allowed!");
        }

        self::$factory = $factory;

        // reset it here, it will be actually instantiated inside execute() or get()
        self::$driver = null;
    }
public static function setFactory ( DriverFactory $ factory = null ) { if ( self :: $ level > 0 ) { throw new \ RuntimeException ( "Setting a new factory while running isn't allowed!" ) ; } self :: $ factory = $ factory ; // reset it here, it will be actually instantiated inside execute() or get() self :: $ driver = null ; }
Set the factory to be used to create a default drivers.

Setting a factory is only allowed as long as no loop is currently running. Passing null will reset the
default driver and remove the factory.

The factory will be invoked if none is passed to `Loop::execute`. A default driver will be created to
support synchronous waits in traditional applications.

@param DriverFactory|null $factory New factory to replace the previous one.
Set the factory to be used to create a default drivers .