1: <?php
2:
3: App::uses('ClassSearcher', 'Base.Lib');
4:
5: class Contexts {
6:
7: public static $contexts = array();
8:
9: /**
10: *
11: * @param string $id
12: * @return Context
13: * @throws Exception
14: */
15: public static function getContext($id) {
16: if (empty(self::$contexts[$id])) {
17: self::$contexts[$id] = ClassSearcher::findInstanceAndInstantiate(
18: 'Lib/Context', Inflector::camelize($id) . 'Context'
19: );
20: }
21: return self::$contexts[$id];
22: }
23:
24: }
25: