Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
LocalizedMediaWikiNamespaceLookup
n/a
0 / 0
n/a
0 / 0
2
n/a
0 / 0
 __construct
n/a
0 / 0
n/a
0 / 0
1
 getIndex
n/a
0 / 0
n/a
0 / 0
1
1<?php
2
3namespace FileImporter\Services\Wikitext;
4
5use Language;
6
7/**
8 * A reverse namespace name to ID lookup that depends on MediaWiki core and does *not* recognize
9 * canonical (English) namespace names, only localized ones.
10 *
11 * @license GPL-2.0-or-later
12 * @codeCoverageIgnore
13 */
14class LocalizedMediaWikiNamespaceLookup implements NamespaceNameLookup {
15
16    private Language $language;
17
18    public function __construct( Language $language ) {
19        $this->language = $language;
20    }
21
22    /**
23     * @return int|false False if there is no namespace with this name.
24     */
25    public function getIndex( string $namespaceName ) {
26        return $this->language->getLocalNsIndex( $namespaceName );
27    }
28
29}