@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return string|null |
37 | 37 | */ |
38 | - public function getPublicKey() :? string |
|
38 | + public function getPublicKey() : ? string |
|
39 | 39 | { |
40 | 40 | return $this->publicKey; |
41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return string|null |
47 | 47 | */ |
48 | - public function getSecretKey() :? string |
|
48 | + public function getSecretKey() : ? string |
|
49 | 49 | { |
50 | 50 | return $this->secretKey; |
51 | 51 | } |
@@ -232,7 +232,7 @@ |
||
232 | 232 | * @param string $date |
233 | 233 | * @return int|boolean |
234 | 234 | */ |
235 | - private function getTimeDrift(string $date) :? int |
|
235 | + private function getTimeDrift(string $date) : ? int |
|
236 | 236 | { |
237 | 237 | $now = new \DateTime(); |
238 | 238 | $now->format(\DateTime::RFC1123); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | final class Authentication extends AbstractAuthentication |
9 | 9 | { |
10 | - protected function getTokenFromAccessToken(string $accessToken) :? Token |
|
10 | + protected function getTokenFromAccessToken(string $accessToken) : ? Token |
|
11 | 11 | { |
12 | 12 | // Return a fixed token |
13 | 13 | return new Token( |
@@ -113,7 +113,7 @@ |
||
113 | 113 | * @param string $accessToken |
114 | 114 | * @return \ncryptf\Token |
115 | 115 | */ |
116 | - abstract protected function getTokenFromAccessToken(string $accessToken) :? Token; |
|
116 | + abstract protected function getTokenFromAccessToken(string $accessToken) : ? Token; |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Given a particular token, returns an object, array, or integer representing the user |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $response = Dispatcher::run( |
34 | 34 | [ |
35 | 35 | new Authentication, |
36 | - function ($request, $next) { |
|
36 | + function($request, $next) { |
|
37 | 37 | $this->assertInstanceOf('\ncryptf\Token', $request->getAttribute('ncryptf-token')); |
38 | 38 | $this->assertEquals(true, \is_array($request->getAttribute('ncryptf-user'))); |
39 | 39 | return $next->handle($request); |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | ->withHeader('Authorization', $auth->getHeader()) |
44 | 44 | ->withHeader('Content-Type', 'application/json') |
45 | 45 | ->withHeader('Accept', 'application/json') |
46 | - ->withBody((function () use ($params) { |
|
46 | + ->withBody((function() use ($params) { |
|
47 | 47 | $stream = fopen('php://memory', 'r+'); |
48 | - fwrite($stream, \is_array($params[2]) ? \json_encode($params[2]): $params[2]); |
|
48 | + fwrite($stream, \is_array($params[2]) ? \json_encode($params[2]) : $params[2]); |
|
49 | 49 | rewind($stream); |
50 | 50 | return new \Zend\Diactoros\Stream($stream); |
51 | 51 | })()) |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $response = Dispatcher::run( |
62 | 62 | [ |
63 | 63 | new Authentication, |
64 | - function ($request, $next) { |
|
64 | + function($request, $next) { |
|
65 | 65 | return new JsonResponse(['foo' => 'bar']); |
66 | 66 | } |
67 | 67 | ], |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | [ |
146 | 146 | new JsonRequestParser($cache), |
147 | 147 | new Authentication, |
148 | - function ($request, $next) use ($params) { |
|
148 | + function($request, $next) use ($params) { |
|
149 | 149 | $this->assertInstanceOf('\ncryptf\Token', $request->getAttribute('ncryptf-token')); |
150 | 150 | $this->assertEquals(true, \is_array($request->getAttribute('ncryptf-user'))); |
151 | 151 | return $next->handle($request); |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | ->withHeader('Accept', 'application/vnd.ncryptf+json') |
160 | 160 | ->withHeader('X-HashId', $serverKey->getHashIdentifier()) |
161 | 161 | ->withHeader('X-PubKey', \base64_encode($myKey->getBoxPublicKey())) |
162 | - ->withBody((function () use ($params, $serverKey, $myKey, $token) { |
|
163 | - $data = \is_array($params[2]) ? \json_encode($params[2]): $params[2]; |
|
162 | + ->withBody((function() use ($params, $serverKey, $myKey, $token) { |
|
163 | + $data = \is_array($params[2]) ? \json_encode($params[2]) : $params[2]; |
|
164 | 164 | |
165 | 165 | if (!empty($params[2])) { |
166 | 166 | $request = new Request( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | ->withHeader('Accept', 'application/vnd.ncryptf+json') |
219 | 219 | ->withHeader('X-HashId', $serverKey->getHashIdentifier()) |
220 | 220 | ->withHeader('X-PubKey', \base64_encode($myKey->getBoxPublicKey())) |
221 | - ->withBody((function () use ($params, $serverKey, $myKey, $token) { |
|
222 | - $data = \is_array($params[2]) ? \json_encode($params[2]): $params[2]; |
|
221 | + ->withBody((function() use ($params, $serverKey, $myKey, $token) { |
|
222 | + $data = \is_array($params[2]) ? \json_encode($params[2]) : $params[2]; |
|
223 | 223 | |
224 | 224 | if (!empty($params[2])) { |
225 | 225 | $request = new Request( |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | [ |
270 | 270 | new JsonRequestParser($cache), |
271 | 271 | new Authentication, |
272 | - function ($request, $next) { |
|
272 | + function($request, $next) { |
|
273 | 273 | $this->assertInstanceOf('\ncryptf\Token', $request->getAttribute('ncryptf-token')); |
274 | 274 | $this->assertEquals(true, \is_array($request->getAttribute('ncryptf-user'))); |
275 | 275 | return $next->handle($request); |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | ->withHeader('X-HashId', $serverKey->getHashIdentifier()) |
285 | 285 | ->withHeader('X-Nonce', \base64_encode($nonce)) |
286 | 286 | ->withHeader('X-PubKey', \base64_encode($myKey->getBoxPublicKey())) |
287 | - ->withBody((function () use ($params, $serverKey, $myKey, $nonce, $token) { |
|
288 | - $data = \is_array($params[2]) ? \json_encode($params[2]): $params[2]; |
|
287 | + ->withBody((function() use ($params, $serverKey, $myKey, $nonce, $token) { |
|
288 | + $data = \is_array($params[2]) ? \json_encode($params[2]) : $params[2]; |
|
289 | 289 | |
290 | 290 | $request = new Request( |
291 | 291 | $myKey->getBoxSecretKey(), |
@@ -81,7 +81,7 @@ |
||
81 | 81 | * @param int $version |
82 | 82 | * @return string|null |
83 | 83 | */ |
84 | - private function decryptRequest(EncryptionKeyInterface $key, ServerRequestInterface $request, string $rawBody, int $version) :? string |
|
84 | + private function decryptRequest(EncryptionKeyInterface $key, ServerRequestInterface $request, string $rawBody, int $version) : ? string |
|
85 | 85 | { |
86 | 86 | static $response = null; |
87 | 87 | static $nonce = null; |