Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 40
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3use MediaWiki\MediaWikiServices;
4use MediaWiki\Wikispeech\Lexicon\ConfiguredLexiconStorage;
5use MediaWiki\Wikispeech\Lexicon\LexiconHandler;
6use MediaWiki\Wikispeech\Lexicon\LexiconSpeechoidStorage;
7use MediaWiki\Wikispeech\Lexicon\LexiconWanCacheStorage;
8use MediaWiki\Wikispeech\Lexicon\LexiconWikiStorage;
9use MediaWiki\Wikispeech\SpeechoidConnector;
10use MediaWiki\Wikispeech\WikispeechServices;
11
12/** @phpcs-require-sorted-array */
13return [
14    'Wikispeech.ConfiguredLexiconStorage' => static function (
15        MediaWikiServices $services
16    ): ConfiguredLexiconStorage {
17        return new ConfiguredLexiconStorage(
18            $services->getConfigFactory()
19                ->makeConfig( 'wikispeech' )
20                ->get( 'WikispeechPronunciationLexiconConfiguration' ),
21            $services
22        );
23    },
24    'Wikispeech.LexiconHandler' => static function ( MediaWikiServices $services ): LexiconHandler {
25        return new LexiconHandler(
26            WikispeechServices::getLexiconSpeechoidStorage(),
27            WikispeechServices::getLexiconWanCacheStorage()
28        );
29    },
30    'Wikispeech.LexiconSpeechoidStorage' => static function ( MediaWikiServices $services ): LexiconSpeechoidStorage {
31        return new LexiconSpeechoidStorage(
32            WikispeechServices::getSpeechoidConnector(),
33            $services->getMainWANObjectCache()
34        );
35    },
36    'Wikispeech.LexiconWanCacheStorage' => static function ( MediaWikiServices $services ): LexiconWanCacheStorage {
37        return new LexiconWanCacheStorage(
38            $services->getMainWANObjectCache()
39        );
40    },
41    'Wikispeech.LexiconWikiStorage' => static function ( MediaWikiServices $services ): LexiconWikiStorage {
42        return new LexiconWikiStorage(
43            RequestContext::getMain()->getUser()
44        );
45    },
46    'Wikispeech.SpeechoidConnector' => static function ( MediaWikiServices $services ): SpeechoidConnector {
47        return new SpeechoidConnector(
48            $services->getMainConfig(),
49            $services->getHttpRequestFactory()
50        );
51    }
52];