Get configured server.
@return Server
1988
public function getServer()
    {
        if (!$this->server) {
            $server = new Server(
                $this->getSource(),
                $this->getCache(),
                $this->getApi()
            );

            $server->setSourcePathPrefix($this->sourcePathPrefix);
            $server->setCachePathPrefix($this->cachePathPrefix);
            $server->setGroupCacheInFolders($this->groupCacheInFolders);
            $server->setDefaults($this->defaults);
            $server->setPresets($this->presets);
            $server->setBaseUrl($this->baseUrl);
            $server->setResponseFactory($this->responseFactory);

            $this->server = $server;
        }

        return $this->server;
    }
1200978
public function getConfiguration()
    {
        $configurationFiles = $this->locator->locate('config.yml', null, false);
        $configurations     = [];

        foreach ($configurationFiles as $path) {
            $configurations[] = $this->loader->load($path);
        }

        return $this->processor->processConfiguration($this->configuration, $configurations);
    }
1105033
public function getServerPort()
    {
        if (!$this->port) {
            $default = $this->isSecure() ? 443 : 80;
            $this->setServerPort($this->getServer('SERVER_PORT', $default));
        }
        return $this->port;
    }
1215270
public function getHost() {
		if (!is_null($this->host)) {
			return $this->host;
		}

		if ($_SERVER['HTTP_X_FORWARDED_HOST']) {
			$elements = explode(',', $value);
			$host = trim(end($elements));
		} else if ($_SERVER['HTTP_HOST']) {
			$host = $_SERVER['HTTP_HOST'];
		} else if ($_SERVER['SERVER_NAME']) {
			$host = $_SERVER['SERVER_NAME'];
		}

		if (isset($host)) {
			$host = preg_replace('/:\d+$/', '', $host);
			$this->host = $host;
		}

		return $this->host;
	}
635827
public function server($name = null)
    {
        if (empty($name)) {
            $name = $this->getDefaultServerName();
        }

        if (!isset($this->servers[$name])) {
            $this->servers[$name] = $this->makeServer($name);
        }

        return $this->servers[$name];
    }
1318759
public function getHost()
    {
        $hostClass = $this->hostClass;
        $model = $hostClass::buildNoInitModel();
        return $this->hasOne($hostClass::className(), [$model->guidAttribute => $this->createdByAttribute]);
    }
539788
public function GetServerIp () {
		if ($this->serverIp === NULL) {
			$this->serverIp = (isset($this->globalServer['SERVER_ADDR'])
				? $this->globalServer['SERVER_ADDR']
				: (isset($this->globalServer['LOCAL_ADDR'])
					? $this->globalServer['LOCAL_ADDR']
					: ''));
		}
		return $this->serverIp;
	}
538442
public function getHosts()
    {
        if (empty($this->hosts) && isset($this->configuration['hosts'])) {
            foreach ($this->configuration['hosts'] as $host) {
                $this->hosts[] = ObjectFactory::getInstance()->newInstance(Host::class, $host);
            }
        }

        return $this->hosts;
    }
478471
public function getHost()
    {
        if ($this->host === null) {
            // pick a "random" host
            $host = $this->hosts[mt_rand(0,count($this->hosts)-1)];
            $this->setHost($host);
            return $host;
        } else {
            return $this->host;
        }
    }
624476
public function getServer()
    {
        if(!$this->has('server')) {
            $storages = [];

            if($this->useJwtToken)
            {
                if(!array_key_exists('access_token', $this->storageMap) || !array_key_exists('public_key', $this->storageMap)) {
                        throw new \yii\base\InvalidConfigException('access_token and public_key must be set or set useJwtToken to false');
                }
                //define dependencies when JWT is used instead of normal token
                \Yii::$container->clear('public_key'); //remove old definition
                \Yii::$container->set('public_key', $this->storageMap['public_key']);
                \Yii::$container->set('OAuth2\Storage\PublicKeyInterface', $this->storageMap['public_key']);

                \Yii::$container->clear('access_token'); //remove old definition
                \Yii::$container->set('access_token', $this->storageMap['access_token']);
            }

            foreach(array_keys($this->storageMap) as $name) {
                $storages[$name] = \Yii::$container->get($name);
            }

            $grantTypes = [];
            foreach($this->grantTypes as $name => $options) {
                if(!isset($storages[$name]) || empty($options['class'])) {
                    throw new \yii\base\InvalidConfigException('Invalid grant types configuration.');
                }

                $class = $options['class'];
                unset($options['class']);

                $reflection = new \ReflectionClass($class);
                $config = array_merge([0 => $storages[$name]], [$options]);

                $instance = $reflection->newInstanceArgs($config);
                $grantTypes[$name] = $instance;
            }


            $server = \Yii::$container->get(Server::className(), [
                $this,
                $storages,
                array_merge([
                    'use_jwt_access_tokens' => $this->useJwtToken,//ADDED
                    'token_param_name' => $this->tokenParamName,
                    'access_lifetime' => $this->tokenAccessLifetime,
                    'require_exact_redirect_uri' => false
                    /** add more ... */
                ], $this->options),
                $grantTypes
            ]);

            $this->set('server', $server);
        }
        return $this->get('server');
    }
