-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLudoDBRegistry.php
More file actions
53 lines (50 loc) · 1007 Bytes
/
LudoDBRegistry.php
File metadata and controls
53 lines (50 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Class for storage of values
* User: Alf Magne
* Date: 11.01.13
* @package LudoDB
* @author Alf Magne Kalleland <post@dhtmlgoodies.com>
*/
/**
* Registry for safe keeping of temporary values like database connection details etc.
* @package LudoDB
*/
class LudoDBRegistry
{
/**
* Internal storage
* @var array
*/
private static $storage = array();
/**
* Store new value
* @param $key
* @param $value
*/
public static function set($key, $value)
{
self::$storage[$key] = $value;
}
/**
* Get value
* @param $key
* @return null
*/
public static function get($key)
{
if (self::isValid($key)) {
return self::$storage[$key];
}
return null;
}
/**
* Returns true when key is set in internal storage.
* @param $key
* @return bool
*/
public static function isValid($key)
{
return isset(self::$storage[$key]);
}
}