PHPCS fixes

This commit is contained in:
Alex Bilbie 2014-05-03 11:08:33 +01:00
parent 5c8ed58c67
commit b82551c97d
10 changed files with 42 additions and 16 deletions

View File

@ -174,7 +174,7 @@ class AuthorizationServer extends AbstractServer
$this->grantTypes[$identifier] = $grantType;
if ( ! is_null($grantType->getResponseType())) {
if (!is_null($grantType->getResponseType())) {
$this->responseTypes[] = $grantType->getResponseType();
}
@ -316,7 +316,7 @@ class AuthorizationServer extends AbstractServer
}
// Ensure grant type is one that is recognised and is enabled
if ( ! in_array($grantType, array_keys($this->grantTypes))) {
if (!in_array($grantType, array_keys($this->grantTypes))) {
throw new Exception\UnsupportedGrantTypeException($grantType);
}

View File

@ -32,6 +32,12 @@ class InvalidGrantException extends OAuthException
public function __construct($parameter)
{
parent::__construct(sprintf('The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. Check the "%s" parameter.', $parameter));
parent::__construct(
sprintf(
'The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used
in the authorization request, or was issued to another client. Check the "%s" parameter.',
$parameter
)
);
}
}

View File

@ -32,6 +32,12 @@ class InvalidRequestException extends OAuthException
public function __construct($parameter)
{
parent::__construct(sprintf('The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "%s" parameter.', $parameter));
parent::__construct(
sprintf(
'The request is missing a required parameter, includes an invalid parameter value, includes a parameter
more than once, or is otherwise malformed. Check the "%s" parameter.',
$parameter
)
);
}
}

View File

@ -32,6 +32,11 @@ class InvalidScopeException extends OAuthException
public function __construct($parameter)
{
parent::__construct(sprintf('The requested scope is invalid, unknown, or malformed. Check the "%s" scope.', $parameter));
parent::__construct(
sprintf(
'The requested scope is invalid, unknown, or malformed. Check the "%s" scope.',
$parameter
)
);
}
}

View File

@ -29,8 +29,10 @@ class ServerErrorException extends OAuthException
/**
* {@inheritdoc}
*/
public function __construct($parameter = 'The authorization server encountered an unexpected condition which prevented it from fulfilling the request.')
{
public function __construct(
$parameter = 'The authorization server encountered an unexpected condition which prevented it from fulfilling'
. 'the request.'
) {
parent::__construct($parameter);
}
}

View File

@ -32,6 +32,11 @@ class UnsupportedGrantTypeException extends OAuthException
public function __construct($parameter)
{
parent::__construct(sprintf('The authorization grant type "%s" is not supported by the authorization server.', $parameter));
parent::__construct(
sprintf(
'The authorization grant type "%s" is not supported by the authorization server.',
$parameter
)
);
}
}

View File

@ -116,13 +116,15 @@ abstract class AbstractGrant implements GrantTypeInterface
for ($i = 0; $i < count($scopesList); $i++) {
$scopesList[$i] = trim($scopesList[$i]);
if ($scopesList[$i] === '') unset($scopesList[$i]); // Remove any junk scopes
if ($scopesList[$i] === '') {
unset($scopesList[$i]); // Remove any junk scopes
}
}
if (
$this->server->scopeParamRequired() === true &&
$this->server->getDefaultScope() === null &&
count($scopesList) === 0
$this->server->scopeParamRequired() === true
&& $this->server->getDefaultScope() === null
&& count($scopesList) === 0
) {
throw new Exception\InvalidRequestException('scope');
} elseif (count($scopesList) === 0 && $this->server->getDefaultScope() !== null) {
@ -185,5 +187,4 @@ abstract class AbstractGrant implements GrantTypeInterface
* @return array An array of parameters to be passed back to the client
*/
abstract public function completeFlow();
}

View File

@ -164,5 +164,4 @@ class PasswordGrant extends AbstractGrant
return $response;
}
}

View File

@ -173,7 +173,9 @@ class ResourceServer extends AbstractServer
*/
public function isValidRequest($headersOnly = true, $accessToken = null)
{
$accessTokenString = ($accessToken !== null) ? $accessToken : $this->determineAccessToken($headersOnly, $accessToken);
$accessTokenString = ($accessToken !== null)
? $accessToken
: $this->determineAccessToken($headersOnly, $accessToken);
// Set the access token
$this->accessToken = $this->storages['access_token']->get($accessTokenString);

View File

@ -23,7 +23,7 @@ interface ClientInterface
* @param string $clientId The client's ID
* @param string $clientSecret The client's secret (default = "null")
* @param string $redirectUri The client's redirect URI (default = "null")
* @param string $grantType The grant type used in the request (default = "null")
* @param string $grantType The grant type used (default = "null")
* @return League\OAuth2\Server\Entity\ClientEntity
*/
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null);