Follow-up Ifa346c8a92: LanguageNameUtils: CONSTRUCTOR_OTPIONS, not constructorOptions
[lhc/web/wiklou.git] / tests / phpunit / includes / config / LoggedServiceOptions.php
1 <?php
2
3 use MediaWiki\Config\ServiceOptions;
4
5 /**
6 * Helper for TestAllServiceOptionsUsed.
7 */
8 class LoggedServiceOptions extends ServiceOptions {
9 /** @var array */
10 private $accessLog;
11
12 /**
13 * @param array &$accessLog Pass self::$serviceOptionsAccessLog from the class implementing
14 * TestAllServiceOptionsUsed.
15 * @param string[] $keys
16 * @param mixed ...$args Forwarded to parent as-is.
17 */
18 public function __construct( array &$accessLog, array $keys, ...$args ) {
19 $this->accessLog = &$accessLog;
20 if ( !$accessLog ) {
21 $accessLog = [ $keys, [] ];
22 }
23
24 parent::__construct( $keys, ...$args );
25 }
26
27 /**
28 * @param string $key
29 * @return mixed
30 */
31 public function get( $key ) {
32 $this->accessLog[1][$key] = true;
33
34 return parent::get( $key );
35 }
36 }