Subversion Repositories PHPX

Rev

Rev 27 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
27 PointedEar 1
<?php
2
 
3
/**
4
 * Basic registry class
5
 *
6
 * @author Thomas Lahn
7
 */
8
abstract class Registry
9
{
10
  /**
11
   * Data storage
12
   * @var array
13
   */
14
  protected static $_data = array();
45 PointedEar 15
 
27 PointedEar 16
  /**
17
   * Puts data in storage
18
   *
19
   * @param string $key
20
   * @param mixed $value
45 PointedEar 21
   * @return mixed The stored value
27 PointedEar 22
   */
23
  public static function set($key, $value)
24
  {
25
    self::$_data[$key] = $value;
45 PointedEar 26
    return self::get($key);
27 PointedEar 27
  }
28
 
29
  /**
30
   * Gets data from storage
31
   *
32
   * @param string $key
33
   * @return mixed
34
   */
35
  public static function get($key)
36
  {
37
    return self::$_data[$key];
38
  }
39
}