Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
95.56% covered (success)
95.56%
215 / 225
81.82% covered (warning)
81.82%
9 / 11
CRAP
0.00% covered (danger)
0.00%
0 / 1
LinkHolderArray
95.56% covered (success)
95.56%
215 / 225
81.82% covered (warning)
81.82%
9 / 11
62
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 __destruct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 merge
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
3
 isBig
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 clear
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 makeHolder
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
1 / 1
2
 replace
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 replaceInternal
98.75% covered (success)
98.75%
79 / 80
0.00% covered (danger)
0.00%
0 / 1
18
 replaceInterwiki
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
1 / 1
3
 doVariants
89.53% covered (warning)
89.53%
77 / 86
0.00% covered (danger)
0.00%
0 / 1
28.90
 replaceText
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3 * Holder of replacement pairs for wiki links
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup Parser
22 */
23
24use MediaWiki\Cache\LinkCache;
25use MediaWiki\HookContainer\HookContainer;
26use MediaWiki\HookContainer\HookRunner;
27use MediaWiki\Linker\Linker;
28use MediaWiki\MainConfigNames;
29use MediaWiki\MediaWikiServices;
30use MediaWiki\Parser\Parser;
31use MediaWiki\Parser\Sanitizer;
32use MediaWiki\Title\Title;
33
34/**
35 * @internal for using in Parser only.
36 *
37 * @ingroup Parser
38 */
39class LinkHolderArray {
40    /** @var array<int,array<int,array>> Indexed by numeric namespace and link ids, {@see Parser::nextLinkID} */
41    private $internals = [];
42    /** @var array<int,array> Indexed by numeric link id */
43    private $interwikis = [];
44    /** @var int */
45    private $size = 0;
46    /** @var Parser */
47    private $parent;
48    /** @var ILanguageConverter */
49    private $languageConverter;
50    /** @var HookRunner */
51    private $hookRunner;
52
53    /**
54     * @param Parser $parent
55     * @param ILanguageConverter $languageConverter
56     * @param HookContainer $hookContainer
57     */
58    public function __construct( Parser $parent, ILanguageConverter $languageConverter,
59        HookContainer $hookContainer
60    ) {
61        $this->parent = $parent;
62        $this->languageConverter = $languageConverter;