prefix = $prefix; } /** * @see Config::get */ public function get( $name ) { return $this->getWithPrefix( $this->prefix, $name ); } /** * @see Config::set */ public function set( $name, $value ) { $this->setWithPrefix( $this->prefix, $name, $value ); } /** * Get a variable with a given prefix, if not the defaults. * * @param string $prefix Prefix to use on the variable, if one. * @param string $name Variable name without prefix * @throws ConfigException * @return mixed */ protected function getWithPrefix( $prefix, $name ) { $var = $prefix . $name; if ( !array_key_exists( $var, $GLOBALS ) ) { throw new ConfigException( __METHOD__ . ": undefined variable: '$var'" ); } return $GLOBALS[$var]; } /** * Get a variable with a given prefix, if not the defaults. * * @param string $prefix Prefix to use on the variable * @param string $name Variable name without prefix * @param mixed $value Value to set */ protected function setWithPrefix( $prefix, $name, $value ) { $GLOBALS[$prefix . $name] = $value; } }