Rev 27 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 27 | Rev 45 | ||
|---|---|---|---|
| 1 | <?php
|
1 | <?php
|
| 2 | 2 | ||
| 3 | /**
|
3 | /**
|
| 4 | * Basic registry class
|
4 | * Basic registry class
|
| 5 | *
|
5 | *
|
| 6 | * @author Thomas Lahn
|
6 | * @author Thomas Lahn
|
| 7 | */
|
7 | */
|
| 8 | abstract class Registry |
8 | abstract class Registry |
| 9 | {
|
9 | {
|
| 10 | /**
|
10 | /**
|
| 11 | * Data storage
|
11 | * Data storage
|
| 12 | * @var array
|
12 | * @var array
|
| 13 | */
|
13 | */
|
| 14 | protected static $_data = array(); |
14 | protected static $_data = array(); |
| 15 | 15 | ||
| 16 | /**
|
16 | /**
|
| 17 | * Puts data in storage
|
17 | * Puts data in storage
|
| 18 | *
|
18 | *
|
| 19 | * @param string $key
|
19 | * @param string $key
|
| 20 | * @param mixed $value
|
20 | * @param mixed $value
|
| - | 21 | * @return mixed The stored value
|
|
| 21 | */
|
22 | */
|
| 22 | public static function set($key, $value) |
23 | public static function set($key, $value) |
| 23 | {
|
24 | {
|
| 24 | self::$_data[$key] = $value; |
25 | self::$_data[$key] = $value; |
| - | 26 | return self::get($key); |
|
| 25 | }
|
27 | }
|
| 26 | 28 | ||
| 27 | /**
|
29 | /**
|
| 28 | * Gets data from storage
|
30 | * Gets data from storage
|
| 29 | *
|
31 | *
|
| 30 | * @param string $key
|
32 | * @param string $key
|
| 31 | * @return mixed
|
33 | * @return mixed
|
| 32 | */
|
34 | */
|
| 33 | public static function get($key) |
35 | public static function get($key) |
| 34 | {
|
36 | {
|
| 35 | return self::$_data[$key]; |
37 | return self::$_data[$key]; |
| 36 | }
|
38 | }
|
| 37 | }
|
39 | }
|