pickles/classes/Singleton.php
Josh Sherman 046d265347 Added the new classes and stuff.
git-svn-id: http://svn.cleancode.org/svn/pickles@30 4d10bc64-7434-11dc-a737-d2d0f8310089
2008-07-12 23:28:44 +00:00

30 lines
456 B
PHP

<?php
class Singleton {
private function __construct() { }
public function get($variable, $array_element = null) {
if (isset($this->$variable)) {
if (isset($array_element)) {
$array = $this->$variable;
if (isset($array[$array_element])) {
return $array[$array_element];
}
}
else {
return $this->$variable;
}
}
return false;
}
public function set($variable, $value) {
$this->$$variable = $value;
}
}
?>