1
0
mirror of https://github.com/danog/amp.git synced 2024-12-14 18:37:30 +01:00
amp/lib/ReactorFactory.php
2014-06-11 12:24:46 -04:00

22 lines
424 B
PHP
Executable File

<?php
namespace Alert;
class ReactorFactory {
public function __invoke() {
return $this->select();
}
public function select() {
if (extension_loaded('uv')) {
$reactor = new UvReactor;
} elseif (extension_loaded('libevent')) {
$reactor = new LibeventReactor;
} else {
$reactor = new NativeReactor;
}
return $reactor;
}
}