Author.php 920 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php declare(strict_types = 1);
  2. /*
  3. * This file is part of PharIo\Manifest.
  4. *
  5. * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
  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 PharIo\Manifest;
  11. class Author {
  12. /** @var string */
  13. private $name;
  14. /** @var Email */
  15. private $email;
  16. public function __construct(string $name, Email $email) {
  17. $this->name = $name;
  18. $this->email = $email;
  19. }
  20. public function asString(): string {
  21. return \sprintf(
  22. '%s <%s>',
  23. $this->name,
  24. $this->email->asString()
  25. );
  26. }
  27. public function getName(): string {
  28. return $this->name;
  29. }
  30. public function getEmail(): Email {
  31. return $this->email;
  32. }
  33. }