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 MediaWiki\Language\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    public function __construct(
17        private readonly Language $language,
18    ) {
19    }
20
21    /**
22     * @return int|false False if there is no namespace with this name.
23     */
24    public function getIndex( string $namespaceName ) {
25        return $this->language->getLocalNsIndex( $namespaceName );
26    }
27
28}