Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DriverFactory.php

function DriverFactory::create

Creates a new loop instance and chooses the best available driver.

Return value

Driver

Throws

\Error If an invalid class has been specified via REVOLT_LOOP_DRIVER

File

vendor/revolt/event-loop/src/EventLoop/DriverFactory.php, line 23

Class

DriverFactory

Namespace

Revolt\EventLoop

Code

public function create() : Driver {
    $driver = (function () {
        if ($driver = $this->createDriverFromEnv()) {
            return $driver;
        }
        if (UvDriver::isSupported()) {
            return new UvDriver();
        }
        if (EvDriver::isSupported()) {
            return new EvDriver();
        }
        if (EventDriver::isSupported()) {
            return new EventDriver();
        }
        return new StreamSelectDriver();
    })();
    if (\getenv("REVOLT_DRIVER_DEBUG_TRACE")) {
        return new TracingDriver($driver);
    }
    return $driver;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal