@@ -174,7 +174,7 @@ |
||
174 | 174 | * Sign a string with a given key and algorithm. |
175 | 175 | * |
176 | 176 | * @param string $msg The message to sign |
177 | - * @param string|resource $key The secret key |
|
177 | + * @param string $key The secret key |
|
178 | 178 | * @param string $alg The signing algorithm. |
179 | 179 | * Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256' |
180 | 180 | * |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | if ($keyId !== null) { |
157 | 157 | $header['kid'] = $keyId; |
158 | 158 | } |
159 | - if ( isset($head) && is_array($head) ) { |
|
159 | + if (isset($head) && is_array($head)) { |
|
160 | 160 | $header = array_merge($head, $header); |
161 | 161 | } |
162 | 162 | $segments = array(); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | throw new DomainException('Algorithm not supported'); |
189 | 189 | } |
190 | 190 | list($function, $algorithm) = static::$supported_algs[$alg]; |
191 | - switch($function) { |
|
191 | + switch ($function) { |
|
192 | 192 | case 'hash_hmac': |
193 | 193 | return hash_hmac($algorithm, $msg, $key, true); |
194 | 194 | case 'openssl': |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | list($function, $algorithm) = static::$supported_algs[$alg]; |
225 | - switch($function) { |
|
225 | + switch ($function) { |
|
226 | 226 | case 'openssl': |
227 | 227 | $success = openssl_verify($msg, $signature, $key, $algorithm); |
228 | 228 | if (!$success) { |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | * manually detect large ints in the JSON string and quote them (thus converting |
271 | 271 | *them to strings) before decoding, hence the preg_replace() call. |
272 | 272 | */ |
273 | - $max_int_length = strlen((string) PHP_INT_MAX) - 1; |
|
274 | - $json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input); |
|
273 | + $max_int_length = strlen((string)PHP_INT_MAX) - 1; |
|
274 | + $json_without_bigints = preg_replace('/:\s*(-?\d{' . $max_int_length . ',})/', ': "$1"', $input); |
|
275 | 275 | $obj = json_decode($json_without_bigints); |
276 | 276 | } |
277 | 277 |