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