@@ -112,8 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $key = new Key(); |
| 114 | 114 | $public_key = $key->get($this->jwt['UAPAY_pubkey']); |
| 115 | - } |
|
| 116 | - catch (\Exception $e) |
|
| 115 | + } catch (\Exception $e) |
|
| 117 | 116 | { |
| 118 | 117 | throw new Exception\Runtime('The file with the public key was '.$e->getMessage().'!'); |
| 119 | 118 | } |
@@ -133,8 +132,7 @@ discard block |
||
| 133 | 132 | try |
| 134 | 133 | { |
| 135 | 134 | $decoded = (array) JWT::decode($token, $this->uapay_public_key(), array('RS512')); |
| 136 | - } |
|
| 137 | - catch (\Exception $e) |
|
| 135 | + } catch (\Exception $e) |
|
| 138 | 136 | { |
| 139 | 137 | Log::instance()->error($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
| 140 | 138 | throw new Exception\JSON('unable to decode JWT token', $e); |
@@ -140,7 +140,9 @@ discard block |
||
| 140 | 140 | $payload['iat'] = $this->get_param_iat(); |
| 141 | 141 | $ar['token'] = $this->token_encode($payload); |
| 142 | 142 | |
| 143 | - if (isset($ar['data'])) unset($ar['data']); |
|
| 143 | + if (isset($ar['data'])) { |
|
| 144 | + unset($ar['data']); |
|
| 145 | + } |
|
| 144 | 146 | } |
| 145 | 147 | $json = json_encode($ar, JSON_UNESCAPED_SLASHES); |
| 146 | 148 | |
@@ -162,8 +164,7 @@ discard block |
||
| 162 | 164 | { |
| 163 | 165 | $key = new Key(); |
| 164 | 166 | $private_key = $key->get($this->jwt['our_privkey']); |
| 165 | - } |
|
| 166 | - catch (\Exception $e) |
|
| 167 | + } catch (\Exception $e) |
|
| 167 | 168 | { |
| 168 | 169 | throw new Exception\Runtime('The file with the private key was '.$e->getMessage().'!'); |
| 169 | 170 | } |
@@ -185,8 +186,7 @@ discard block |
||
| 185 | 186 | try |
| 186 | 187 | { |
| 187 | 188 | $token = JWT::encode($payload, $this->own_private_key(), 'RS512'); |
| 188 | - } |
|
| 189 | - catch (\Exception $e) |
|
| 189 | + } catch (\Exception $e) |
|
| 190 | 190 | { |
| 191 | 191 | Log::instance()->error($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
| 192 | 192 | throw new Exception\JSON('unable to create JWT token', $e); |
@@ -216,8 +216,7 @@ discard block |
||
| 216 | 216 | $body = $httpresponse->getBody()->getContents(); |
| 217 | 217 | Log::instance()->debug('got response:'.PHP_EOL.$body); |
| 218 | 218 | $response = new $this->response_class($body, $this->jwt); |
| 219 | - } |
|
| 220 | - catch (\GuzzleHttp\Exception\TransferException $e) |
|
| 219 | + } catch (\GuzzleHttp\Exception\TransferException $e) |
|
| 221 | 220 | { |
| 222 | 221 | Log::instance()->debug('request:'.PHP_EOL.\GuzzleHttp\Psr7\str($e->getRequest())); |
| 223 | 222 | if ($e->hasResponse()) { |