@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | protected function run($argument) { |
| 141 | 141 | $target = $argument['url']; |
| 142 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); |
|
| 142 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); |
|
| 143 | 143 | $currentTime = $this->time->getTime(); |
| 144 | 144 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
| 145 | 145 | $source = rtrim($source, '/'); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
| 158 | 158 | |
| 159 | 159 | // make sure that we have a well formated url |
| 160 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
| 160 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
| 161 | 161 | |
| 162 | 162 | try { |
| 163 | 163 | $result = $this->httpClient->post( |
@@ -177,16 +177,16 @@ discard block |
||
| 177 | 177 | } catch (ClientException $e) { |
| 178 | 178 | $status = $e->getCode(); |
| 179 | 179 | if ($status === Http::STATUS_FORBIDDEN) { |
| 180 | - $this->logger->info($target . ' refused to ask for a shared secret.', ['app' => 'federation']); |
|
| 180 | + $this->logger->info($target.' refused to ask for a shared secret.', ['app' => 'federation']); |
|
| 181 | 181 | } else { |
| 182 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); |
|
| 182 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']); |
|
| 183 | 183 | } |
| 184 | 184 | } catch (RequestException $e) { |
| 185 | 185 | $status = -1; // There is no status code if we could not connect |
| 186 | - $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); |
|
| 186 | + $this->logger->info('Could not connect to '.$target, ['app' => 'federation']); |
|
| 187 | 187 | } catch (RingException $e) { |
| 188 | 188 | $status = -1; // There is no status code if we could not connect |
| 189 | - $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); |
|
| 189 | + $this->logger->info('Could not connect to '.$target, ['app' => 'federation']); |
|
| 190 | 190 | } catch (\Exception $e) { |
| 191 | 191 | $status = Http::STATUS_INTERNAL_SERVER_ERROR; |
| 192 | 192 | $this->logger->logException($e, ['app' => 'federation']); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | protected function reAddJob(array $argument) { |
| 210 | 210 | $url = $argument['url']; |
| 211 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); |
|
| 211 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); |
|
| 212 | 212 | $token = $argument['token']; |
| 213 | 213 | |
| 214 | 214 | $this->jobList->add( |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | protected function run($argument) { |
| 142 | 142 | $target = $argument['url']; |
| 143 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); |
|
| 143 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); |
|
| 144 | 144 | $currentTime = $this->time->getTime(); |
| 145 | 145 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
| 146 | 146 | $source = rtrim($source, '/'); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $deadline = $currentTime - $this->maxLifespan; |
| 151 | 151 | if ($created < $deadline) { |
| 152 | 152 | $this->retainJob = false; |
| 153 | - $this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE); |
|
| 153 | + $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
|
| 154 | 154 | return; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
| 159 | 159 | |
| 160 | 160 | // make sure that we have a well formatted url |
| 161 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
| 161 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
| 162 | 162 | |
| 163 | 163 | $result = null; |
| 164 | 164 | try { |
@@ -180,21 +180,21 @@ discard block |
||
| 180 | 180 | } catch (ClientException $e) { |
| 181 | 181 | $status = $e->getCode(); |
| 182 | 182 | if ($status === Http::STATUS_FORBIDDEN) { |
| 183 | - $this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
| 183 | + $this->logger->info($target.' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
| 184 | 184 | } else { |
| 185 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); |
|
| 185 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']); |
|
| 186 | 186 | } |
| 187 | 187 | } catch (RequestException $e) { |
| 188 | 188 | $status = -1; // There is no status code if we could not connect |
| 189 | 189 | $this->logger->logException($e, [ |
| 190 | - 'message' => 'Could not connect to ' . $target, |
|
| 190 | + 'message' => 'Could not connect to '.$target, |
|
| 191 | 191 | 'level' => ILogger::INFO, |
| 192 | 192 | 'app' => 'federation', |
| 193 | 193 | ]); |
| 194 | 194 | } catch (RingException $e) { |
| 195 | 195 | $status = -1; // There is no status code if we could not connect |
| 196 | 196 | $this->logger->logException($e, [ |
| 197 | - 'message' => 'Could not connect to ' . $target, |
|
| 197 | + 'message' => 'Could not connect to '.$target, |
|
| 198 | 198 | 'level' => ILogger::INFO, |
| 199 | 199 | 'app' => 'federation', |
| 200 | 200 | ]); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ); |
| 222 | 222 | } else { |
| 223 | 223 | $this->logger->error( |
| 224 | - 'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body, |
|
| 224 | + 'remote server "'.$target.'"" does not return a valid shared secret. Received data: '.$body, |
|
| 225 | 225 | ['app' => 'federation'] |
| 226 | 226 | ); |
| 227 | 227 | $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | protected function reAddJob(array $argument) { |
| 238 | 238 | $url = $argument['url']; |
| 239 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime(); |
|
| 239 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->time->getTime(); |
|
| 240 | 240 | $token = $argument['token']; |
| 241 | 241 | $this->jobList->add( |
| 242 | 242 | GetSharedSecret::class, |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $token = $argument['token']; |
| 85 | 85 | $action = $argument['action']; |
| 86 | 86 | $data = json_decode($argument['data'], true); |
| 87 | - $try = (int)$argument['try'] + 1; |
|
| 87 | + $try = (int) $argument['try'] + 1; |
|
| 88 | 88 | |
| 89 | 89 | $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); |
| 90 | 90 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | 'token' => $argument['token'], |
| 108 | 108 | 'data' => $argument['data'], |
| 109 | 109 | 'action' => $argument['action'], |
| 110 | - 'try' => (int)$argument['try'] + 1, |
|
| 110 | + 'try' => (int) $argument['try'] + 1, |
|
| 111 | 111 | 'lastRun' => $this->time->getTime() |
| 112 | 112 | ] |
| 113 | 113 | ); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
| 122 | 122 | protected function shouldRun(array $argument) { |
| 123 | - $lastRun = (int)$argument['lastRun']; |
|
| 123 | + $lastRun = (int) $argument['lastRun']; |
|
| 124 | 124 | return (($this->time->getTime() - $lastRun) > $this->interval); |
| 125 | 125 | } |
| 126 | 126 | } |