Go to the documentation of this file.00001 <?php
00012 final class registry {
00013
00020 private static $vars = array();
00021
00025 private function __construct() {}
00026
00033 public static function get($name) {
00034 if (self::check($name))
00035 return self::$vars[$name];
00036 return null;
00037 }
00038
00047 public static function set($name, $val) {
00048 if (array_key_exists($name, self::$vars))
00049 throw new nException('Registry: property '.$name.' already exists.');
00050
00051 self::$vars[$name] = $val;
00052 return true;
00053 }
00054
00063 public static function setInArray($name, $val, $unique=true) {
00064 if (!array_key_exists($name, self::$vars))
00065 self::$vars[$name] = array();
00066
00067 if (!$unique || !array_key_exists($val, self::$vars[$name]))
00068 self::$vars[$name][] = $val;
00069 return true;
00070 }
00071
00078 public static function check($name) {
00079 return array_key_exists($name, self::$vars);
00080 }
00081
00082 }