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

22 lines
424 B
PHP
Raw Normal View History

2013-08-05 22:05:08 +02:00
<?php
namespace Alert;
class ReactorFactory {
2014-02-23 22:26:28 +01:00
public function __invoke() {
2013-08-05 22:05:08 +02:00
return $this->select();
}
2014-02-23 22:26:28 +01:00
public function select() {
2014-06-11 18:21:46 +02:00
if (extension_loaded('uv')) {
$reactor = new UvReactor;
} elseif (extension_loaded('libevent')) {
2013-08-05 22:05:08 +02:00
$reactor = new LibeventReactor;
} else {
$reactor = new NativeReactor;
}
return $reactor;
}
}