Subversion Repositories PHPX

Rev

Rev 45 | Details | Compare with Previous | Last modification | View Log | RSS feed

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