1
0
mirror of https://github.com/danog/amp.git synced 2024-12-14 18:37:30 +01:00
amp/lib/ReactorFactory.php
2014-03-06 09:53:16 -05:00

28 lines
472 B
PHP
Executable File

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