<?php namespace React\EventLoop; /** * The `Factory` class exists as a convenient way to pick the best available event loop implementation. */ final class Factory { /** * Creates a new event loop instance * * ```php * $loop = React\EventLoop\Factory::create(); * ``` * * This method always returns an instance implementing `LoopInterface`, * the actual event loop implementation is an implementation detail. * * This method should usually only be called once at the beginning of the program. * * @return LoopInterface */ public static function create() { // @codeCoverageIgnoreStart if (\function_exists('uv_loop_new')) { // only use ext-uv on PHP 7 return new ExtUvLoop(); } elseif (\class_exists('libev\EventLoop', false)) { return new ExtLibevLoop(); } elseif (\class_exists('EvLoop', false)) { return new ExtEvLoop(); } elseif (\class_exists('EventBase', false)) { return new ExtEventLoop(); } elseif (\function_exists('event_base_new') && \PHP_MAJOR_VERSION === 5) { // only use ext-libevent on PHP 5 for now return new ExtLibeventLoop(); } return new StreamSelectLoop(); // @codeCoverageIgnoreEnd } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Tick | Folder | 0755 |
|
|
Timer | Folder | 0755 |
|
|
ExtEvLoop.php | File | 5.82 KB | 0644 |
|
ExtEventLoop.php | File | 7.35 KB | 0644 |
|
ExtLibevLoop.php | File | 5.45 KB | 0644 |
|
ExtLibeventLoop.php | File | 8.36 KB | 0644 |
|
ExtUvLoop.php | File | 7.99 KB | 0644 |
|
Factory.php | File | 1.32 KB | 0644 |
|
LoopInterface.php | File | 18.24 KB | 0644 |
|
SignalsHandler.php | File | 1.28 KB | 0644 |
|
StreamSelectLoop.php | File | 9.19 KB | 0644 |
|
TimerInterface.php | File | 492 B | 0644 |
|