From 5d3516c7b488d5ba498d62e55cd50978ee7959c7 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 10 Apr 2016 06:48:46 -0400 Subject: [PATCH] Applied fixes from StyleCI --- examples/public/auth_code.php | 1 + src/Grant/AbstractGrant.php | 6 +++--- src/Grant/AuthCodeGrant.php | 7 +++---- src/RequestTypes/AuthorizationRequest.php | 12 +++++++++--- src/Server.php | 3 ++- tests/ResponseTypes/BearerResponseTypeTest.php | 5 ++--- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/examples/public/auth_code.php b/examples/public/auth_code.php index 1e517e13..12f7cc49 100644 --- a/examples/public/auth_code.php +++ b/examples/public/auth_code.php @@ -81,6 +81,7 @@ $app->get('/authorize', function (ServerRequestInterface $request, ResponseInter } catch (\Exception $exception) { $body = new Stream('php://temp', 'r+'); $body->write($exception->getMessage()); + return $response->withStatus(500)->withBody($body); } }); diff --git a/src/Grant/AbstractGrant.php b/src/Grant/AbstractGrant.php index 739fb1c5..e2caed89 100644 --- a/src/Grant/AbstractGrant.php +++ b/src/Grant/AbstractGrant.php @@ -406,7 +406,7 @@ abstract class AbstractGrant implements GrantTypeInterface } /** - * @inheritdoc + * {@inheritdoc} */ public function canRespondToAuthorizationRequest(ServerRequestInterface $request) { @@ -414,7 +414,7 @@ abstract class AbstractGrant implements GrantTypeInterface } /** - * @inheritdoc + * {@inheritdoc} */ public function validateAuthorizationRequest(ServerRequestInterface $request) { @@ -422,7 +422,7 @@ abstract class AbstractGrant implements GrantTypeInterface } /** - * @inheritdoc + * {@inheritdoc} */ public function completeAuthorizationRequest(AuthorizationRequest $authorizationRequest) { diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index 6f580168..a4cf5dd1 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -132,7 +132,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant } /** - * @inheritdoc + * {@inheritdoc} */ public function canRespondToAuthorizationRequest(ServerRequestInterface $request) { @@ -144,7 +144,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant } /** - * @inheritdoc + * {@inheritdoc} */ public function validateAuthorizationRequest(ServerRequestInterface $request) { @@ -203,7 +203,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant } /** - * @inheritdoc + * {@inheritdoc} */ public function completeAuthorizationRequest(AuthorizationRequest $authorizationRequest) { @@ -219,7 +219,6 @@ class AuthCodeGrant extends AbstractAuthorizeGrant // The user approved the client, redirect them back with an auth code if ($authorizationRequest->isAuthorizationApproved() === true) { - $authCode = $this->issueAuthCode( $this->authCodeTTL, $authorizationRequest->getClient(), diff --git a/src/RequestTypes/AuthorizationRequest.php b/src/RequestTypes/AuthorizationRequest.php index 06a06672..031c58b2 100644 --- a/src/RequestTypes/AuthorizationRequest.php +++ b/src/RequestTypes/AuthorizationRequest.php @@ -10,42 +10,49 @@ class AuthorizationRequest { /** * The grant type identifier + * * @var string */ protected $grantTypeId; /** * The client identifier + * * @var ClientEntityInterface */ protected $client; /** * The user identifier + * * @var UserEntityInterface */ protected $user; /** * An array of scope identifiers + * * @var ScopeEntityInterface[] */ protected $scopes = []; /** * Has the user authorized the authorization request + * * @var bool */ protected $authorizationApproved = false; /** * The redirect URI used in the request + * * @var string */ protected $redirectUri; /** * The state parameter on the authorization request + * * @var string */ protected $state; @@ -115,7 +122,7 @@ class AuthorizationRequest } /** - * @return boolean + * @return bool */ public function isAuthorizationApproved() { @@ -123,7 +130,7 @@ class AuthorizationRequest } /** - * @param boolean $authorizationApproved + * @param bool $authorizationApproved */ public function setAuthorizationApproved($authorizationApproved) { @@ -161,5 +168,4 @@ class AuthorizationRequest { $this->state = $state; } - } diff --git a/src/Server.php b/src/Server.php index f6c388c7..48448b5e 100644 --- a/src/Server.php +++ b/src/Server.php @@ -130,8 +130,9 @@ class Server implements EmitterAwareInterface * * @param \Psr\Http\Message\ServerRequestInterface $request * - * @return \League\OAuth2\Server\RequestTypes\AuthorizationRequest|null * @throws \League\OAuth2\Server\Exception\OAuthServerException + * + * @return \League\OAuth2\Server\RequestTypes\AuthorizationRequest|null */ public function validateAuthorizationRequest(ServerRequestInterface $request) { diff --git a/tests/ResponseTypes/BearerResponseTypeTest.php b/tests/ResponseTypes/BearerResponseTypeTest.php index 1014aa73..6c84e148 100644 --- a/tests/ResponseTypes/BearerResponseTypeTest.php +++ b/tests/ResponseTypes/BearerResponseTypeTest.php @@ -3,16 +3,15 @@ namespace LeagueTests\ResponseTypes; use League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator; -use League\OAuth2\Server\Exception\OAuthServerException; - use League\OAuth2\Server\CryptKey; +use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; use League\OAuth2\Server\ResponseTypes\BearerTokenResponse; +use LeagueTests\Stubs\AccessTokenEntity; use LeagueTests\Stubs\ClientEntity; use LeagueTests\Stubs\RefreshTokenEntity; use LeagueTests\Stubs\ScopeEntity; use Psr\Http\Message\ResponseInterface; -use LeagueTests\Stubs\AccessTokenEntity; use Zend\Diactoros\Response; use Zend\Diactoros\ServerRequest;