1
0
mirror of https://github.com/danog/amp.git synced 2024-12-14 18:37:30 +01:00
amp/src/Alert/ReactorFactory.php
2013-08-07 00:17:57 -04:00

28 lines
451 B
PHP

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