Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-10-02 12:47:00 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-01-31 18:43:51 +0300
commitc287787f8df599b567f399f6022ffc88db3a0582 (patch)
tree6d1863eff65f5c43db73c1e36df6938c505ef58e /lib/Address.php
parent31f89d71f860c8c2f75234537a8d64f38da696ab (diff)
Add a cache for IMAP message in the database
Co-authored-by: Roeland Jago Douma <roeland@famdouma.nl> Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at> Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/Address.php')
-rw-r--r--lib/Address.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Address.php b/lib/Address.php
index 4eff928b3..c099893fd 100644
--- a/lib/Address.php
+++ b/lib/Address.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
@@ -30,6 +31,11 @@ use JsonSerializable;
class Address implements JsonSerializable {
+ public const TYPE_FROM = 0;
+ public const TYPE_TO = 1;
+ public const TYPE_CC = 2;
+ public const TYPE_BCC = 3;
+
/** @var Horde_Mail_Rfc822_Address */
private $wrapped;
@@ -40,17 +46,17 @@ class Address implements JsonSerializable {
public function __construct($label, $email) {
$this->wrapped = new Horde_Mail_Rfc822_Address($email);
// If no label is set we use the email
- if ($label !== $email && !is_null($label)) {
+ if ($label !== $email && $label !== null) {
$this->wrapped->personal = $label;
}
}
/**
- * @return string
+ * @return string|null
*/
- public function getLabel(): string {
+ public function getLabel(): ?string {
$personal = $this->wrapped->personal;
- if (is_null($personal)) {
+ if ($personal === null) {
// Fallback
return $this->getEmail();
}
@@ -58,9 +64,9 @@ class Address implements JsonSerializable {
}
/**
- * @return string
+ * @return string|null
*/
- public function getEmail(): string {
+ public function getEmail(): ?string {
return $this->wrapped->bare_address;
}