1 개요[ | ]
- 미디어위키 GlobalVarConfig
PHP
Copy
<?php
class GlobalVarConfig implements Config {
private $prefix;
public static function newInstance() {
return new GlobalVarConfig();
}
public function __construct( $prefix = 'wg' ) {
$this->prefix = $prefix;
}
public function get( $name ) {
if ( !$this->has( $name ) ) {
throw new ConfigException( __METHOD__ . ": undefined option: '$name'" );
}
return $this->getWithPrefix( $this->prefix, $name );
}
public function has( $name ) {
return $this->hasWithPrefix( $this->prefix, $name );
}
protected function getWithPrefix( $prefix, $name ) {
return $GLOBALS[$prefix . $name];
}
protected function hasWithPrefix( $prefix, $name ) {
$var = $prefix . $name;
return array_key_exists( $var, $GLOBALS );
}
}
2 같이 보기[ | ]
3 참고[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.