Aerys\Bootstrapper::init PHP Method

init() public method

Initializes the server directly without config file inclusion
public init ( Psr\Log\LoggerInterface $logger, array $options = [] ) : Server
$logger Psr\Log\LoggerInterface
$options array Aerys options array
return Server
    public function init(PsrLogger $logger, array $options = []) : Server
    {
        if (!array_key_exists("debug", $options)) {
            $options["debug"] = false;
        }
        $options = $this->generateOptionsObjFromArray($options);
        $vhosts = new VhostContainer(new Http1Driver());
        $ticker = new Ticker($logger);
        $server = new Server($options, $vhosts, $logger, $ticker);
        $bootLoader = static function (Bootable $bootable) use($server, $logger) {
            $booted = $bootable->boot($server, $logger);
            if ($booted !== null && !$booted instanceof Middleware && !is_callable($booted)) {
                throw new \InvalidArgumentException("Any return value of " . get_class($bootable) . '::boot() must return an instance of Aerys\\Middleware and/or be callable, got ' . gettype($booted) . ".");
            }
            return $booted ?? $bootable;
        };
        $hosts = \call_user_func($this->hostAggregator) ?: [new Host()];
        foreach ($hosts as $host) {
            $vhost = self::buildVhost($host, $bootLoader);
            $vhosts->use($vhost);
        }
        return $server;
    }