Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 31
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
EventPageDecoratorFactory
0.00% covered (danger)
0.00%
0 / 31
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
 newDecorator
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare( strict_types=1 );
4
5namespace MediaWiki\Extension\CampaignEvents\EventPage;
6
7use MediaWiki\Extension\CampaignEvents\Event\PageEventLookup;
8use MediaWiki\Extension\CampaignEvents\MWEntity\CampaignsCentralUserLookup;
9use MediaWiki\Extension\CampaignEvents\MWEntity\CampaignsPageFactory;
10use MediaWiki\Extension\CampaignEvents\MWEntity\UserLinker;
11use MediaWiki\Extension\CampaignEvents\MWEntity\WikiLookup;
12use MediaWiki\Extension\CampaignEvents\Organizers\OrganizersStore;
13use MediaWiki\Extension\CampaignEvents\Participants\ParticipantsStore;
14use MediaWiki\Extension\CampaignEvents\Permissions\PermissionChecker;
15use MediaWiki\Extension\CampaignEvents\Questions\EventQuestionsRegistry;
16use MediaWiki\Extension\CampaignEvents\Time\EventTimeFormatter;
17use MediaWiki\Language\Language;
18use MediaWiki\Linker\LinkRenderer;
19use MediaWiki\Output\OutputPage;
20use MediaWiki\Permissions\Authority;
21use Wikimedia\Message\IMessageFormatterFactory;
22
23class EventPageDecoratorFactory {
24    public const SERVICE_NAME = 'CampaignEventsEventPageDecoratorFactory';
25
26    private PageEventLookup $pageEventLookup;
27    private ParticipantsStore $participantsStore;
28    private OrganizersStore $organizersStore;
29    private PermissionChecker $permissionChecker;
30    private IMessageFormatterFactory $messageFormatterFactory;
31    private LinkRenderer $linkRenderer;
32    private CampaignsPageFactory $campaignsPageFactory;
33    private CampaignsCentralUserLookup $centralUserLookup;
34    private UserLinker $userLinker;
35    private EventTimeFormatter $eventTimeFormatter;
36    private EventPageCacheUpdater $eventPageCacheUpdater;
37    private EventQuestionsRegistry $eventQuestionsRegistry;
38    private WikiLookup $wikiLookup;
39
40    /**
41     * @param PageEventLookup $pageEventLookup
42     * @param ParticipantsStore $participantsStore
43     * @param OrganizersStore $organizersStore
44     * @param PermissionChecker $permissionChecker
45     * @param IMessageFormatterFactory $messageFormatterFactory
46     * @param LinkRenderer $linkRenderer
47     * @param CampaignsPageFactory $campaignsPageFactory
48     * @param CampaignsCentralUserLookup $centralUserLookup
49     * @param UserLinker $userLinker
50     * @param EventTimeFormatter $eventTimeFormatter
51     * @param EventPageCacheUpdater $eventPageCacheUpdater
52     * @param EventQuestionsRegistry $eventQuestionsRegistry
53     * @param WikiLookup $wikiLookup
54     *
55     */
56    public function __construct(
57        PageEventLookup $pageEventLookup,
58        ParticipantsStore $participantsStore,
59        OrganizersStore $organizersStore,
60        PermissionChecker $permissionChecker,
61        IMessageFormatterFactory $messageFormatterFactory,
62        LinkRenderer $linkRenderer,
63        CampaignsPageFactory $campaignsPageFactory,
64        CampaignsCentralUserLookup $centralUserLookup,
65        UserLinker $userLinker,
66        EventTimeFormatter $eventTimeFormatter,
67        EventPageCacheUpdater $eventPageCacheUpdater,
68        EventQuestionsRegistry $eventQuestionsRegistry,
69        WikiLookup $wikiLookup
70    ) {
71        $this->pageEventLookup = $pageEventLookup;
72        $this->participantsStore = $participantsStore;
73        $this->organizersStore = $organizersStore;
74        $this->permissionChecker = $permissionChecker;
75        $this->messageFormatterFactory = $messageFormatterFactory;
76        $this->linkRenderer = $linkRenderer;
77        $this->campaignsPageFactory = $campaignsPageFactory;
78        $this->centralUserLookup = $centralUserLookup;
79        $this->userLinker = $userLinker;
80        $this->eventTimeFormatter = $eventTimeFormatter;
81        $this->eventPageCacheUpdater = $eventPageCacheUpdater;
82        $this->eventQuestionsRegistry = $eventQuestionsRegistry;
83        $this->wikiLookup = $wikiLookup;
84    }
85
86    public function newDecorator(
87        Language $language,
88        Authority $viewingAuthority,
89        OutputPage $out
90    ): EventPageDecorator {
91        return new EventPageDecorator(
92            $this->pageEventLookup,
93            $this->participantsStore,
94            $this->organizersStore,
95            $this->permissionChecker,
96            $this->messageFormatterFactory,
97            $this->linkRenderer,
98            $this->campaignsPageFactory,
99            $this->centralUserLookup,
100            $this->userLinker,
101            $this->eventTimeFormatter,
102            $this->eventPageCacheUpdater,
103            $this->eventQuestionsRegistry,
104            $this->wikiLookup,
105            $language,
106            $viewingAuthority,
107            $out
108        );
109    }
110}