| 1 | <?php | ||
| 15 | final class Author extends SerializeToString | ||
| 16 | { | ||
| 17 | /** | ||
| 18 | * Small text used to display the author's name. | ||
| 19 | * | ||
| 20 | * @var string | ||
| 21 | */ | ||
| 22 | private $name; | ||
| 23 | |||
| 24 | /** | ||
| 25 | * A valid URL that will hyperlink the name. | ||
| 26 | * | ||
| 27 | * @var Url|null | ||
| 28 | */ | ||
| 29 | private $link; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * A valid URL that displays a small 16x16px image to the left of the name. | ||
| 33 | * | ||
| 34 | * @var Url|null | ||
| 35 | */ | ||
| 36 | private $icon; | ||
| 37 | |||
| 38 | /** | ||
| 39 | * Author constructor. | ||
| 40 | * | ||
| 41 | * @param string $name | ||
| 42 | * @param Url|null $link | ||
| 43 | * @param Url|null $icon | ||
| 44 | */ | ||
| 45 | 4 | public function __construct($name, Url $link = null, Url $icon = null) | |
| 46 |     { | ||
| 47 | 4 | $this->name = $name; | |
| 48 | 4 | $this->link = $link; | |
| 49 | 4 | $this->icon = $icon; | |
| 50 | 4 | } | |
| 51 | |||
| 52 | /** | ||
| 53 | * @return string | ||
| 54 | */ | ||
| 55 | 2 | public function getName() | |
| 59 | |||
| 60 | /** | ||
| 61 | * @return Url|null | ||
| 62 | */ | ||
| 63 | 2 | public function getLink() | |
| 64 |     { | ||
| 65 | 2 | return $this->link; | |
| 66 | } | ||
| 67 | |||
| 68 | /** | ||
| 69 | * @return bool | ||
| 70 | */ | ||
| 71 | 2 | public function hasLink() | |
| 72 |     { | ||
| 73 | 2 | return $this->link !== null; | |
| 74 | } | ||
| 75 | |||
| 76 | /** | ||
| 77 | * @return Url|null | ||
| 78 | */ | ||
| 79 | 2 | public function getIcon() | |
| 83 | |||
| 84 | /** | ||
| 85 | * @return bool | ||
| 86 | */ | ||
| 87 | 2 | public function hasIcon() | |
| 91 | |||
| 92 | /** | ||
| 93 |      * {@inheritdoc} | ||
| 94 | */ | ||
| 95 | 2 | public function __toString() | |
| 99 | } | ||
| 100 |