1 | <?php declare(strict_types=1); |
||
27 | class Link implements LinkInterface |
||
28 | { |
||
29 | /** |
||
30 | * @var bool |
||
31 | */ |
||
32 | private $isSubUrl; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $value; |
||
38 | |||
39 | /** |
||
40 | * @var bool |
||
41 | */ |
||
42 | private $hasMeta; |
||
43 | |||
44 | /** |
||
45 | * @var mixed |
||
46 | */ |
||
47 | private $meta; |
||
48 | |||
49 | /** |
||
50 | * @param bool $isSubUrl |
||
51 | * @param string $value |
||
52 | * @param bool $hasMeta |
||
53 | * @param mixed $meta |
||
54 | */ |
||
55 | 66 | public function __construct(bool $isSubUrl, string $value, bool $hasMeta, $meta = null) |
|
62 | |||
63 | /** |
||
64 | * @inheritdoc |
||
65 | */ |
||
66 | 62 | public function canBeShownAsString(): bool |
|
70 | |||
71 | /** |
||
72 | * @inheritdoc |
||
73 | */ |
||
74 | 62 | public function getStringRepresentation(string $prefix): string |
|
80 | |||
81 | /** |
||
82 | * @inheritdoc |
||
83 | */ |
||
84 | 1 | public function getArrayRepresentation(string $prefix): array |
|
93 | |||
94 | /** |
||
95 | * If link contains sub-URL value and URL prefix should be added. |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | 62 | private function isSubUrl(): bool |
|
103 | |||
104 | /** |
||
105 | * Get link’s URL value (full URL or sub-URL). |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | 62 | private function getValue(): string |
|
113 | |||
114 | /** |
||
115 | * If link has meta information. |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | 62 | private function hasMeta(): bool |
|
123 | |||
124 | /** |
||
125 | * Get meta information. |
||
126 | * |
||
127 | * @return mixed |
||
128 | */ |
||
129 | 1 | private function getMeta() |
|
135 | |||
136 | /** |
||
137 | * @param string $prefix |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | 62 | protected function buildUrl(string $prefix): string |
|
145 | } |
||
146 |