public function __construct(\ThreadedLogger $logger, \ClassLoader $loader, $port, $interface = "0.0.0.0")
{
$this->port = (int) $port;
if ($port < 1 or $port > 65536) {
throw new \Exception("Invalid port range");
}
$this->interface = $interface;
$this->logger = $logger;
$this->loader = $loader;
$loadPaths = [];
$this->addDependency($loadPaths, new \ReflectionClass($logger));
$this->addDependency($loadPaths, new \ReflectionClass($loader));
$this->loadPaths = array_reverse($loadPaths);
$this->shutdown = false;
$this->externalQueue = new \Threaded();
$this->internalQueue = new \Threaded();
if (\Phar::running(true) !== "") {
$this->mainPath = \Phar::running(true);
} else {
$this->mainPath = \getcwd() . DIRECTORY_SEPARATOR;
}
$this->start();
}