MediaWiki master
MultiConfig.php
Go to the documentation of this file.
1<?php
9namespace MediaWiki\Config;
10
16class MultiConfig implements Config {
17
26 private $configs;
27
31 public function __construct( array $configs ) {
32 $this->configs = $configs;
33 }
34
38 public function get( $name ) {
39 foreach ( $this->configs as $config ) {
40 if ( $config->has( $name ) ) {
41 return $config->get( $name );
42 }
43 }
44
45 throw new ConfigException( __METHOD__ . ": undefined option: '$name'" );
46 }
47
51 public function has( $name ) {
52 foreach ( $this->configs as $config ) {
53 if ( $config->has( $name ) ) {
54 return true;
55 }
56 }
57
58 return false;
59 }
60}
61
63class_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
Interface for configuration instances.
Definition Config.php:18