Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
WelcomeSurveyFactory | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
newWelcomeSurvey | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace GrowthExperiments; |
4 | |
5 | use IContextSource; |
6 | use MediaWiki\Languages\LanguageNameUtils; |
7 | use MediaWiki\User\Options\UserOptionsManager; |
8 | |
9 | /** |
10 | * Factory class for WelcomeSurvey |
11 | * |
12 | * This exists to be able to easily modify services |
13 | * passed to WelcomeSurvey. |
14 | */ |
15 | class WelcomeSurveyFactory { |
16 | private LanguageNameUtils $languageNameUtils; |
17 | private UserOptionsManager $userOptionsManager; |
18 | private bool $ulsInstalled; |
19 | |
20 | /** |
21 | * @param LanguageNameUtils $languageNameUtils |
22 | * @param UserOptionsManager $userOptionsManager |
23 | * @param bool $ulsInstalled |
24 | */ |
25 | public function __construct( |
26 | LanguageNameUtils $languageNameUtils, |
27 | UserOptionsManager $userOptionsManager, |
28 | bool $ulsInstalled |
29 | ) { |
30 | $this->languageNameUtils = $languageNameUtils; |
31 | $this->userOptionsManager = $userOptionsManager; |
32 | $this->ulsInstalled = $ulsInstalled; |
33 | } |
34 | |
35 | /** |
36 | * @param IContextSource $context |
37 | * @return WelcomeSurvey |
38 | */ |
39 | public function newWelcomeSurvey( IContextSource $context ): WelcomeSurvey { |
40 | return new WelcomeSurvey( |
41 | $context, |
42 | $this->languageNameUtils, |
43 | $this->userOptionsManager, |
44 | $this->ulsInstalled |
45 | ); |
46 | } |
47 | } |