Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NamedAddress.php 921B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Mime;
  11. /**
  12. * @author Fabien Potencier <fabien@symfony.com>
  13. *
  14. * @experimental in 4.3
  15. */
  16. final class NamedAddress extends Address
  17. {
  18. private $name;
  19. public function __construct(string $address, string $name)
  20. {
  21. parent::__construct($address);
  22. $this->name = $name;
  23. }
  24. public function getName(): string
  25. {
  26. return $this->name;
  27. }
  28. public function getEncodedNamedAddress(): string
  29. {
  30. return ($n = $this->getName()) ? $n.' <'.$this->getEncodedAddress().'>' : $this->getEncodedAddress();
  31. }
  32. public function toString(): string
  33. {
  34. return $this->getEncodedNamedAddress();
  35. }
  36. }