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

28 lines
451 B
PHP
Raw Normal View History

2013-08-05 22:05:08 +02:00
<?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;
}
}