| 1 | <?php |
||
| 14 | class MslsRegistry { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Generic container |
||
| 18 | * |
||
| 19 | * @var array |
||
| 20 | */ |
||
| 21 | private static $arr = []; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Instance |
||
| 25 | * |
||
| 26 | * @var MslsRegistry |
||
| 27 | */ |
||
| 28 | private static $instance; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get an object by key |
||
| 32 | * |
||
| 33 | * @param string $key |
||
| 34 | * |
||
| 35 | * @return mixed |
||
| 36 | */ |
||
| 37 | private function get( $key ) { |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Set an object |
||
| 43 | * |
||
| 44 | * @param string $key |
||
| 45 | * @param mixed $instance |
||
| 46 | */ |
||
| 47 | private function set( $key, $instance ) { |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Registry is a singleton |
||
| 53 | * |
||
| 54 | * @return MslsRegistry |
||
| 55 | */ |
||
| 56 | public static function instance() { |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Static get_object calls get |
||
| 66 | * |
||
| 67 | * @param string $key |
||
| 68 | * |
||
| 69 | * @return mixed |
||
| 70 | */ |
||
| 71 | public static function get_object( $key ) { |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Static set_object calls set |
||
| 77 | * |
||
| 78 | * @param string $key |
||
| 79 | * @param mixed $instance |
||
| 80 | */ |
||
| 81 | public static function set_object( $key, $instance ) { |
||
| 84 | |||
| 85 | } |
||
| 86 |