Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
14 / 14 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
WikiExporterFactory | |
100.00% |
14 / 14 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
getWikiExporter | |
100.00% |
10 / 10 |
|
100.00% |
1 / 1 |
1 |
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\Export; |
22 | |
23 | use MediaWiki\CommentStore\CommentStore; |
24 | use MediaWiki\HookContainer\HookContainer; |
25 | use MediaWiki\Revision\RevisionStore; |
26 | use MediaWiki\Title\TitleParser; |
27 | use WikiExporter; |
28 | use Wikimedia\Rdbms\IReadableDatabase; |
29 | |
30 | /** |
31 | * Factory service for WikiExporter instances. |
32 | * |
33 | * @author Zabe |
34 | * @since 1.38 |
35 | */ |
36 | class WikiExporterFactory { |
37 | /** @var HookContainer */ |
38 | private $hookContainer; |
39 | |
40 | /** @var RevisionStore */ |
41 | private $revisionStore; |
42 | |
43 | /** @var TitleParser */ |
44 | private $titleParser; |
45 | |
46 | /** @var CommentStore */ |
47 | private $commentStore; |
48 | |
49 | /** |
50 | * @param HookContainer $hookContainer |
51 | * @param RevisionStore $revisionStore |
52 | * @param TitleParser $titleParser |
53 | * @param CommentStore $commentStore |
54 | */ |
55 | public function __construct( |
56 | HookContainer $hookContainer, |
57 | RevisionStore $revisionStore, |
58 | TitleParser $titleParser, |
59 | CommentStore $commentStore |
60 | ) { |
61 | $this->hookContainer = $hookContainer; |
62 | $this->revisionStore = $revisionStore; |
63 | $this->titleParser = $titleParser; |
64 | $this->commentStore = $commentStore; |
65 | } |
66 | |
67 | /** |
68 | * @param IReadableDatabase $db |
69 | * @param int|array $history |
70 | * @param int $text |
71 | * @param null|array $limitNamespaces |
72 | * |
73 | * @return WikiExporter |
74 | */ |
75 | public function getWikiExporter( |
76 | IReadableDatabase $db, |
77 | $history = WikiExporter::CURRENT, |
78 | $text = WikiExporter::TEXT, |
79 | $limitNamespaces = null |
80 | ): WikiExporter { |
81 | return new WikiExporter( |
82 | $db, |
83 | $this->commentStore, |
84 | $this->hookContainer, |
85 | $this->revisionStore, |
86 | $this->titleParser, |
87 | $history, |
88 | $text, |
89 | $limitNamespaces |
90 | ); |
91 | } |
92 | } |