1 | <?php |
||
10 | class DatabaseTermIdsAcquirer implements TermIdsAcquirer { |
||
11 | |||
12 | const TABLE_TEXT = 'wbt_text'; |
||
13 | const TABLE_TEXT_IN_LANG = 'wbt_text_in_lang'; |
||
14 | const TABLE_TERM_IN_LANG = 'wbt_term_in_lang'; |
||
15 | |||
16 | /** |
||
17 | * @var Database $dbw |
||
18 | */ |
||
19 | private $dbw; |
||
20 | |||
21 | /** |
||
22 | * @var Database $dbr |
||
23 | */ |
||
24 | private $dbr; |
||
25 | |||
26 | public function __construct( |
||
35 | |||
36 | public function acquireTermIds( array $termsArray ): array { |
||
42 | |||
43 | /** |
||
44 | * replace root keys containing type names in termsArray |
||
45 | * with their respective ids in wbt_type table |
||
46 | * |
||
47 | * @param array $termsArray terms per type per language: |
||
48 | * [ |
||
49 | * 'type1' => [ ... ], |
||
50 | * 'type2' => [ ... ], |
||
51 | * ... |
||
52 | * ] |
||
53 | * |
||
54 | * @return array |
||
55 | * [ |
||
56 | * <typeId1> => [ ... ], |
||
57 | * <typeId2> => [ ... ], |
||
58 | * ... |
||
59 | * ] |
||
60 | */ |
||
61 | private function mapToTypeIds( array $termsArray ) { |
||
71 | |||
72 | /** |
||
73 | * replace text at termsArray leaves with their ids in wbt_text table |
||
74 | * and return resulting array |
||
75 | * |
||
76 | * @param array $termsArray terms per type per language: |
||
77 | * [ |
||
78 | * 'type' => [ |
||
79 | * [ 'language' => 'term' | [ 'term1', 'term2', ... ] ], ... |
||
80 | * ], ... |
||
81 | * ] |
||
82 | * |
||
83 | * @return array |
||
84 | * [ |
||
85 | * 'type' => [ |
||
86 | * [ 'language' => [ <textId1>, <textId2>, ... ] ], ... |
||
87 | * ], ... |
||
88 | * ] |
||
89 | */ |
||
90 | private function mapToTextIds( array $termsArray ) { |
||
105 | |||
106 | private function acquireTextIds( array $texts ) { |
||
124 | |||
125 | /** |
||
126 | * replace ( lang => [ textId, ... ] ) entries with their respective ids |
||
127 | * in wbt_text_in_lang table and return resulting array |
||
128 | * |
||
129 | * @param array $termsArray text ids per type per langauge |
||
130 | * [ |
||
131 | * 'type' => [ |
||
132 | * [ 'language' => [ <textId1>, <textId2>, ... ] ], ... |
||
133 | * ], ... |
||
134 | * ] |
||
135 | * |
||
136 | * @return array |
||
137 | * [ |
||
138 | * 'type' => [ <textInLangId1>, <textInLangId2>, ... ], |
||
139 | * ... |
||
140 | * ] |
||
141 | */ |
||
142 | private function mapToTextInLangIds( array $termsArray ) { |
||
174 | |||
175 | private function acquireTextInLangIds( array $langTextIds ) { |
||
196 | |||
197 | /** |
||
198 | * replace root ( type => [ textInLangId, ... ] ) entries with their respective ids |
||
199 | * in wbt_term_in_lang table and return resulting array |
||
200 | * |
||
201 | * @param array $termsArray text in lang ids per type |
||
202 | * [ |
||
203 | * 'type' => [ <textInLangId1>, <textInLangId2>, ... ], |
||
204 | * ... |
||
205 | * ] |
||
206 | * |
||
207 | * @return array |
||
208 | * [ |
||
209 | * <termInLang1>, |
||
210 | * <termInLang2>, |
||
211 | * ... |
||
212 | * ] |
||
213 | */ |
||
214 | private function mapToTermInLangIds( array $termsArray ) { |
||
240 | |||
241 | private function acquireTermInLangIds( array $typeTextInLangIds ) { |
||
265 | |||
266 | } |
||
267 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..