Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ConfigParserFactory
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 newConfigParser
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\Extension\MediaUploader\Config;
4
5use MediaWiki\Page\PageReference;
6use MediaWiki\Page\PageReferenceValue;
7use ParserFactory;
8use ParserOptions;
9
10/**
11 * Constructs ConfigParser objects.
12 */
13class ConfigParserFactory {
14
15    /** @var ParserFactory */
16    private $parserFactory;
17
18    /**
19     * ConfigParserFactory constructor.
20     *
21     * @param ParserFactory $parserFactory
22     *
23     * @internal Only for use by ServiceWiring
24     */
25    public function __construct( ParserFactory $parserFactory ) {
26        $this->parserFactory = $parserFactory;
27    }
28
29    /**
30     * @param array $rawConfig
31     * @param ParserOptions $parserOptions
32     * @param PageReference|null $pageRef This should correspond to the campaign's
33     *  page title, or Special:MediaUploader in case it's not a campaign. Default
34     *  is Special:MediaUploader.
35     *
36     * @return ConfigParser
37     */
38    public function newConfigParser(
39        array $rawConfig,
40        ParserOptions $parserOptions,
41        PageReference $pageRef = null
42    ): ConfigParser {
43        if ( $pageRef === null ) {
44            $pageRef = PageReferenceValue::localReference( NS_SPECIAL, 'MediaUploader' );
45        }
46
47        $parserOptions->setInterfaceMessage( true );
48        return new ConfigParser(
49            $pageRef,
50            $this->parserFactory,
51            $parserOptions,
52            $rawConfig
53        );
54    }
55}