1
0
mirror of https://github.com/danog/amp.git synced 2025-01-06 04:58:44 +01:00
amp/lib/Loop/DriverFactory.php

28 lines
557 B
PHP
Raw Normal View History

<?php
namespace Amp\Loop;
2017-03-14 22:33:45 +01:00
// @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;
}
2017-03-14 22:33:45 +01:00
}
// @codeCoverageIgnoreEnd