@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | |
403 | 403 | $this->htmlBody .= vsprintf($this->heading, [htmlspecialchars($title)]); |
404 | 404 | if ($plainTitle !== false) { |
405 | - $this->plainBody .= $plainTitle . PHP_EOL . PHP_EOL; |
|
405 | + $this->plainBody .= $plainTitle.PHP_EOL.PHP_EOL; |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | |
439 | 439 | $this->htmlBody .= vsprintf($this->bodyText, [$text]); |
440 | 440 | if ($plainText !== false) { |
441 | - $this->plainBody .= $plainText . PHP_EOL . PHP_EOL; |
|
441 | + $this->plainBody .= $plainText.PHP_EOL.PHP_EOL; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
@@ -468,18 +468,18 @@ discard block |
||
468 | 468 | |
469 | 469 | $htmlText = $text; |
470 | 470 | if ($metaInfo) { |
471 | - $htmlText = '<em style="color:#777;">' . $metaInfo . '</em><br>' . $htmlText; |
|
471 | + $htmlText = '<em style="color:#777;">'.$metaInfo.'</em><br>'.$htmlText; |
|
472 | 472 | } |
473 | 473 | if ($icon !== '') { |
474 | - $icon = '<img src="' . htmlspecialchars($icon) . '" alt="•">'; |
|
474 | + $icon = '<img src="'.htmlspecialchars($icon).'" alt="•">'; |
|
475 | 475 | } else { |
476 | 476 | $icon = '•'; |
477 | 477 | } |
478 | 478 | $this->htmlBody .= vsprintf($this->listItem, [$icon, $htmlText]); |
479 | 479 | if ($plainText !== false) { |
480 | - $this->plainBody .= ' * ' . $plainText; |
|
480 | + $this->plainBody .= ' * '.$plainText; |
|
481 | 481 | if ($plainMetaInfo !== false) { |
482 | - $this->plainBody .= ' (' . $plainMetaInfo . ')'; |
|
482 | + $this->plainBody .= ' ('.$plainMetaInfo.')'; |
|
483 | 483 | } |
484 | 484 | $this->plainBody .= PHP_EOL; |
485 | 485 | } |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | $textColor = $this->themingDefaults->getTextColorPrimary(); |
541 | 541 | |
542 | 542 | $this->htmlBody .= vsprintf($this->buttonGroup, [$color, $color, $urlLeft, $color, $textColor, $textColor, $textLeft, $urlRight, $textRight]); |
543 | - $this->plainBody .= $plainTextLeft . ': ' . $urlLeft . PHP_EOL; |
|
544 | - $this->plainBody .= $plainTextRight . ': ' . $urlRight . PHP_EOL . PHP_EOL; |
|
543 | + $this->plainBody .= $plainTextLeft.': '.$urlLeft.PHP_EOL; |
|
544 | + $this->plainBody .= $plainTextRight.': '.$urlRight.PHP_EOL.PHP_EOL; |
|
545 | 545 | |
546 | 546 | } |
547 | 547 | |
@@ -573,10 +573,10 @@ discard block |
||
573 | 573 | $this->htmlBody .= vsprintf($this->button, [$color, $color, $url, $color, $textColor, $textColor, $text]); |
574 | 574 | |
575 | 575 | if ($plainText !== false) { |
576 | - $this->plainBody .= $plainText . ': '; |
|
576 | + $this->plainBody .= $plainText.': '; |
|
577 | 577 | } |
578 | 578 | |
579 | - $this->plainBody .= $url . PHP_EOL; |
|
579 | + $this->plainBody .= $url.PHP_EOL; |
|
580 | 580 | |
581 | 581 | } |
582 | 582 | |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | * @param string $text If the text is empty the default "Name - Slogan<br>This is an automatically sent email" will be used |
601 | 601 | */ |
602 | 602 | public function addFooter(string $text = '') { |
603 | - if($text === '') { |
|
604 | - $text = $this->themingDefaults->getName() . ' - ' . $this->themingDefaults->getSlogan() . '<br>' . $this->l10n->t('This is an automatically sent email, please do not reply.'); |
|
603 | + if ($text === '') { |
|
604 | + $text = $this->themingDefaults->getName().' - '.$this->themingDefaults->getSlogan().'<br>'.$this->l10n->t('This is an automatically sent email, please do not reply.'); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | if ($this->footerAdded) { |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | $this->htmlBody .= vsprintf($this->footer, [$text]); |
615 | 615 | $this->htmlBody .= $this->tail; |
616 | - $this->plainBody .= PHP_EOL . '-- ' . PHP_EOL; |
|
616 | + $this->plainBody .= PHP_EOL.'-- '.PHP_EOL; |
|
617 | 617 | $this->plainBody .= str_replace('<br>', PHP_EOL, $text); |
618 | 618 | } |
619 | 619 |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function getCloudId(string $user, string $remote): ICloudId { |
82 | 82 | // TODO check what the correct url is for remote (asking the remote) |
83 | - return new CloudId($user. '@' . $remote, $user, $remote); |
|
83 | + return new CloudId($user.'@'.$remote, $user, $remote); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function discover(string $remote, string $service, bool $skipCache = false): array { |
66 | 66 | // Check the cache first |
67 | 67 | if ($skipCache === false) { |
68 | - $cacheData = $this->cache->get($remote . '#' . $service); |
|
68 | + $cacheData = $this->cache->get($remote.'#'.$service); |
|
69 | 69 | if ($cacheData) { |
70 | 70 | $data = json_decode($cacheData, true); |
71 | 71 | if (\is_array($data)) { |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | |
79 | 79 | // query the remote server for available services |
80 | 80 | try { |
81 | - $response = $this->client->get($remote . '/ocs-provider/', [ |
|
81 | + $response = $this->client->get($remote.'/ocs-provider/', [ |
|
82 | 82 | 'timeout' => 10, |
83 | 83 | 'connect_timeout' => 10, |
84 | 84 | ]); |
85 | - if($response->getStatusCode() === Http::STATUS_OK) { |
|
85 | + if ($response->getStatusCode() === Http::STATUS_OK) { |
|
86 | 86 | $decodedServices = json_decode($response->getBody(), true); |
87 | 87 | if (\is_array($decodedServices)) { |
88 | 88 | $discoveredServices = $this->getEndpoints($decodedServices, $service); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // Write into cache |
96 | - $this->cache->set($remote . '#' . $service, json_encode($discoveredServices), 60*60*24); |
|
96 | + $this->cache->set($remote.'#'.$service, json_encode($discoveredServices), 60 * 60 * 24); |
|
97 | 97 | return $discoveredServices; |
98 | 98 | } |
99 | 99 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | |
109 | 109 | $discoveredServices = []; |
110 | 110 | |
111 | - if(isset($decodedServices['services'][$service]['endpoints'])) { |
|
111 | + if (isset($decodedServices['services'][$service]['endpoints'])) { |
|
112 | 112 | foreach ($decodedServices['services'][$service]['endpoints'] as $endpoint => $url) { |
113 | - if($this->isSafeUrl($url)) { |
|
113 | + if ($this->isSafeUrl($url)) { |
|
114 | 114 | $discoveredServices[$endpoint] = $url; |
115 | 115 | } |
116 | 116 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return bool |
128 | 128 | */ |
129 | 129 | protected function isSafeUrl(string $url): bool { |
130 | - return (bool)preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
130 | + return (bool) preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function file_put_contents(string $filename, string $data): int { |
63 | 63 | $bytesWritten = @file_put_contents($filename, $data); |
64 | - if ($bytesWritten === false || $bytesWritten !== \strlen($data)){ |
|
65 | - throw new \Exception('Failed to write into ' . $filename); |
|
64 | + if ($bytesWritten === false || $bytesWritten !== \strlen($data)) { |
|
65 | + throw new \Exception('Failed to write into '.$filename); |
|
66 | 66 | } |
67 | 67 | return $bytesWritten; |
68 | 68 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function assertDirectoryExists(string $path) { |
83 | 83 | if (!is_dir($path)) { |
84 | - throw new \Exception('Directory ' . $path . ' does not exist.'); |
|
84 | + throw new \Exception('Directory '.$path.' does not exist.'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public function getAppPath(string $appId): string { |
42 | 42 | $path = \OC_App::getAppPath($appId); |
43 | - if($path === false) { |
|
43 | + if ($path === false) { |
|
44 | 44 | |
45 | 45 | throw new \Exception('App not found'); |
46 | 46 | } |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | ->from(self::TAG_TABLE); |
140 | 140 | |
141 | 141 | if (!\is_null($visibilityFilter)) { |
142 | - $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int)$visibilityFilter))); |
|
142 | + $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int) $visibilityFilter))); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if (!empty($nameSearchPattern)) { |
146 | 146 | $query->andWhere( |
147 | 147 | $query->expr()->like( |
148 | 148 | 'name', |
149 | - $query->createNamedParameter('%' . $this->connection->escapeLikeParameter($nameSearchPattern). '%') |
|
149 | + $query->createNamedParameter('%'.$this->connection->escapeLikeParameter($nameSearchPattern).'%') |
|
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $result->closeCursor(); |
181 | 181 | if (!$row) { |
182 | 182 | throw new TagNotFoundException( |
183 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') does not exist' |
|
183 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') does not exist' |
|
184 | 184 | ); |
185 | 185 | } |
186 | 186 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $query->execute(); |
204 | 204 | } catch (UniqueConstraintViolationException $e) { |
205 | 205 | throw new TagAlreadyExistsException( |
206 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', |
|
206 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') already exists', |
|
207 | 207 | 0, |
208 | 208 | $e |
209 | 209 | ); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $tagId = $query->getLastInsertId(); |
213 | 213 | |
214 | 214 | $tag = new SystemTag( |
215 | - (string)$tagId, |
|
215 | + (string) $tagId, |
|
216 | 216 | $tagName, |
217 | 217 | $userVisible, |
218 | 218 | $userAssignable |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | } catch (UniqueConstraintViolationException $e) { |
266 | 266 | throw new TagAlreadyExistsException( |
267 | - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists', |
|
267 | + 'Tag ("'.$tagName.'", '.$userVisible.', '.$userAssignable.') already exists', |
|
268 | 268 | 0, |
269 | 269 | $e |
270 | 270 | ); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | private function createSystemTagFromRow($row) { |
374 | - return new SystemTag((string)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable']); |
|
374 | + return new SystemTag((string) $row['id'], $row['name'], (bool) $row['visibility'], (bool) $row['editable']); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function __destruct() { |
70 | 70 | try { |
71 | 71 | $this->close(); |
72 | - } catch (SessionNotAvailableException $e){ |
|
72 | + } catch (SessionNotAvailableException $e) { |
|
73 | 73 | // This exception can occur if session is already closed |
74 | 74 | // So it is safe to ignore it and let the garbage collector to proceed |
75 | 75 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @return string|null Either the value or null |
106 | 106 | */ |
107 | 107 | public function get(string $key) { |
108 | - if(isset($this->sessionValues[$key])) { |
|
108 | + if (isset($this->sessionValues[$key])) { |
|
109 | 109 | return $this->sessionValues[$key]; |
110 | 110 | } |
111 | 111 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * Close the session and release the lock, also writes all changed data in batch |
172 | 172 | */ |
173 | 173 | public function close() { |
174 | - if($this->isModified) { |
|
174 | + if ($this->isModified) { |
|
175 | 175 | $encryptedValue = $this->crypto->encrypt(json_encode($this->sessionValues), $this->passphrase); |
176 | 176 | $this->session->set(self::encryptedSessionName, $encryptedValue); |
177 | 177 | $this->isModified = false; |
@@ -170,12 +170,12 @@ |
||
170 | 170 | */ |
171 | 171 | private function invoke(string $functionName, array $parameters = [], bool $silence = false) { |
172 | 172 | try { |
173 | - if($silence) { |
|
173 | + if ($silence) { |
|
174 | 174 | return @call_user_func_array($functionName, $parameters); |
175 | 175 | } else { |
176 | 176 | return call_user_func_array($functionName, $parameters); |
177 | 177 | } |
178 | - } catch(\Error $e) { |
|
178 | + } catch (\Error $e) { |
|
179 | 179 | $this->trapError($e->getCode(), $e->getMessage()); |
180 | 180 | } |
181 | 181 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return bool |
82 | 82 | */ |
83 | 83 | public function verify(array $data): bool { |
84 | - if(isset($data['message']) |
|
84 | + if (isset($data['message']) |
|
85 | 85 | && isset($data['signature']) |
86 | 86 | && isset($data['message']['signer']) |
87 | 87 | ) { |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $userId = substr($data['message']['signer'], 0, $location); |
90 | 90 | |
91 | 91 | $user = $this->userManager->get($userId); |
92 | - if($user !== null) { |
|
92 | + if ($user !== null) { |
|
93 | 93 | $key = $this->keyManager->getKey($user); |
94 | - return (bool)openssl_verify( |
|
94 | + return (bool) openssl_verify( |
|
95 | 95 | json_encode($data['message']), |
96 | 96 | base64_decode($data['signature']), |
97 | 97 | $key->getPublic(), |