1 | <?php |
||
18 | class EntityRetrievingTermLookup implements TermLookup { |
||
19 | |||
20 | /** |
||
21 | * @var EntityLookup |
||
22 | */ |
||
23 | private $entityLookup; |
||
24 | |||
25 | /** |
||
26 | * @var TermList[] Labels in all languages, indexed by entity ID serialization. |
||
27 | */ |
||
28 | private $labels; |
||
29 | |||
30 | /** |
||
31 | 14 | * @var TermList[] Descriptions in all languages, indexed by entity ID serialization. |
|
32 | 14 | */ |
|
33 | 14 | private $descriptions; |
|
34 | |||
35 | /** |
||
36 | * @param EntityLookup $entityLookup |
||
37 | */ |
||
38 | public function __construct( EntityLookup $entityLookup ) { |
||
41 | |||
42 | /** |
||
43 | * @see TermLookup::getLabel() |
||
44 | 4 | * |
|
45 | 4 | * @param EntityId $entityId |
|
46 | * @param string $languageCode |
||
47 | 2 | * |
|
48 | 1 | * @return string|null |
|
49 | * @throws TermLookupException |
||
50 | */ |
||
51 | 1 | public function getLabel( EntityId $entityId, $languageCode ) { |
|
60 | |||
61 | /** |
||
62 | * @see TermLookup::getLabels() |
||
63 | 3 | * |
|
64 | 3 | * @param EntityId $entityId |
|
65 | 3 | * @param string[] $languages |
|
66 | * |
||
67 | 3 | * @throws TermLookupException |
|
68 | * @return string[] |
||
69 | */ |
||
70 | public function getLabels( EntityId $entityId, array $languages ) { |
||
75 | |||
76 | /** |
||
77 | * @see TermLookup::getDescription() |
||
78 | * |
||
79 | 4 | * @param EntityId $entityId |
|
80 | 4 | * @param string $languageCode |
|
81 | * |
||
82 | 2 | * @throws TermLookupException |
|
83 | 1 | * @return string|null |
|
84 | */ |
||
85 | public function getDescription( EntityId $entityId, $languageCode ) { |
||
94 | |||
95 | /** |
||
96 | * @see TermLookup::getDescriptions() |
||
97 | * |
||
98 | 3 | * @param EntityId $entityId |
|
99 | 3 | * @param string[] $languages |
|
100 | 3 | * |
|
101 | * @throws TermLookupException |
||
102 | 3 | * @return string[] |
|
103 | */ |
||
104 | public function getDescriptions( EntityId $entityId, array $languages ) { |
||
109 | |||
110 | /** |
||
111 | * @param EntityId $entityId |
||
112 | 14 | * @param string[] $languageCodes Not used for filtering but in thrown exceptions. |
|
113 | 14 | * |
|
114 | * @throws TermLookupException |
||
115 | 14 | * @return TermList |
|
116 | 14 | */ |
|
117 | 10 | private function getAllLabels( EntityId $entityId, array $languageCodes ) { |
|
129 | 14 | ||
130 | /** |
||
131 | 14 | * @param EntityId $entityId |
|
132 | 14 | * @param string[] $languageCodes Not used for filtering but in thrown exceptions. |
|
133 | 2 | * |
|
134 | * @throws TermLookupException |
||
135 | * @return TermList |
||
136 | 12 | */ |
|
137 | 2 | private function getAllDescriptions( EntityId $entityId, array $languageCodes ) { |
|
149 | |||
150 | /** |
||
151 | * @param EntityId $entityId |
||
152 | * @param string[] $languages Not used for filtering but in thrown exceptions. |
||
153 | * |
||
154 | * @throws TermLookupException |
||
155 | * @return EntityDocument |
||
156 | */ |
||
157 | private function fetchEntity( EntityId $entityId, array $languages ) { |
||
170 | |||
171 | } |
||
172 |