Factory.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2015 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\core;
12 
13 /**
14  * Interface for Factory implementations. A Factory is used to instantiate
15  * services to be used by clients.
16  *
17  * @author ingo herwig <ingo@wemove.com>
18  */
19 interface Factory {
20 
21  /**
22  * Get an instance from the configuration.
23  * @note Instance names are treated case insensitive
24  * @param $name The name of the instance (section, where the instance is defined)
25  * @param $dynamicConfiguration Associative array with key value pairs for
26  * dynamic instance properties (optional)
27  * @return Object
28  */
29  public function getInstance($name, $dynamicConfiguration=array());
30 
31  /**
32  * Create an instance of a class. Instances created with this method are not shared.
33  * @param $class The name of the class
34  * @param $dynamicConfiguration Associative array with key value pairs for
35  * dynamic instance properties (optional)
36  * @return Object
37  */
38  public function getClassInstance($class, $dynamicConfiguration=array());
39 
40  /**
41  * Register a shared instance with a given name.
42  * @note Instance names are treated case insensitive
43  * @param $name The name of the instance.
44  * @param $instance The instance
45  */
46  public function registerInstance($name, $instance);
47 
48  /**
49  * Add interfaces that instances must implement.
50  * @param $interfaces Associative array with instance names as keys and interface names as values.
51  */
52  public function addInterfaces(array $interfaces);
53 
54  /**
55  * Delete all created instances.
56  */
57  public function clear();
58 }
59 ?>
getInstance($name, $dynamicConfiguration=array())
Get an instance from the configuration.
getClassInstance($class, $dynamicConfiguration=array())
Create an instance of a class.
addInterfaces(array $interfaces)
Add interfaces that instances must implement.
registerInstance($name, $instance)
Register a shared instance with a given name.
clear()
Delete all created instances.
Interface for Factory implementations.
Definition: Factory.php:19
Core classes.
Definition: namespaces.php:11