Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | namespace CirrusSearch; |
4 | |
5 | use CirrusSearch\Extra\MultiList\MultiListBuilder; |
6 | use MediaWiki\Page\ProperPageIdentity; |
7 | |
8 | /** |
9 | * Interface for changing weighted tags. |
10 | * |
11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2 of the License, or |
14 | * (at your option) any later version. |
15 | * |
16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | * GNU General Public License for more details. |
20 | * |
21 | * You should have received a copy of the GNU General Public License along |
22 | * with this program; if not, write to the Free Software Foundation, Inc., |
23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 | * http://www.gnu.org/copyleft/gpl.html |
25 | */ |
26 | interface WeightedTagsUpdater { |
27 | |
28 | public const SERVICE = self::class; |
29 | |
30 | /** |
31 | * Request the setting of the {@link WeightedTagsHooks::FIELD_NAME} field for the given tag(s) and weight(s). |
32 | * Will set a `$tagPrefix/$tagName|$tagWeight` tag for each element of `$tagNames`, and will unset |
33 | * all other tags with the same prefix (in other words, this will replace the existing |
34 | * tag set for a given prefix). |
35 | * |
36 | * @param ProperPageIdentity $page |
37 | * @param string $tagPrefix A prefix shared by all `$tagNames` |
38 | * @param null|null[]|int[] $tagWeights Optional tag weights. A map of optional weights, keyed by tag name. |
39 | * * Omit for tags which are fully defined by their prefix. |
40 | * * A single weight ranges between 1-1000. |
41 | * @param 'revision'|null $trigger Optional indicator what triggered this update, |
42 | * this hint is currently only processed by {@link EventBusWeightedTagsUpdater} |
43 | * |
44 | * @throws WeightedTagsException if sending the event fails |
45 | * |
46 | * @see MultiListBuilder for parameter details |
47 | */ |
48 | public function updateWeightedTags( |
49 | ProperPageIdentity $page, |
50 | string $tagPrefix, |
51 | ?array $tagWeights = null, |
52 | ?string $trigger = null |
53 | ): void; |
54 | |
55 | /** |
56 | * Request the reset of the {@link WeightedTagsHooks::FIELD_NAME} field for all tags prefixed with any of the |
57 | * `$tagPrefixes`. |
58 | * |
59 | * @param ProperPageIdentity $page |
60 | * @param string[] $tagPrefixes |
61 | * @param 'revision'|null $trigger optionally indicate what triggered this update, |
62 | * this hint is currently only processed by {@link EventBusWeightedTagsUpdater} |
63 | * |
64 | * @throws WeightedTagsException if sending the event fails |
65 | * |
66 | * @see WeightedTagsBuilder for parameter details |
67 | */ |
68 | public function resetWeightedTags( |
69 | ProperPageIdentity $page, |
70 | array $tagPrefixes, |
71 | ?string $trigger = null |
72 | ): void; |
73 | } |