1 | <?php |
||
27 | class Registry |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * Variable donde se guarda el registro |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | private static $registry = array(); |
||
36 | |||
37 | /** |
||
38 | * Establece un valor del registro |
||
39 | * |
||
40 | * @param string $index |
||
41 | * @param string $value |
||
42 | */ |
||
43 | public static function set($index, $value) |
||
44 | { |
||
45 | self::$registry[$index] = $value; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Agrega un valor al registro a uno ya establecido |
||
50 | * |
||
51 | * @param string $index |
||
52 | * @param string $value |
||
53 | */ |
||
54 | public static function append($index, $value) |
||
59 | |||
60 | /** |
||
61 | * Agrega un valor al registro al inicio de uno ya establecido |
||
62 | * |
||
63 | * @param string $index |
||
64 | * @param string $value |
||
65 | */ |
||
66 | public static function prepend($index, $value) |
||
71 | |||
72 | /** |
||
73 | * Obtiene un valor del registro |
||
74 | * |
||
75 | * @param string $index |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public static function get($index) |
||
79 | { |
||
80 | if (isset(self::$registry[$index])) { |
||
81 | return self::$registry[$index]; |
||
82 | } |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Crea un index si no existe |
||
87 | * |
||
88 | * @param string $index |
||
89 | */ |
||
90 | protected function exist($index) { |
||
95 | } |