@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | protected function run($argument) { |
| 156 | 156 | $target = $argument['url']; |
| 157 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
| 157 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
| 158 | 158 | $currentTime = $this->timeFactory->getTime(); |
| 159 | 159 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
| 160 | 160 | $source = rtrim($source, '/'); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $deadline = $currentTime - $this->maxLifespan; |
| 165 | 165 | if ($created < $deadline) { |
| 166 | 166 | $this->retainJob = false; |
| 167 | - $this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE); |
|
| 167 | + $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
|
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
| 173 | 173 | |
| 174 | 174 | // make sure that we have a well formatted url |
| 175 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
| 175 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
| 176 | 176 | |
| 177 | 177 | $result = null; |
| 178 | 178 | try { |
@@ -195,21 +195,21 @@ discard block |
||
| 195 | 195 | } catch (ClientException $e) { |
| 196 | 196 | $status = $e->getCode(); |
| 197 | 197 | if ($status === Http::STATUS_FORBIDDEN) { |
| 198 | - $this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
| 198 | + $this->logger->info($target.' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
| 199 | 199 | } else { |
| 200 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); |
|
| 200 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']); |
|
| 201 | 201 | } |
| 202 | 202 | } catch (RequestException $e) { |
| 203 | 203 | $status = -1; // There is no status code if we could not connect |
| 204 | 204 | $this->logger->logException($e, [ |
| 205 | - 'message' => 'Could not connect to ' . $target, |
|
| 205 | + 'message' => 'Could not connect to '.$target, |
|
| 206 | 206 | 'level' => \OCP\Util::INFO, |
| 207 | 207 | 'app' => 'federation', |
| 208 | 208 | ]); |
| 209 | 209 | } catch (RingException $e) { |
| 210 | 210 | $status = -1; // There is no status code if we could not connect |
| 211 | 211 | $this->logger->logException($e, [ |
| 212 | - 'message' => 'Could not connect to ' . $target, |
|
| 212 | + 'message' => 'Could not connect to '.$target, |
|
| 213 | 213 | 'level' => \OCP\Util::INFO, |
| 214 | 214 | 'app' => 'federation', |
| 215 | 215 | ]); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | ); |
| 237 | 237 | } else { |
| 238 | 238 | $this->logger->error( |
| 239 | - 'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body, |
|
| 239 | + 'remote server "'.$target.'"" does not return a valid shared secret. Received data: '.$body, |
|
| 240 | 240 | ['app' => 'federation'] |
| 241 | 241 | ); |
| 242 | 242 | $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | protected function reAddJob(array $argument) { |
| 254 | 254 | $url = $argument['url']; |
| 255 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
| 255 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
| 256 | 256 | $token = $argument['token']; |
| 257 | 257 | $this->jobList->add( |
| 258 | 258 | GetSharedSecret::class, |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @package OCA\Federation\Controller |
| 49 | 49 | */ |
| 50 | -class OCSAuthAPIController extends OCSController{ |
|
| 50 | +class OCSAuthAPIController extends OCSController { |
|
| 51 | 51 | |
| 52 | 52 | /** @var ISecureRandom */ |
| 53 | 53 | private $secureRandom; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function requestSharedSecret($url, $token) { |
| 145 | 145 | if ($this->trustedServers->isTrustedServer($url) === false) { |
| 146 | - $this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']); |
|
| 146 | + $this->logger->error('remote server not trusted ('.$url.') while requesting shared secret', ['app' => 'federation']); |
|
| 147 | 147 | throw new OCSForbiddenException(); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $localToken = $this->dbHandler->getToken($url); |
| 153 | 153 | if (strcmp($localToken, $token) > 0) { |
| 154 | 154 | $this->logger->info( |
| 155 | - 'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.', |
|
| 155 | + 'remote server ('.$url.') presented lower token. We will initiate the exchange of the shared secret.', |
|
| 156 | 156 | ['app' => 'federation'] |
| 157 | 157 | ); |
| 158 | 158 | throw new OCSForbiddenException(); |
@@ -184,14 +184,14 @@ discard block |
||
| 184 | 184 | public function getSharedSecret($url, $token) { |
| 185 | 185 | |
| 186 | 186 | if ($this->trustedServers->isTrustedServer($url) === false) { |
| 187 | - $this->logger->error('remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']); |
|
| 187 | + $this->logger->error('remote server not trusted ('.$url.') while getting shared secret', ['app' => 'federation']); |
|
| 188 | 188 | throw new OCSForbiddenException(); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if ($this->isValidToken($url, $token) === false) { |
| 192 | 192 | $expectedToken = $this->dbHandler->getToken($url); |
| 193 | 193 | $this->logger->error( |
| 194 | - 'remote server (' . $url . ') didn\'t send a valid token (got "' . $token . '" but expected "'. $expectedToken . '") while getting shared secret', |
|
| 194 | + 'remote server ('.$url.') didn\'t send a valid token (got "'.$token.'" but expected "'.$expectedToken.'") while getting shared secret', |
|
| 195 | 195 | ['app' => 'federation'] |
| 196 | 196 | ); |
| 197 | 197 | throw new OCSForbiddenException(); |