Fix case for serverRequest variable and remove unused variable

This commit is contained in:
Andrew Millington 2018-05-13 17:38:07 +01:00
parent c2dcdee266
commit cbce5f45ba

View File

@ -97,7 +97,7 @@ class OAuthServerException extends \Exception
*/ */
public function setServerRequest($serverRequest) public function setServerRequest($serverRequest)
{ {
$this->ServerRequest = $serverRequest; $this->serverRequest = $serverRequest;
} }
/** /**
@ -139,8 +139,6 @@ class OAuthServerException extends \Exception
*/ */
public static function invalidClient($serverRequest) public static function invalidClient($serverRequest)
{ {
$errorMessage = 'Client authentication failed';
$exception = new static('Client authentication failed', 4, 'invalid_client', 401); $exception = new static('Client authentication failed', 4, 'invalid_client', 401);
$exception->setServerRequest($serverRequest); $exception->setServerRequest($serverRequest);
@ -316,8 +314,8 @@ class OAuthServerException extends \Exception
// include the "WWW-Authenticate" response header field // include the "WWW-Authenticate" response header field
// matching the authentication scheme used by the client. // matching the authentication scheme used by the client.
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
if ($this->errorType === 'invalid_client' && $this->ServerRequest->hasHeader('Authorization') === true) { if ($this->errorType === 'invalid_client' && $this->serverRequest->hasHeader('Authorization') === true) {
$authScheme = strpos($this->ServerRequest->getHeader('Authorization')[0], 'Bearer') === 0 ? 'Bearer' : 'Basic'; $authScheme = strpos($this->serverRequest->getHeader('Authorization')[0], 'Bearer') === 0 ? 'Bearer' : 'Basic';
$headers['WWW-Authenticate'] = $authScheme . ' realm="OAuth"'; $headers['WWW-Authenticate'] = $authScheme . ' realm="OAuth"';
} }