1: <?php
2: /**
3: * Copyright 2010-2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2010-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * A Horde_Injector based IMP_Contents factory.
16: *
17: * @author Michael Slusarz <slusarz@horde.org>
18: * @category Horde
19: * @copyright 2010-2014 Horde LLC
20: * @license http://www.horde.org/licenses/gpl GPL
21: * @package IMP
22: */
23: class IMP_Factory_Contents extends Horde_Core_Factory_Base
24: {
25: /**
26: * Instances.
27: *
28: * @var array
29: */
30: private $_instances = array();
31:
32: /**
33: * Return the IMP_Contents:: instance.
34: *
35: * @param IMP_Indices $indices An indices object.
36: *
37: * @return IMP_Contents The singleton contents instance.
38: * @throws IMP_Exception
39: */
40: public function create($indices)
41: {
42: $key = strval($indices);
43:
44: if (!isset($this->_instances[$key])) {
45: $this->_instances[$key] = new IMP_Contents($indices);
46: }
47:
48: return $this->_instances[$key];
49: }
50:
51: }
52: