MediaWiki master
MultiConfig.php
Go to the documentation of this file.
1<?php
9namespace MediaWiki\Config;
10
16class MultiConfig implements Config {
17
25 public function __construct(
26 private readonly array $configs,
27 ) {
28 }
29
33 public function get( $name ) {
34 foreach ( $this->configs as $config ) {
35 if ( $config->has( $name ) ) {
36 return $config->get( $name );
37 }
38 }
39
40 throw new ConfigException( __METHOD__ . ": undefined option: '$name'" );
41 }
42
46 public function has( $name ) {
47 foreach ( $this->configs as $config ) {
48 if ( $config->has( $name ) ) {
49 return true;
50 }
51 }
52
53 return false;
54 }
55}
56
58class_alias( MultiConfig::class, 'MultiConfig' );
Exceptions for config failures.
Provides a fallback sequence for Config objects.
has( $name)
Check whether a configuration option is set for the given name.bool 1.24
__construct(private readonly array $configs,)
Interface for configuration instances.
Definition Config.php:18