MediaWiki master
MultiConfig.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\Config;
24
30class MultiConfig implements Config {
31
40 private $configs;
41
45 public function __construct( array $configs ) {
46 $this->configs = $configs;
47 }
48
52 public function get( $name ) {
53 foreach ( $this->configs as $config ) {
54 if ( $config->has( $name ) ) {
55 return $config->get( $name );
56 }
57 }
58
59 throw new ConfigException( __METHOD__ . ": undefined option: '$name'" );
60 }
61
65 public function has( $name ) {
66 foreach ( $this->configs as $config ) {
67 if ( $config->has( $name ) ) {
68 return true;
69 }
70 }
71
72 return false;
73 }
74}
75
77class_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:32