mirror of
https://github.com/danog/amp.git
synced 2024-12-14 18:37:30 +01:00
28 lines
472 B
PHP
Executable File
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;
|
|
}
|
|
|
|
}
|