Merge pull request #657 from thephpleague/analysis-86wPg4

Applied fixes from StyleCI
This commit is contained in:
Alex Bilbie 2016-09-13 15:19:56 +01:00 committed by GitHub
commit 32cde01ab2
11 changed files with 15 additions and 14 deletions

View File

@ -31,7 +31,6 @@ $app->add(
$app->get( $app->get(
'/users', '/users',
function (ServerRequestInterface $request, ResponseInterface $response) use ($app) { function (ServerRequestInterface $request, ResponseInterface $response) use ($app) {
$users = [ $users = [
[ [
'id' => 123, 'id' => 123,

View File

@ -54,19 +54,17 @@ $app->post(
// Try to respond to the access token request // Try to respond to the access token request
return $server->respondToAccessTokenRequest($request, $response); return $server->respondToAccessTokenRequest($request, $response);
} catch (OAuthServerException $exception) { } catch (OAuthServerException $exception) {
// All instances of OAuthServerException can be converted to a PSR-7 response // All instances of OAuthServerException can be converted to a PSR-7 response
return $exception->generateHttpResponse($response); return $exception->generateHttpResponse($response);
} catch (\Exception $exception) { } catch (\Exception $exception) {
// Catch unexpected exceptions // Catch unexpected exceptions
$body = $response->getBody(); $body = $response->getBody();
$body->write($exception->getMessage()); $body->write($exception->getMessage());
return $response->withStatus(500)->withBody($body);
return $response->withStatus(500)->withBody($body);
} }
} }
); );

View File

@ -9,7 +9,6 @@
namespace League\OAuth2\Server\Exception; namespace League\OAuth2\Server\Exception;
class UniqueTokenIdentifierConstraintViolationException extends OAuthServerException class UniqueTokenIdentifierConstraintViolationException extends OAuthServerException
{ {
public static function create() public static function create()

View File

@ -345,6 +345,7 @@ abstract class AbstractGrant implements GrantTypeInterface
$accessToken->setIdentifier($this->generateUniqueIdentifier()); $accessToken->setIdentifier($this->generateUniqueIdentifier());
try { try {
$this->accessTokenRepository->persistNewAccessToken($accessToken); $this->accessTokenRepository->persistNewAccessToken($accessToken);
return $accessToken; return $accessToken;
} catch (UniqueTokenIdentifierConstraintViolationException $e) { } catch (UniqueTokenIdentifierConstraintViolationException $e) {
if ($maxGenerationAttempts === 0) { if ($maxGenerationAttempts === 0) {
@ -391,6 +392,7 @@ abstract class AbstractGrant implements GrantTypeInterface
$authCode->setIdentifier($this->generateUniqueIdentifier()); $authCode->setIdentifier($this->generateUniqueIdentifier());
try { try {
$this->authCodeRepository->persistNewAuthCode($authCode); $this->authCodeRepository->persistNewAuthCode($authCode);
return $authCode; return $authCode;
} catch (UniqueTokenIdentifierConstraintViolationException $e) { } catch (UniqueTokenIdentifierConstraintViolationException $e) {
if ($maxGenerationAttempts === 0) { if ($maxGenerationAttempts === 0) {
@ -420,6 +422,7 @@ abstract class AbstractGrant implements GrantTypeInterface
$refreshToken->setIdentifier($this->generateUniqueIdentifier()); $refreshToken->setIdentifier($this->generateUniqueIdentifier());
try { try {
$this->refreshTokenRepository->persistNewRefreshToken($refreshToken); $this->refreshTokenRepository->persistNewRefreshToken($refreshToken);
return $refreshToken; return $refreshToken;
} catch (UniqueTokenIdentifierConstraintViolationException $e) { } catch (UniqueTokenIdentifierConstraintViolationException $e) {
if ($maxGenerationAttempts === 0) { if ($maxGenerationAttempts === 0) {

View File

@ -66,12 +66,14 @@ class AuthorizationRequest
/** /**
* The code challenge (if provided) * The code challenge (if provided)
*
* @var string * @var string
*/ */
protected $codeChallenge; protected $codeChallenge;
/** /**
* The code challenge method (if provided) * The code challenge method (if provided)
*
* @var string * @var string
*/ */
protected $codeChallengeMethod; protected $codeChallengeMethod;

View File

@ -68,6 +68,7 @@ class BearerTokenResponse extends AbstractResponseType
* this class rather than the default. * this class rather than the default.
* *
* @param AccessTokenEntityInterface $accessToken * @param AccessTokenEntityInterface $accessToken
*
* @return array * @return array
*/ */
protected function getExtraParams(AccessTokenEntityInterface $accessToken) protected function getExtraParams(AccessTokenEntityInterface $accessToken)

View File

@ -137,7 +137,6 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($grant->validateAuthorizationRequest($request) instanceof AuthorizationRequest); $this->assertTrue($grant->validateAuthorizationRequest($request) instanceof AuthorizationRequest);
} }
public function testValidateAuthorizationRequestCodeChallenge() public function testValidateAuthorizationRequestCodeChallenge()
{ {
$client = new ClientEntity(); $client = new ClientEntity();