mirror of
https://github.com/danog/amp.git
synced 2024-11-27 04:24:42 +01:00
79ab41e5bf
This also fixes the code style according to the new rules.
29 lines
558 B
PHP
29 lines
558 B
PHP
<?php
|
|
|
|
namespace Amp\Loop;
|
|
|
|
// @codeCoverageIgnoreStart
|
|
class DriverFactory {
|
|
/**
|
|
* Creates a new loop instance and chooses the best available driver.
|
|
*
|
|
* @return Driver
|
|
*/
|
|
public function create(): Driver {
|
|
if (UvDriver::isSupported()) {
|
|
return new UvDriver;
|
|
}
|
|
|
|
if (EvDriver::isSupported()) {
|
|
return new EvDriver;
|
|
}
|
|
|
|
if (EventDriver::isSupported()) {
|
|
return new EventDriver;
|
|
}
|
|
|
|
return new NativeDriver;
|
|
}
|
|
}
|
|
// @codeCoverageIgnoreEnd
|