@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | - * @return HandlerStack |
|
| 61 | + * @return MockHandler |
|
| 62 | 62 | */ |
| 63 | 63 | public function getHandlerStack() |
| 64 | 64 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param RequestInterface $request |
| 70 | 70 | * @param array $options |
| 71 | 71 | * |
| 72 | - * @return array |
|
| 72 | + * @return Response |
|
| 73 | 73 | */ |
| 74 | 74 | protected function getResult(RequestInterface $request, array $options) |
| 75 | 75 | { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param RequestInterface $request |
| 90 | 90 | * @param array $options |
| 91 | 91 | * |
| 92 | - * @return array |
|
| 92 | + * @return Response |
|
| 93 | 93 | */ |
| 94 | 94 | protected function oauth2Token(RequestInterface $request, $options) |
| 95 | 95 | { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | - * @return array |
|
| 117 | + * @return Response |
|
| 118 | 118 | */ |
| 119 | 119 | protected function validTokenResponse() |
| 120 | 120 | { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | /** |
| 137 | 137 | * @param array $requestBody |
| 138 | 138 | * |
| 139 | - * @return array |
|
| 139 | + * @return Response |
|
| 140 | 140 | * The response as expected by the MockHandler. |
| 141 | 141 | */ |
| 142 | 142 | protected function grantTypePassword(array $requestBody) |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * @param array $options |
| 154 | 154 | * |
| 155 | - * @return array |
|
| 155 | + * @return Response |
|
| 156 | 156 | * The response as expected by the MockHandler. |
| 157 | 157 | */ |
| 158 | 158 | protected function grantTypeClientCredentials(array $options) |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** |
| 169 | 169 | * @param array $requestBody |
| 170 | 170 | * |
| 171 | - * @return array |
|
| 171 | + * @return Response |
|
| 172 | 172 | */ |
| 173 | 173 | protected function grantTypeRefreshToken(array $requestBody) |
| 174 | 174 | { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | /** |
| 183 | 183 | * @param array $requestBody |
| 184 | 184 | * |
| 185 | - * @return array |
|
| 185 | + * @return Response |
|
| 186 | 186 | */ |
| 187 | 187 | protected function grantTypeJwtBearer(array $requestBody) |
| 188 | 188 | { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /** |
| 197 | 197 | * @param RequestInterface $request |
| 198 | 198 | * |
| 199 | - * @return array |
|
| 199 | + * @return Response |
|
| 200 | 200 | */ |
| 201 | 201 | protected function mockApiCall(RequestInterface $request) |
| 202 | 202 | { |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace CommerceGuys\Guzzle\Oauth2\Tests; |
| 4 | 4 | |
| 5 | 5 | |
| 6 | -use GuzzleHttp\Exception\RequestException; |
|
| 7 | 6 | use GuzzleHttp\Handler\MockHandler; |
| 8 | 7 | use GuzzleHttp\HandlerStack; |
| 9 | 8 | use GuzzleHttp\Psr7\Response; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | array_fill( |
| 48 | 48 | 0, |
| 49 | 49 | $this->options[self::KEY_EXPECTED_QUERY_COUNT], |
| 50 | - function (RequestInterface $request, array $options) { |
|
| 50 | + function(RequestInterface $request, array $options) { |
|
| 51 | 51 | return $this->getResult($request, $options); |
| 52 | 52 | } |
| 53 | 53 | ) |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | use CommerceGuys\Guzzle\Oauth2\Tests\MockOAuth2Server; |
| 10 | 10 | use CommerceGuys\Guzzle\Oauth2\Tests\MockOAuthMiddleware; |
| 11 | 11 | use CommerceGuys\Guzzle\Oauth2\Tests\TestBase; |
| 12 | -use GuzzleHttp\HandlerStack; |
|
| 13 | 12 | use GuzzleHttp\RequestOptions; |
| 14 | 13 | use Psr\Http\Message\ResponseInterface; |
| 15 | 14 | |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function onBefore() |
| 58 | 58 | { |
| 59 | - return function (callable $handler) { |
|
| 60 | - return function (RequestInterface $request, array $options) use ($handler) { |
|
| 59 | + return function(callable $handler) { |
|
| 60 | + return function(RequestInterface $request, array $options) use ($handler) { |
|
| 61 | 61 | if ( |
| 62 | 62 | isset($options['auth']) && |
| 63 | 63 | 'oauth2' == $options['auth'] && |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | ) { |
| 67 | 67 | $token = $this->getAccessToken(); |
| 68 | 68 | if ($token !== null) { |
| 69 | - return $handler($request->withAddedHeader('Authorization', 'Bearer '.$token->getToken()), $options); |
|
| 69 | + return $handler($request->withAddedHeader('Authorization', 'Bearer ' . $token->getToken()), $options); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $calls = 0; |
| 81 | 81 | |
| 82 | - return function (callable $handler) use (&$calls, $limit) { |
|
| 83 | - return function (RequestInterface $request, array $options) use ($handler, &$calls, $limit) { |
|
| 82 | + return function(callable $handler) use (&$calls, $limit) { |
|
| 83 | + return function(RequestInterface $request, array $options) use ($handler, &$calls, $limit) { |
|
| 84 | 84 | /* @var PromiseInterface */ |
| 85 | 85 | $promise = $handler($request, $options); |
| 86 | 86 | |
| 87 | 87 | return $promise->then( |
| 88 | - function (ResponseInterface $response) use ($request, $options, &$calls, $limit) { |
|
| 88 | + function(ResponseInterface $response) use ($request, $options, &$calls, $limit) { |
|
| 89 | 89 | if ( |
| 90 | 90 | $response->getStatusCode() == 401 && |
| 91 | 91 | isset($options['auth']) && |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if ($token = $this->getAccessToken()) { |
| 102 | - $response = $this->client->send($request->withHeader('Authorization', 'Bearer '.$token->getToken()), $options); |
|
| 102 | + $response = $this->client->send($request->withHeader('Authorization', 'Bearer ' . $token->getToken()), $options); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -50,12 +50,12 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $calls = 0; |
| 52 | 52 | |
| 53 | - return function (callable $handler) use (&$calls) { |
|
| 54 | - return function (RequestInterface $request, array $options) use ($handler, &$calls) { |
|
| 53 | + return function(callable $handler) use (&$calls) { |
|
| 54 | + return function(RequestInterface $request, array $options) use ($handler, &$calls) { |
|
| 55 | 55 | /** @var PromiseInterface */ |
| 56 | 56 | $promise = $handler($request, $options); |
| 57 | 57 | return $promise->then( |
| 58 | - function (ResponseInterface $response) use ($request, $options, &$calls) { |
|
| 58 | + function(ResponseInterface $response) use ($request, $options, &$calls) { |
|
| 59 | 59 | if ( |
| 60 | 60 | isset($this->options[self::KEY_TOKEN_EXPIRED_ON_FAILURE_COUNT]) && |
| 61 | 61 | isset($options['auth']) && |