MediaWiki
REL1_24
|
00001 <?php 00028 class GlobalVarConfig implements Config { 00029 00034 private $prefix; 00035 00040 public static function newInstance() { 00041 return new GlobalVarConfig(); 00042 } 00043 00044 public function __construct( $prefix = 'wg' ) { 00045 $this->prefix = $prefix; 00046 } 00047 00051 public function get( $name ) { 00052 if ( !$this->has( $name ) ) { 00053 throw new ConfigException( __METHOD__ . ": undefined option: '$name'" ); 00054 } 00055 return $this->getWithPrefix( $this->prefix, $name ); 00056 } 00057 00061 public function has( $name ) { 00062 return $this->hasWithPrefix( $this->prefix, $name ); 00063 } 00064 00069 public function set( $name, $value ) { 00070 wfDeprecated( __METHOD__, '1.24' ); 00071 $this->setWithPrefix( $this->prefix, $name, $value ); 00072 } 00073 00081 protected function getWithPrefix( $prefix, $name ) { 00082 return $GLOBALS[$prefix . $name]; 00083 } 00084 00092 protected function hasWithPrefix( $prefix, $name ) { 00093 $var = $prefix . $name; 00094 return array_key_exists( $var, $GLOBALS ); 00095 } 00096 00105 protected function setWithPrefix( $prefix, $name, $value ) { 00106 $GLOBALS[$prefix . $name] = $value; 00107 } 00108 }