Returns an instance to TwitterOAuth server based on the current configuration.

@param string $key Unique identifier for the TwitterOAuth server that you wish to get.

@return array|TwitterOAuth
@throws TwitterOAuthException
515039
public static function getInstance($key)
    {
        if (isset(self::$instances[$key])) {
            return self::$instances;
        }

        $config = TwitterOAuth::getConfig()->get($key, false);

        if (!$config) {
            throw new TwitterOAuthException('Unable to read "TwitterOAuth.' . $key . '" configuration.');
        }

        if (strpos($config->RedirectUri, 'http://') !== false || strpos($config->RedirectUri, 'https://'
            ) !== false
        ) {
            $redirectUri = $config->RedirectUri;
        } else {
            $redirectUri = self::httpRequest()->getCurrentUrl(true)->setPath($config->RedirectUri)->setQuery('')->val();
        }

        $instance = \Webiny\Component\TwitterOAuth\Bridge\TwitterOAuth::getInstance($config->ClientId,
                                                                                    $config->ClientSecret, $redirectUri
        );

        return new TwitterOAuth($instance);
    }
927274
public static function instance($key)
    {
        if(isset(self::$bindings[$key]))
        {
            return self::$bindings[$key];
        }

        return false;
    }
906857
private function get( $key )
	{
		if ( isset($this->serverData[ $key ]) )
		{
			return $this->serverData[ $key ];
		}
		else
		{
			return null;
		}
	}
878002
public function getHashClientName($key)
    {
        if (1 == $this->getServerCount()) {
            return $this->defaultName;
        }

        $count  = intval(sprintf('%u', crc32($key)));
        return $this->hashArray[$count % sizeof($this->serverArray)];
    }
1337703
public function url($key) {
        $v = new UrlValidator($this->shell->_unsafeVar[$key] ?? null, $this->shell);
        $v->_isUndefined = !array_key_exists($key, $this->shell->_unsafeVar);
        $this->shell->subValidators[$key] = $v;
        return $v;
    }
922146
public function server(string $key, $default = null)
{
  return $this->server->has($key) ? $this->server->get($key) : $default;
}
212543
public function getConfiguration($key = null) {
        if (!$key) {
            return $this->_configuration;
        }
        if (!array_key_exists($key, $this->_configuration)) {
            throw new Exception("'$key' is not a valid configuration key.");
        }
        return $this->_configuration[$key];
    }
1293384
public function get($key)
    {
        $key = $this->createKey($key);
        return $this->instance->get($key);
    }
234442
public function get($key)
    {
        $textRegistry = $this->getTextRegistry();
        if (is_string($key) && isset($textRegistry[$key])) {
            return $textRegistry[$key];
        }
        return $key;
    }
822142
public function getCredential($key)
    {
        return !isset($this->credentials[$key]) ? null : $this->credentials[$key];
    }
713501
public function getKey($key)
    {
        $tokens = explode('.', $key);


        $first = array_shift($tokens);
        $first = str_replace('POINT', '.', $first);

        $that = $this;

        $value = $that[$first];

        foreach($tokens as $k) {
            $k = str_replace('POINT', '.', $k);
            if (false === isset($value[$k])) {
                return null;
            }
            $value = $value[$k];
        }

        return $value;
    }
1193899
static function fromKey(string $key)
    {
        return self::$instanceCache[static::class][$key]
            ?? (self::$instanceCache[static::class][$key] = new static($key, static::getValue($key)));
    }
1057818
public function getAuthProvider($key)
    {
        if (array_key_exists($key, $this->authproviders)) {
            return $this->authproviders[$key];
        }

        throw \InvalidArgumentException(sprintf("Auth provider doesn't exists", $key));
    }
224401
public function client( $key = null ) {

		// check if we already set the client object
		if ( is_null( $this->client ) ) 
		{
			// make client 
			$this->client = new \stdClass;

			/*
			 * get clients ip address
			 */
			// Cloudlfare fix 
			if ( $this->has_server( 'HTTP_CF_CONNECTING_IP' ) ) 
			{
				$this->client->ip = $this->server( 'HTTP_CF_CONNECTING_IP' );
			}
			// proxy?
			elseif ( $this->has_server( 'HTTP_X_FORWARDED_FOR' ) ) 
			{
				$this->client->ip = $this->server( 'HTTP_X_FORWARDED_FOR' );
			} 
			// another proxy?
			elseif ( $this->has_server( 'HTTP_CLIENT_IP' ) )
			{
				$this->client->ip = $this->server( 'HTTP_CLIENT_IP' );
			}
			// or default
			else 
			{
				$this->client->ip = $this->server( 'REMOTE_ADDR', '127.0.0.1' );
			}

			/*
			 * set clients user agent
			 */
			$this->client->agent = $this->server( 'HTTP_USER_AGENT', '' );

			/*
			 * set clients port
			 */
			$this->client->port = $this->server( 'REMOTE_PORT', '' );

			/*
			 * set clients fingerprint based on host and agent
			 */
			$this->client->fingerprint = CCStr::hash( $this->client('agent').$this->client('ip') );

			/*
			 * set clients language
			 */
			$this->client->language = CCLang::set_current( $this->server( 'HTTP_ACCEPT_LANGUAGE' ) );
		}

		// return the object
		if ( is_null( $key ) ) 
		{
			return $this->client;
		}

		// return a special key
		return $this->client->{$key};
	}
1288329
public function getAuthSource($key)
    {
        if (!isset($this->authSources[$key])) {
            throw new \InvalidArgumentException(sprintf(
                'There is no AuthSource called "%s". Available are: %s',
                $key,
                implode(', ', array_keys($this->authSources))
            ));
        }

        return $this->container->get($this->authSources[$key]);
    }
102649
public static function getTrustedHeaderName($key)
    {
        if (2 > func_num_args() || func_get_arg(1)) {
            @trigger_error(sprintf('The "%s()" method is deprecated since version 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED);
        }

        if (!array_key_exists($key, self::$trustedHeaders)) {
            throw new \InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key));
        }

        return self::$trustedHeaders[$key];
    }
113391
private function getHeader($key)
    {
        if (isset($this->requestHeader[$key])) {
            $header = $this->requestHeader[$key]['value'];

            unset($this->requestHeader[$key]);
        } else {
            if ($key === 'host') {
                $header = $this->getHost();
            } elseif ($key === 'accept') {
                $header = '*/*';
            } elseif ($key === 'user-agent') {
                $header = self::$userAgent;
            }
        }

        return $header;
    }