1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00
amp/lib/Loop/DriverFactory.php
Niklas Keller 79ab41e5bf Update php-cs-fixer to version 2 and upgrade rules
This also fixes the code style according to the new rules.
2017-04-24 16:22:02 +02:00

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