diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-14 17:25:49 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-15 11:39:56 +0300 |
commit | 6f9d48f6ff606031533f229b802c7e893fe35e10 (patch) | |
tree | d3bd310d05eef9d5332a3840c9a3c84cfc902883 /lib/Service | |
parent | 4f89fbf81f91150229f66334dec6dfe5f40709c1 (diff) |
Fix some issues reported by Psalm
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/AutoConfig/MxRecord.php | 2 | ||||
-rw-r--r-- | lib/Service/Avatar/FaviconSource.php | 1 | ||||
-rw-r--r-- | lib/Service/Avatar/GravatarSource.php | 5 | ||||
-rw-r--r-- | lib/Service/SetupService.php | 4 |
4 files changed, 9 insertions, 3 deletions
diff --git a/lib/Service/AutoConfig/MxRecord.php b/lib/Service/AutoConfig/MxRecord.php index ccf2c6231..ceb93c33f 100644 --- a/lib/Service/AutoConfig/MxRecord.php +++ b/lib/Service/AutoConfig/MxRecord.php @@ -36,7 +36,7 @@ class MxRecord { /** * @param $host - * @return bool|array + * @return false|array */ public function query(string $host) { if (getmxrr($host, $mxRecords, $mxWeight) === false) { diff --git a/lib/Service/Avatar/FaviconSource.php b/lib/Service/Avatar/FaviconSource.php index a53f55ed2..eae238514 100644 --- a/lib/Service/Avatar/FaviconSource.php +++ b/lib/Service/Avatar/FaviconSource.php @@ -75,6 +75,7 @@ class FaviconSource implements IAvatarSource { return null; } + /** @var string $iconUrl */ $client = $this->clientService->newClient(); try { $response = $client->get($iconUrl); diff --git a/lib/Service/Avatar/GravatarSource.php b/lib/Service/Avatar/GravatarSource.php index 7288872c0..6aef4bda1 100644 --- a/lib/Service/Avatar/GravatarSource.php +++ b/lib/Service/Avatar/GravatarSource.php @@ -27,6 +27,8 @@ namespace OCA\Mail\Service\Avatar; use Exception; use OCA\Mail\Vendor\Gravatar\Gravatar; use OCP\Http\Client\IClientService; +use function is_resource; +use function stream_get_contents; class GravatarSource implements IAvatarSource { @@ -65,6 +67,9 @@ class GravatarSource implements IAvatarSource { // Don't save 0 byte images $body = $response->getBody(); + if (is_resource($body)) { + $body = stream_get_contents($body); + } if (strlen($body) === 0) { return null; } diff --git a/lib/Service/SetupService.php b/lib/Service/SetupService.php index 78fb6e094..0be5984bf 100644 --- a/lib/Service/SetupService.php +++ b/lib/Service/SetupService.php @@ -119,8 +119,8 @@ class SetupService { 'smtpPassword' => $smtpPassword ]); $newAccount->setUserId($uid); - $newAccount->setInboundPassword($this->crypto->encrypt($newAccount->getInboundPassword())); - $newAccount->setOutboundPassword($this->crypto->encrypt($newAccount->getOutboundPassword())); + $newAccount->setInboundPassword($this->crypto->encrypt($imapPassword)); + $newAccount->setOutboundPassword($this->crypto->encrypt($smtpPassword)); $account = new Account($newAccount); $this->logger->debug('Connecting to account {account}', ['account' => $newAccount->getEmail()]); |