diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-04-26 11:54:28 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-04-26 11:54:28 +0200 |
commit | 48edc27d25f830fadeeca096989466a6a913116b (patch) | |
tree | bb6dadfc88c8be6579df7a0519183f11c4188358 /apps/contactsinteraction | |
parent | 8f0025ced304334689b6947acf21115e29e7abc3 (diff) | |
download | nextcloud-server-48edc27d25f830fadeeca096989466a6a913116b.tar.gz nextcloud-server-48edc27d25f830fadeeca096989466a6a913116b.zip |
chore: Improve possibly null getters
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/contactsinteraction')
-rw-r--r-- | apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php index ad98a75065f..2064136c392 100644 --- a/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php +++ b/apps/contactsinteraction/lib/Listeners/ContactInteractionListener.php @@ -86,11 +86,14 @@ class ContactInteractionListener implements IEventListener { } $this->atomic(function () use ($event) { + $uid = $event->getUid(); + $email = $event->getEmail(); + $federatedCloudId = $event->getFederatedCloudId(); $existing = $this->mapper->findMatch( $event->getActor(), - $event->getUid(), - $event->getEmail(), - $event->getFederatedCloudId() + $uid, + $email, + $federatedCloudId ); if (!empty($existing)) { $now = $this->timeFactory->getTime(); @@ -104,22 +107,22 @@ class ContactInteractionListener implements IEventListener { $contact = new RecentContact(); $contact->setActorUid($event->getActor()->getUID()); - if ($event->getUid() !== null) { - $contact->setUid($event->getUid()); + if ($uid !== null) { + $contact->setUid($uid); } - if ($event->getEmail() !== null) { - $contact->setEmail($event->getEmail()); + if ($email !== null) { + $contact->setEmail($email); } - if ($event->getFederatedCloudId() !== null) { - $contact->setFederatedCloudId($event->getFederatedCloudId()); + if ($federatedCloudId !== null) { + $contact->setFederatedCloudId($federatedCloudId); } $contact->setLastContact($this->timeFactory->getTime()); $copy = $this->cardSearchDao->findExisting( $event->getActor(), - $event->getUid(), - $event->getEmail(), - $event->getFederatedCloudId() + $uid, + $email, + $federatedCloudId ); if ($copy !== null) { try { |