| 1 | <?php |
||
| 14 | class MslsRegistry { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Generic container |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | private static $arr = array(); |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Instance |
||
| 25 | * |
||
| 26 | * @var MslsRegistry |
||
| 27 | */ |
||
| 28 | private static $instance; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Constructor |
||
| 32 | * |
||
| 33 | * Don't call me directly! |
||
| 34 | * |
||
| 35 | * @codeCoverageIgnore |
||
| 36 | */ |
||
| 37 | final private function __construct() { |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Clone |
||
| 42 | * |
||
| 43 | * Don't call me directly! |
||
| 44 | * |
||
| 45 | * @codeCoverageIgnore |
||
| 46 | */ |
||
| 47 | final private function __clone() { |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Get an object by key |
||
| 52 | * |
||
| 53 | * @param string $key |
||
| 54 | * |
||
| 55 | * @return mixed |
||
| 56 | */ |
||
| 57 | private function get( $key ) { |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Set an object |
||
| 63 | * |
||
| 64 | * @param string $key |
||
| 65 | * @param mixed $instance |
||
| 66 | */ |
||
| 67 | private function set( $key, $instance ) { |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Registry is a singleton |
||
| 73 | * |
||
| 74 | * @return MslsRegistry |
||
| 75 | */ |
||
| 76 | public static function instance() { |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Static get_object calls get |
||
| 86 | * |
||
| 87 | * @param string $key |
||
| 88 | * |
||
| 89 | * @return mixed |
||
| 90 | */ |
||
| 91 | public static function get_object( $key ) { |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Static set_object calls set |
||
| 97 | * |
||
| 98 | * @param string $key |
||
| 99 | * @param mixed $instance |
||
| 100 | */ |
||
| 101 | public static function set_object( $key, $instance ) { |
||
| 104 | |||
| 105 | } |
||
| 106 |