Failed Conditions
Pull Request — master (#29)
by Helene
03:02
created
src/Middleware/OAuthMiddleware.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
tests/MockOAuth2Server.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
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
                 )
Please login to merge, or discard this patch.
tests/MockOAuthMiddleware.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
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']) &&
Please login to merge, or discard this patch.