/** * Parse OAuth WWW-Authenticate header and either add them to an existing * message or create a new message. * * @param msg * @param resp * @return the updated message. */ private function parseAuthHeader(OAuthRequest $msg = null, RemoteContentRequest $resp) { if ($msg == null) { $msg = OAuthRequest::from_request(); } $authHeaders = $resp->getResponseHeader("WWW-Authenticate"); if ($authHeaders != null) { $msg->set_parameters(OAuthUtil::decodeAuthorization($authHeaders)); } return $msg; }