Can I do something better with this code? It's just a snippet of a library I wrote.
<?php
/*
* Variable.class.php
* (c) 2013 sinan eker`enter code here`
* */
class Variable extends Config {
protected static $vars = array();
final public static function variables(){
return static::$vars;
}
final public static function clear(String $name){
unset(static::$vars[$name->getString()]);
}
final public static function destruct(){
unset(static::$vars);
static::$vars = array();
}
final public static function override(String $name, $value){
static::clear($name);
static::register($name, $value);
}
final public static function get(String $name){
$name = $name->getString();
return (isset(static::$vars[$name]) ? static::$vars[$name] : null);
}
final public static function register(String $name, $value){
return (!is_null(static::get($name)) ? false : static::$vars[$name->getString()] = $value);
}
}