@@ -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 |
@@ -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; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $response = Dispatcher::run( |
37 | 37 | [ |
38 | 38 | new Authentication, |
39 | - function ($request, $next) { |
|
39 | + function($request, $next) { |
|
40 | 40 | $this->assertInstanceOf('\ncryptf\Token', $request->getAttribute('ncryptf-token')); |
41 | 41 | $this->assertEquals(true, \is_array($request->getAttribute('ncryptf-user'))); |
42 | 42 | return $next->handle($request); |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | ->withHeader('Authorization', $auth->getHeader()) |
47 | 47 | ->withHeader('Content-Type', 'application/json') |
48 | 48 | ->withHeader('Accept', 'application/json') |
49 | - ->withBody((function () use ($params) { |
|
49 | + ->withBody((function() use ($params) { |
|
50 | 50 | $stream = fopen('php://memory', 'r+'); |
51 | - fwrite($stream, \is_array($params[2]) ? \json_encode($params[2]): $params[2]); |
|
51 | + fwrite($stream, \is_array($params[2]) ? \json_encode($params[2]) : $params[2]); |
|
52 | 52 | rewind($stream); |
53 | 53 | return new \Zend\Diactoros\Stream($stream); |
54 | 54 | })()) |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | [ |
74 | 74 | new RequestParser($cache), |
75 | 75 | new Authentication, |
76 | - function ($request, $next) use ($params) { |
|
76 | + function($request, $next) use ($params) { |
|
77 | 77 | $this->assertInstanceOf('\ncryptf\Token', $request->getAttribute('ncryptf-token')); |
78 | 78 | $this->assertEquals(true, \is_array($request->getAttribute('ncryptf-user'))); |
79 | 79 | return $next->handle($request); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | ->withHeader('Accept', 'application/vnd.ncryptf+json') |
88 | 88 | ->withHeader('X-HashId', $serverKey->getHashIdentifier()) |
89 | 89 | ->withHeader('X-PubKey', \base64_encode($myKey->getBoxPublicKey())) |
90 | - ->withBody((function () use ($params, $serverKey, $myKey, $token) { |
|
91 | - $data = \is_array($params[2]) ? \json_encode($params[2]): $params[2]; |
|
90 | + ->withBody((function() use ($params, $serverKey, $myKey, $token) { |
|
91 | + $data = \is_array($params[2]) ? \json_encode($params[2]) : $params[2]; |
|
92 | 92 | |
93 | 93 | if (!empty($params[2])) { |
94 | 94 | $request = new Request( |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | [ |
139 | 139 | new RequestParser($cache), |
140 | 140 | new Authentication, |
141 | - function ($request, $next) { |
|
141 | + function($request, $next) { |
|
142 | 142 | $this->assertInstanceOf('\ncryptf\Token', $request->getAttribute('ncryptf-token')); |
143 | 143 | $this->assertEquals(true, \is_array($request->getAttribute('ncryptf-user'))); |
144 | 144 | return $next->handle($request); |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | ->withHeader('X-HashId', $serverKey->getHashIdentifier()) |
154 | 154 | ->withHeader('X-Nonce', \base64_encode($nonce)) |
155 | 155 | ->withHeader('X-PubKey', \base64_encode($myKey->getBoxPublicKey())) |
156 | - ->withBody((function () use ($params, $serverKey, $myKey, $nonce, $token) { |
|
157 | - $data = \is_array($params[2]) ? \json_encode($params[2]): $params[2]; |
|
156 | + ->withBody((function() use ($params, $serverKey, $myKey, $nonce, $token) { |
|
157 | + $data = \is_array($params[2]) ? \json_encode($params[2]) : $params[2]; |
|
158 | 158 | |
159 | 159 | $request = new Request( |
160 | 160 | $myKey->getBoxSecretKey(), |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $response = Dispatcher::run( |
206 | 206 | [ |
207 | 207 | new Authentication, |
208 | - function ($request, $next) { |
|
208 | + function($request, $next) { |
|
209 | 209 | return new JsonResponse(['foo' => 'bar']); |
210 | 210 | } |
211 | 211 | ], |