1
0

Address.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Mail\Provider;
  8. /**
  9. * Mail Address Object
  10. *
  11. * This object is used to define the address and label of a email address
  12. *
  13. * @since 30.0.0
  14. *
  15. */
  16. class Address implements \OCP\Mail\Provider\IAddress {
  17. /**
  18. * initialize the mail address object
  19. *
  20. * @since 30.0.0
  21. *
  22. * @param string|null $address mail address (e.g test@example.com)
  23. * @param string|null $label mail address label/name
  24. */
  25. public function __construct(
  26. protected ?string $address = null,
  27. protected ?string $label = null,
  28. ) {
  29. }
  30. /**
  31. * sets the mail address
  32. *
  33. * @since 30.0.0
  34. *
  35. * @param string $value mail address (e.g. test@example.com)
  36. *
  37. * @return self return this object for command chaining
  38. */
  39. public function setAddress(string $value): self {
  40. $this->address = $value;
  41. return $this;
  42. }
  43. /**
  44. * gets the mail address
  45. *
  46. * @since 30.0.0
  47. *
  48. * @return string|null returns the mail address or null if one is not set
  49. */
  50. public function getAddress(): ?string {
  51. return $this->address;
  52. }
  53. /**
  54. * sets the mail address label/name
  55. *
  56. * @since 30.0.0
  57. *
  58. * @param string $value mail address label/name
  59. *
  60. * @return self return this object for command chaining
  61. */
  62. public function setLabel(string $value): self {
  63. $this->label = $value;
  64. return $this;
  65. }
  66. /**
  67. * gets the mail address label/name
  68. *
  69. * @since 30.0.0
  70. *
  71. * @return string|null returns the mail address label/name or null if one is not set
  72. */
  73. public function getLabel(): ?string {
  74. return $this->label;
  75. }
  76. }