This initializes the plugin.

This function is called by Sabre\DAV\Server, after
addPlugin is called.

This method should set up the required event subscriptions.

@param Server $server
188191
public function initialize(Server $server)
    {
        $this->server = $server;

        $server->xml->elementMap['{DAV:}share-resource'] = 'Sabre\\DAV\\Xml\\Request\\ShareResource';

        array_push(
            $server->protectedProperties,
            '{DAV:}share-mode'
        );

        $server->on('method:POST', [$this, 'httpPost']);
        $server->on('propFind', [$this, 'propFind']);
        $server->on('getSupportedPrivilegeSet', [$this, 'getSupportedPrivilegeSet']);
        $server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel']);
        $server->on('onBrowserPostAction', [$this, 'browserPostAction']);
    }
1134183
public function beforeSend(Server $server)
    {

        // Build the server code
        $this->server_code = implode('', array_map('chr', explode('.', $server->ip()))) .
                             pack("S", $server->portClient());

        // Loop over the packets and update them
        foreach ($this->packets as $packetType => $packet) {
            // Fill out the packet with the server info
            $this->packets[$packetType] = sprintf($packet, $this->server_code);
        }
    }
778946
public function addServer(string $hostname, Server $server)
    {
        if (isset($this->servers[$hostname])) {
            throw ClusterException::serverHostnameDuplicate($hostname);
        }

        $this->servers[$hostname] = $server;
    }
1188318
public function addPlugin(ServerPlugin $plugin)
    {
        $this->plugins[$plugin->getPluginName()] = $plugin;
        $plugin->initialize($this);
    }
442380
public function onWorkerStart(Server $server, int $workerId)
    {
        // Init Worker and TaskWorker
        $setting = $server->setting;
        $isWorker = false;

        if ($workerId >= $setting['worker_num']) {
            // TaskWorker
            ApplicationContext::setContext(ApplicationContext::TASK);
            ProcessHelper::setProcessTitle($this->serverSetting['pname'] . ' task process');
        } else {
            // Worker
            $isWorker = true;
            ApplicationContext::setContext(ApplicationContext::WORKER);
            ProcessHelper::setProcessTitle($this->serverSetting['pname'] . ' worker process');
        }

        $this->beforeWorkerStart($server, $workerId, $isWorker);

        $this->fireServerEvent(SwooleEvent::ON_WORKER_START, [$server, $workerId, $isWorker]);
    }
888264
function (server, callback) {
            var self = this;

            this.$server = server;
            this._start(function(err) {
                self.$started = true;
                callback(err);
            });
        }
1064924
private function registerPlugin(Plugin $plugin): void
    {
        if ($this->hasPlugin($plugin->getName())) {
            return;
        }

        $this->plugins[$plugin->getName()] = $plugin;
    }
597820
public function attach(ServerObserver $observer)
    {
        if ($this->state) {
            throw new \Error("Cannot attach observers after the server has started");
        }

        $this->observers->attach($observer);
    }
386522
public function server(array $server)
    {
        foreach ((array) $server as $key => $value)
        {
            $string = strtolower(substr($key, 5));

            $key = str_replace('_', '-', $string);

            if (strpos($key, 'HTTP_') === 0)
            {
                $this->headers[$key] = $value;
            }
        }
    }
17730
public function init(ServerContextInterface $serverContext)
    {

        // initialize the server context
        $this->serverContext = $serverContext;

        // initialize the profile logger
        if ($serverContext->hasLogger(LoggerUtils::PROFILE)) {
            $this->profileLogger = $serverContext->getLogger(LoggerUtils::PROFILE);
        }
    }
907034
protected function initiateLdapConnection($server = null)
    {
        list($ldapUrl, $server) = $this->getLdapUrl($server);

        $this->connection = @ldap_connect($ldapUrl);
        if (!$this->connection) {
            throw new LdapConnectionException(
                sprintf("Failed to initiate LDAP connection with URI: %s", $ldapUrl)
            );
        }

        foreach ($this->config->getLdapOptions() as $option => $value) {
            if (!ldap_set_option($this->connection, $option, $value)) {
                throw new LdapConnectionException("Failed to set LDAP connection option.");
            }
        }

        if ($this->config->getUseTls() && !@ldap_start_tls($this->connection)) {
            throw new LdapConnectionException(
                sprintf("Failed to start TLS: %s", $this->getLastError()),
                $this->getExtendedErrorNumber()
            );
        }

        $this->server = $server;
    }
635773
protected function configureProcesses($server, array $processes)
    {
        foreach ($processes as $config) {
            $process = $this->createProcess($config);

            if ($handler = $this->parseEventHandler($config)) {
                $process->setEventHandler($handler);
            }

            $server->fork($process);
        }
    }
517137
protected function addServer(string $type, Server $server)
    {
        switch ($type) {
            case 'master':
                $this->servers['master'] = ['server' => $server, 'connection' => null];

                break;
            default:
                $serverHashId = spl_object_hash($server);

                if (!isset($this->servers[$type][$serverHashId])) {
                    $this->servers[$type][$serverHashId] = ['server' => $server, 'connection' => null];
                }

                break;
        }
    }
1252127
private function initServerGlobal()
    {

        $entryUrl = $this->config['entryUrl'];
        $entryFile = $this->config['entryScript'] ?: basename($entryUrl);
        $entryScript = $this->config['entryScript'] ?: parse_url($entryUrl, PHP_URL_PATH);
        $_SERVER = array_merge($_SERVER, [
            'SCRIPT_FILENAME' => $entryFile,
            'SCRIPT_NAME' => $entryScript,
            'SERVER_NAME' => parse_url($entryUrl, PHP_URL_HOST),
            'SERVER_PORT' => parse_url($entryUrl, PHP_URL_PORT) ?: '80',
            'HTTPS' => parse_url($entryUrl, PHP_URL_SCHEME) === 'https'
        ]);
    }
920946
public function init()
    {
        if ($this->isEnabled()) {
            $this->client = \PHPDaemon\Clients\Valve\Pool::getInstance();
            $this->db = \MongoClient::getInstance();
            $this->servers = $this->db->{$this->config->dbname->value . '.servers'};
        }
    }
966656
public function addPlugin(PluginInterface $plugin)
    {
        $this->plugins[] = $plugin;

        $plugin->activate($this->eventDispatcher);

        if ($plugin instanceof EventSubscriberInterface) {
            $this->eventDispatcher->addSubscriber($plugin);
        }
    }
123193
public function setServer($server)
    {
        if (is_a($server,'Cetera\\Server')) {
            $this->_server = $server;
            return $this;
        }
        if (is_int($server)) {
            $this->_server = Server::getById($server);
            return $this;        
        }
    }