WordPress at Your Fingertips
function is not described

WC_REST_Authentication::parse_header() public WC 3.0.0

Parse the Authorization header into parameters.

{} It's a method of the class: WC_REST_Authentication{}

No Hooks.

Return

Array. Map of parameter values.

Usage

$WC_REST_Authentication = new WC_REST_Authentication();
$WC_REST_Authentication->parse_header( $header );
$header(string) (required)
Authorization header value (not including "Authorization: " prefix).

Changelog

Since 3.0.0 Introduced.

Code of WC_REST_Authentication::parse_header() WC 5.9.0

public function parse_header( $header ) {
	if ( 'OAuth ' !== substr( $header, 0, 6 ) ) {
		return array();
	}

	// From OAuth PHP library, used under MIT license.
	$params = array();
	if ( preg_match_all( '/(oauth_[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches ) ) {
		foreach ( $matches[1] as $i => $h ) {
			$params[ $h ] = urldecode( empty( $matches[3][ $i ] ) ? $matches[4][ $i ] : $matches[3][ $i ] );
		}
		if ( isset( $params['realm'] ) ) {
			unset( $params['realm'] );
		}
	}

	return $params;
}