builds the Authorization: header
@return string
@throws \Makotokw\Twient\Exception
768315
public function toHeader()
    {
        $out = 'Authorization: OAuth realm=""';
        foreach ($this->parameters as $k => $v) {
            if (substr($k, 0, 5) != "oauth") {
                continue;
            }
            if (is_array($v)) {
                throw new Exception('Arrays not supported in headers');
            }
            $out .= ',' .
                Util::urlencodeRfc3986($k) .
                '="' .
                Util::urlencodeRfc3986($v) .
                '"';
        }
        return $out;
    }
1020243
public static function get_headers() {
        if (function_exists('apache_request_headers')) {
            // we need this to get the actual Authorization: header
            // because apache tends to tell us it doesn't exist
            $in = apache_request_headers();
            $out = array();
            foreach ($in as $key => $value) {
                $key = str_replace(" ", "-", ucwords(strtolower(str_replace("-", " ", $key))));
                $out[$key] = $value;
            }
            return $out;
        }
        // otherwise we don't have apache and are just going to have to hope
        // that $_SERVER actually contains what we need
        $out = array();
        foreach ($_SERVER as $key => $value) {
            if (substr($key, 0, 5) == "HTTP_") {
                // this is chaos, basically it is just there to capitalize the first
                // letter of every word that is not an initial HTTP and strip HTTP
                // code from przemek
                $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
                $out[$key] = $value;
            }
        }
        return $out;
    }
622964
public function getAuthorizationHeader()
    {
        if (!is_null($this->bearerKey)) {
            return 'Bearer ' . $this->bearerKey;
        }

        return 'ApiKey ' . $this->username . ':' . $this->apiKey;
    }
942114
public function getHeader()
    {
        $this->withHeader = true;
        if (ftell($this->handle) == 0) {
            $this->header = $this->read();
        }
        return $this->header;
    }
818236
public function getAuthorizationBearer() {
        $allHeaders = array_change_key_case(parent::getHeaders(), CASE_UPPER);

        if (array_key_exists('AUTHORIZATION', $allHeaders)) {
            if (preg_match('/Bearer\s(\S+)/', $allHeaders['AUTHORIZATION'], $matches)) {
                return $matches[1];
            }
        } else {
            throw new \Exception(ExceptionMessages::AUTH_BEARER_NOT_FOUND);
        }
    }
665212
protected static function getJWTFromAuthHeader()
    {
        if ('testing' === env('APP_ENV')) {
            // getallheaders method is not available in unit test mode.
            return [];
        }

        if (!function_exists('getallheaders')) {
            function getallheaders()
            {
                if (!is_array($_SERVER)) {
                    return [];
                }

                $headers = [];
                foreach ($_SERVER as $name => $value) {
                    if (substr($name, 0, 5) == 'HTTP_') {
                        $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] =
                            $value;
                    }
                }

                return $headers;
            }
        }

        $token = null;
        $headers = getallheaders();
        $authHeader = array_get($headers, 'Authorization');
        if (strpos($authHeader, 'Bearer') !== false) {
            $token = substr($authHeader, 7);
        }

        return $token;
    }
571359
private function GetHttpHeaderStrong()
    {
        $token = $this->_root->OAuthTokenManager->GetToken($this->GetAutenticationKey());

        if (is_null($token) || !isset($token->access_token) || !isset($token->token_type)) {
            throw new Exception('OAuth token is not created (or is invalid) for strong authentication');
        }

        return 'Authorization: ' . $token->token_type . ' ' . $token->access_token;
    }
700197
public static function get_headers() {
    $headers = OAuthUtil::get_headers_internal();
    if ( ! is_array($headers) ) return $headers;
    if ( (! isset($headers['Authorization'])) && isset($headers['X-Oauth1-Authorization']) ) {
        $headers['Authorization'] = $headers['X-Oauth1-Authorization'];
    }
    return $headers;
  }
718619
private function buildCompleteHeader(): string
    {
        $header = "";
        foreach ($this->headers as $sourceType => $value) {
            $header .= $this->buildHeaderLine($sourceType, $value);
        }
        if (!empty($this->reportUri)) {
            $header .= 'report-uri ' . $this->reportUri . ';';
        }
        return $header;
    }
979069
public function toString()
    {
        $authorization = array();
        $authorization['code'] = $this->code;
        $authorization['reference'] = $this->reference;
        return "Authorization: " . implode(' - ', $authorization);
    }
291431
public function toHeading()
    {
        $results = '';

        foreach ($this->getParser()->toArray() as $name => $types) {
            if (in_array($name, $this->ignores)) {
                continue;
            }

            $results .= "\t\t\t".'<th>'.ucwords($name).'</th>'.PHP_EOL;
        }

        return $results;
    }
1369882
public function header() {
		$args = func_get_args();
		$name = $args[0];
		if (count($args) == 2) {
			$this->headers[$name] = $args[1];
		}
		return $this->headers[$name];
	}
747392
protected function buildAuthorityStr()
    {
        if ($this->host != null) {
            $authority = '//';
            if ($this->userInfo != null) {
                $authority .= $this->userInfo . '@';
            }
            $flag = (strpos($this->host, ':') !== false) && !(substr($this->host, 0,
                        1) == '[') && !(substr($this->host, -1) == ']');
            if ($flag) {
                $authority .= '[';
            }
            $authority .= $this->host;
            if ($flag) {
                $authority .= ']';
            }
            if ($this->port != null) {
                $authority .= ':' . $this->port;
            }
            return $authority;
        } else {
            if ($this->scheme) {
                return '//' . $this->authority;
            } else {
                return $this->authority;
            }
        }
    }
583557
private function _authHeader(): string
    {
        if (empty($this->_client_id)) {
            throw new VimeoException('A client ID must be set in order to generate an auth header.');
        } elseif (empty($this->_client_secret)) {
            throw new VimeoException('A client secret must be set in order to generate an auth header.');
        }

        return base64_encode($this->_client_id . ':' . $this->_client_secret);
    }
959478
protected function prefillHeader()
    {
        if ($this->requiresAuthorization() && !empty($this->getAuthorizationHeader())) {
            $this->headers['Authorization'] = $this->getAuthorizationHeader();
        }
        return $this;
    }
923642
private function getAuthHeader()
    {
        $credential = $this->apiContext->getCredential();

        $header = '<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">';
        $header .= '<wsse:UsernameToken wsu:Id="UsernameToken-9" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">';
        $header .= '<wsse:Username>' . $credential->getUsername() . '</wsse:Username>';
        $header .= '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $credential->getPassword() . '</wsse:Password>';
        $header .= '</wsse:UsernameToken>';
        $header .= '</wsse:Security>';

        $headerbody = new \SoapVar($header, XSD_ANYXML, null, null, null);
        return new \SOAPHeader(self::PAYU_NAMESPACE, 'Security', $headerbody, true);
    }
1266792
final protected function createHeader()
    {
        $host = $this->host;
        if ($host === '127.0.0.1' || $host === '0.0.0.0')
        {
            $host = 'localhost';
        }

        return "GET {$this->path} HTTP/1.1" . "\r\n" .
        "Origin: null" . "\r\n" .
        "Host: {$host}:{$this->port}" . "\r\n" .
        "Sec-WebSocket-Key: {$this->key}" . "\r\n" .
        "User-Agent: ".self::UserAgent."/" . self::VERSION . "\r\n" .
        "Upgrade: Websocket" . "\r\n" .
        "Connection: Upgrade" . "\r\n" .
        "Sec-WebSocket-Protocol: wamp" . "\r\n" .
        "Sec-WebSocket-Version: 13" . "\r\n" . "\r\n";
    }