Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
AdvancedMainMenuBuilder | |
0.00% |
0 / 13 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getSettingsGroup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPersonalToolsGroup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDiscoveryGroup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDonateGroup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSiteLinks | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getInteractionToolsGroup | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | namespace MediaWiki\Minerva\Menu\Main; |
22 | |
23 | use MediaWiki\Minerva\Menu\Definitions; |
24 | use MediaWiki\Minerva\Menu\Group; |
25 | |
26 | /** |
27 | * A menu builder that provides additional menu entries that match |
28 | * Advanced Mobile Contributions project requirements. This menu |
29 | * is used when AMC SkinOption flag is set to true. |
30 | * |
31 | * @package MediaWiki\Minerva\Menu\Main |
32 | */ |
33 | final class AdvancedMainMenuBuilder implements IMainMenuBuilder { |
34 | private bool $showMobileOptions; |
35 | private bool $showDonateLink; |
36 | private Definitions $definitions; |
37 | |
38 | /** |
39 | * Initialize the Default Main Menu builder |
40 | * |
41 | * @param bool $showMobileOptions Show MobileOptions instead of Preferences |
42 | * @param bool $showDonateLink whether to show the donate link |
43 | * @param Definitions $definitions A menu items definitions set |
44 | */ |
45 | public function __construct( $showMobileOptions, $showDonateLink, Definitions $definitions ) { |
46 | $this->showMobileOptions = $showMobileOptions; |
47 | $this->showDonateLink = $showDonateLink; |
48 | $this->definitions = $definitions; |
49 | } |
50 | |
51 | /** |
52 | * @return Group |
53 | */ |
54 | public function getSettingsGroup(): Group { |
55 | return new Group( 'pt-preferences' ); |
56 | } |
57 | |
58 | /** |
59 | * @inheritDoc |
60 | */ |
61 | public function getPersonalToolsGroup( array $personalTools ): Group { |
62 | return BuilderUtil::getConfigurationTools( $this->definitions, $this->showMobileOptions ); |
63 | } |
64 | |
65 | /** |
66 | * @inheritDoc |
67 | */ |
68 | public function getDiscoveryGroup( array $navigationTools ): Group { |
69 | return BuilderUtil::getDiscoveryTools( $this->definitions, $navigationTools ); |
70 | } |
71 | |
72 | /** |
73 | * @inheritDoc |
74 | */ |
75 | public function getDonateGroup(): Group { |
76 | return BuilderUtil::getDonateGroup( $this->definitions, $this->showDonateLink ); |
77 | } |
78 | |
79 | /** |
80 | * @inheritDoc |
81 | */ |
82 | public function getSiteLinks(): Group { |
83 | return BuilderUtil::getSiteLinks( $this->definitions ); |
84 | } |
85 | |
86 | /** |
87 | * Prepares a list of links that have the purpose of discovery in the main navigation menu |
88 | * @return Group |
89 | */ |
90 | public function getInteractionToolsGroup(): Group { |
91 | $group = new Group( 'p-interaction' ); |
92 | |
93 | $this->definitions->insertRecentChanges( $group ); |
94 | $this->definitions->insertSpecialPages( $group ); |
95 | $this->definitions->insertCommunityPortal( $group ); |
96 | |
97 | return $group; |
98 | } |
99 | } |