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