MediaWiki  master
MultiConfig.php
Go to the documentation of this file.
1 <?php
28 class MultiConfig implements Config {
29 
38  private $configs;
39 
43  public function __construct( array $configs ) {
44  $this->configs = $configs;
45  }
46 
50  public function get( $name ) {
51  foreach ( $this->configs as $config ) {
52  if ( $config->has( $name ) ) {
53  return $config->get( $name );
54  }
55  }
56 
57  throw new ConfigException( __METHOD__ . ": undefined option: '$name'" );
58  }
59 
63  public function has( $name ) {
64  foreach ( $this->configs as $config ) {
65  if ( $config->has( $name ) ) {
66  return true;
67  }
68  }
69 
70  return false;
71  }
72 }
get( $name)
Get a configuration variable such as "Sitename" or "UploadMaintenance.".
Exceptions for config failures.
Config [] $configs
Array of Config objects to use Order matters, the Config objects will be checked in order to see whet...
Definition: MultiConfig.php:38
Interface for configuration instances.
Definition: Config.php:28
__construct(array $configs)
Definition: MultiConfig.php:43
has( $name)
Check whether a configuration option is set for the given name.Name of configuration option bool 1...
Definition: MultiConfig.php:63
Provides a fallback sequence for Config objects.
Definition: MultiConfig.php:28