Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 39 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
EventsPagerFactory | |
0.00% |
0 / 39 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
newTablePager | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
newListPager | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare( strict_types=1 ); |
4 | |
5 | namespace MediaWiki\Extension\CampaignEvents\Pager; |
6 | |
7 | use MediaWiki\Cache\LinkBatchFactory; |
8 | use MediaWiki\Context\IContextSource; |
9 | use MediaWiki\Extension\CampaignEvents\Database\CampaignsDatabaseHelper; |
10 | use MediaWiki\Extension\CampaignEvents\Event\Store\EventWikisStore; |
11 | use MediaWiki\Extension\CampaignEvents\MWEntity\CampaignsCentralUserLookup; |
12 | use MediaWiki\Extension\CampaignEvents\MWEntity\CampaignsPageFactory; |
13 | use MediaWiki\Extension\CampaignEvents\MWEntity\CentralUser; |
14 | use MediaWiki\Extension\CampaignEvents\MWEntity\PageURLResolver; |
15 | use MediaWiki\Extension\CampaignEvents\MWEntity\UserLinker; |
16 | use MediaWiki\Extension\CampaignEvents\MWEntity\WikiLookup; |
17 | use MediaWiki\Extension\CampaignEvents\Organizers\OrganizersStore; |
18 | use MediaWiki\Linker\LinkRenderer; |
19 | use MediaWiki\User\Options\UserOptionsLookup; |
20 | |
21 | class EventsPagerFactory { |
22 | public const SERVICE_NAME = 'CampaignEventsEventsPagerFactory'; |
23 | |
24 | private CampaignsDatabaseHelper $databaseHelper; |
25 | private CampaignsPageFactory $campaignsPageFactory; |
26 | private PageURLResolver $pageURLResolver; |
27 | private LinkBatchFactory $linkBatchFactory; |
28 | private UserLinker $userLinker; |
29 | private OrganizersStore $organiserStore; |
30 | private UserOptionsLookup $userOptionsLookup; |
31 | private CampaignsCentralUserLookup $centralUserLookup; |
32 | private WikiLookup $wikiLookup; |
33 | private EventWikisStore $eventWikisStore; |
34 | |
35 | public function __construct( |
36 | CampaignsDatabaseHelper $databaseHelper, |
37 | CampaignsPageFactory $campaignsPageFactory, |
38 | PageURLResolver $pageURLResolver, |
39 | LinkBatchFactory $linkBatchFactory, |
40 | UserLinker $userLinker, |
41 | OrganizersStore $organiserStore, |
42 | UserOptionsLookup $userOptionsLookup, |
43 | CampaignsCentralUserLookup $centralUserLookup, |
44 | WikiLookup $wikiLookup, |
45 | EventWikisStore $eventWikisStore |
46 | ) { |
47 | $this->databaseHelper = $databaseHelper; |
48 | $this->campaignsPageFactory = $campaignsPageFactory; |
49 | $this->pageURLResolver = $pageURLResolver; |
50 | $this->linkBatchFactory = $linkBatchFactory; |
51 | $this->userLinker = $userLinker; |
52 | $this->organiserStore = $organiserStore; |
53 | $this->userOptionsLookup = $userOptionsLookup; |
54 | $this->centralUserLookup = $centralUserLookup; |
55 | $this->wikiLookup = $wikiLookup; |
56 | $this->eventWikisStore = $eventWikisStore; |
57 | } |
58 | |
59 | /** |
60 | * @param IContextSource $context |
61 | * @param LinkRenderer $linkRenderer |
62 | * @param string $search |
63 | * @param string|null $status One of the EventsTablePager::STATUS_* constants |
64 | * @param CentralUser $user |
65 | * @return EventsTablePager |
66 | */ |
67 | public function newTablePager( |
68 | IContextSource $context, |
69 | LinkRenderer $linkRenderer, |
70 | string $search, |
71 | ?string $status, |
72 | CentralUser $user |
73 | ): EventsTablePager { |
74 | return new EventsTablePager( |
75 | $context, |
76 | $linkRenderer, |
77 | $this->databaseHelper, |
78 | $this->campaignsPageFactory, |
79 | $this->pageURLResolver, |
80 | $this->linkBatchFactory, |
81 | $search, |
82 | $status, |
83 | $user, |
84 | ); |
85 | } |
86 | |
87 | public function newListPager( |
88 | string $search, |
89 | ?int $meetingType, |
90 | string $startDate, |
91 | string $endDate, |
92 | bool $showOngoing, |
93 | array $filterWiki |
94 | ): EventsListPager { |
95 | return new EventsListPager( |
96 | $this->userLinker, |
97 | $this->campaignsPageFactory, |
98 | $this->pageURLResolver, |
99 | $this->organiserStore, |
100 | $this->linkBatchFactory, |
101 | $this->userOptionsLookup, |
102 | $this->databaseHelper, |
103 | $this->centralUserLookup, |
104 | $this->wikiLookup, |
105 | $this->eventWikisStore, |
106 | $search, |
107 | $meetingType, |
108 | $startDate, |
109 | $endDate, |
110 | $showOngoing, |
111 | $filterWiki |
112 | ); |
113 | } |
114 | } |