Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Utils
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 getMergedAttribute
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\CommunityConfiguration;
4
5use ExtensionRegistry;
6use MediaWiki\Config\Config;
7
8class Utils {
9
10    /**
11     * Merge $key from config and attributes
12     *
13     * @param Config $config
14     * @param string $key
15     * @return array
16     */
17    public static function getMergedAttribute( Config $config, string $key ) {
18        return array_merge(
19        // NOTE: We want to give precedence to the Config version. Considering array_merge
20        // gives precedence to the _last_ array, the data rom Config needs to come second.
21            ExtensionRegistry::getInstance()
22                ->getAttribute( $key ),
23            $config->get( $key )
24        );
25    }
26}