527666
protected function getServer()
    {
        $server = new Server();
        $server->setHost($this->getHost())
            ->setRoot($this->getServerRoot())
            ->setBranch($this->getServerBranch())
            ->setCodeVersion($this->getServerCodeVersion());
        $extras = $this->getServerExtras();
        if (!$extras) {
            $extras = array();
        }

        $server->setExtras($extras);
        if (isset($_SERVER) && array_key_exists('argv', $_SERVER)) {
            $server->setArgv($_SERVER['argv']);
        }
        return $server;
    }
607004
public function getHost()
    {
        $host = $this->getServer('HTTP_HOST') ?: $this->getServer('SERVER_NAME') ?: $this->getServer('REMOTE_ADDR');
        return preg_replace('/:\d+$/', '', $host);
    }
1107997
protected function getConnection()
    {
        if (empty($this->memcache)) {

            //ini_set('memcache.chunk_size', 32768);
            //ini_set('memcache.allow_failover', false); // default is usually true
            //ini_set('memcache.hash_strategy', 'consistent');

            $this->memcache = new Memcache;

            // Add the servers
            if (!is_array($this->memcachedServers) || count($this->memcachedServers) < 1)
                throw new CacheException('At least one server must be specified.');

            foreach ( $this->memcachedServers as $server ) {
                $options = array_merge(array('port'             => 11211,
                                             'persistent'       => true,
                                             'weight'           => 1,
                                             'timeout'          => 1,
                                             'retry_interval'   => 15,
                                             'status'           => true,
                                             'failure_callback' => null), array_change_key_case($server, CASE_LOWER));

                $this->Logger->debug("Adding memcached server:\n");
                $this->Logger->debug($options);

//                if(!array_key_exists('failure_callback', $options))
//                    $options['failure_callback'] = array(__CLASS__, '_failureCallback');

                if ($this->memcache->addServer($options['host'], $options['port'],
                                            $options['persistent'], $options['weight'],
                                            $options['timeout'], $options['retry_interval'],
                                            $options['status'], $options['failure_callback']) === false) {
                    throw new CacheException("Unable to add memcache server: {$options['host']}");
                }
            }
        }

        return $this->memcache;
    }
114255
protected function platform()
    {
        if (! $this->platform )
            $this->platform = new PlatformRest;


        # Default Options Overriding
        $this->platform->setServerUrl( $this->serverUrl );

        return $this->platform;
    }
323541
public function getServer($name = null, $default = '')
    {
        $context = $this->_context;

        if ($name === null) {
            return $context->_SERVER;
        } else {
            return isset($context->_SERVER[$name]) ? $context->_SERVER[$name] : $default;
        }
    }
957791
public function getParentServer()
    {
      if ($this->_parentServer) return $this->_parentServer;
      
      $fields = self::getDbConnection()->fetchAssoc( 
          " SELECT C.*
    		    FROM dir_structure B, dir_structure A, dir_data C
    		    WHERE A.data_id=? and B.lft<=A.lft and B.rght>=A.lft and
    		    B.data_id=C.id and C.is_server<>0", 
          array( (int)$this->id )
      );
      
      if ($fields) {
          $this->_parentServer = Server::fetch($fields);
          return $this->_parentServer;
      }
      return FALSE;
    }
548795
private Server setUpServer() {
        Server server = new Server(port);
        ResourceHandler handler = new ResourceHandler();
        handler.setDirectoriesListed(true);
        handler.setWelcomeFiles(new String[]{"index.html"});
        handler.setResourceBase(getReportDirectoryPath().toAbsolutePath().toString());
        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[]{handler, new DefaultHandler()});
        server.setStopAtShutdown(true);
        server.setHandler(handlers);
        return server;
    }