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 | 3 | public function __construct($name, Url $link = null, Url $icon = null) |
|
46 | { |
||
47 | 3 | $this->name = $name; |
|
48 | 3 | $this->link = $link; |
|
49 | 3 | $this->icon = $icon; |
|
50 | 3 | } |
|
51 | |||
52 | /** |
||
53 | * @return string |
||
54 | */ |
||
55 | 1 | public function getName() |
|
59 | |||
60 | /** |
||
61 | * @return Url|null |
||
62 | */ |
||
63 | 1 | public function getLink() |
|
64 | { |
||
65 | 1 | return $this->link; |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return bool |
||
70 | */ |
||
71 | 1 | public function hasLink() |
|
72 | { |
||
73 | 1 | return $this->link !== null; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return Url|null |
||
78 | */ |
||
79 | 1 | public function getIcon() |
|
83 | |||
84 | /** |
||
85 | * @return bool |
||
86 | */ |
||
87 | 1 | public function hasIcon() |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 1 | public function __toString() |
|
99 | } |
||
100 |