forkattu lähteestä Public/pics
		
	
		
			
				
	
	
		
			40 rivejä
		
	
	
		
			863 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 rivejä
		
	
	
		
			863 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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]))
 | 
						|
			throw new Exception('Key does not exist in Registry: ' . $key);
 | 
						|
 | 
						|
		return self::$storage[$key];
 | 
						|
	}
 | 
						|
 | 
						|
	public static function remove($key)
 | 
						|
	{
 | 
						|
		if (!isset(self::$storage[$key]))
 | 
						|
			throw new Exception('Key does not exist in Registry: ' . $key);
 | 
						|
 | 
						|
		unset(self::$storage[$key]);
 | 
						|
	}
 | 
						|
}
 |