forked from Public/pics
Initial commit.
This is to be the new HashRU website based on the Aaronweb.net/Kabuki CMS.
This commit is contained in:
39
models/Registry.php
Normal file
39
models/Registry.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
* Registry.php
|
||||
* Allows sharing static variables between classes.
|
||||
*
|
||||
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
|
||||
*****************************************************************************/
|
||||
|
||||
class Registry
|
||||
{
|
||||
public static $storage = [];
|
||||
|
||||
public static function set($key, $value)
|
||||
{
|
||||
self::$storage[$key] = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function has($key)
|
||||
{
|
||||
return isset(self::$storage[$key]);
|
||||
}
|
||||
|
||||
public static function get($key)
|
||||
{
|
||||
if (!isset(self::$storage[$key]))
|
||||
trigger_error('Key does not exist in Registry: ' . $key, E_USER_ERROR);
|
||||
|
||||
return self::$storage[$key];
|
||||
}
|
||||
|
||||
public static function remove($key)
|
||||
{
|
||||
if (!isset(self::$storage[$key]))
|
||||
trigger_error('Key does not exist in Registry: ' . $key, E_USER_ERROR);
|
||||
|
||||
unset(self::$storage[$key]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user