|
2 | 2 |
|
3 | 3 | namespace Cspray\AnnotatedContainer;
|
4 | 4 |
|
| 5 | +use Cspray\AnnotatedContainer\Exception\ContainerDefinitionMergeException; |
| 6 | + |
5 | 7 | /**
|
| 8 | + * The heart of the AnnotatedContainer; the ContainerDefinition, an object which defines how a Container should be |
| 9 | + * configured. |
6 | 10 | *
|
7 |
| - * |
8 |
| - * @package Cspray\AnnotatedContainer |
| 11 | + * @see ContainerDefinitionBuilder |
9 | 12 | */
|
10 | 13 | interface ContainerDefinition {
|
11 | 14 |
|
| 15 | + /** |
| 16 | + * An immutable method that will return new ContainerDefinition that has the contents of this ContainerDefinition and |
| 17 | + * the passed $containerDefinition. |
| 18 | + * |
| 19 | + * @param ContainerDefinition $containerDefinition |
| 20 | + * @return ContainerDefinition |
| 21 | + * @throws ContainerDefinitionMergeException An exception that can be thrown if the given $containerDefinition can't be merged for some reason |
| 22 | + */ |
12 | 23 | public function merge(ContainerDefinition $containerDefinition) : ContainerDefinition;
|
13 | 24 |
|
14 | 25 | /**
|
15 |
| - * Returns a set of ServiceDefinition that are shared with the Injector. |
| 26 | + * Return a set of ServiceDefinitions that this Container is aware of. |
16 | 27 | *
|
17 | 28 | * Note that this IS NOT necessarily an exhaustive list of every class and interface annotated with Service. It is
|
18 |
| - * possible, and likely, that a concrete implementation is listed as an alias or is not meant to be loaded with this |
19 |
| - * Injector due to the environment it is supposed to be running in. |
| 29 | + * possible, and likely, that a concrete implementation is marked as belonging to a profile that isn't currently |
| 30 | + * active. This, and potentially other valid reasons, might exclude a type annotated with Service from appearing |
| 31 | + * this collection. |
20 | 32 | *
|
21 | 33 | * @return ServiceDefinition[]
|
22 | 34 | */
|
23 | 35 | public function getServiceDefinitions() : array;
|
24 | 36 |
|
25 | 37 | /**
|
26 |
| - * Returns a set of AliasDefinition that define which concrete implementations are meant to be used for a given |
27 |
| - * interface. |
| 38 | + * Returns a set of AliasDefinition that define which concrete services are possible candidate for a given abstract |
| 39 | + * service. |
28 | 40 | *
|
29 |
| - * Please note that as of 0.1.x multiple alias conflict resolution is not in place and it is possible to have |
30 |
| - * multiple AliasDefinitions for the same interface that could result in unexpected services from being injected. |
31 |
| - * Multiple alias conflict resolution is scheduled for the 0.2.x release series. |
| 41 | + * Note that it is possible for an abstract service to have multiple AliasDefinition defined for it. It is not the |
| 42 | + * job of the ContainerDefinition to determine what should be done in this situation; it is meant to simply provide |
| 43 | + * the results of a configuration for a Container and an annotated configuration is possible to have multiple |
| 44 | + * concrete services that could satisfy an abstract service. It is the responsibility of the ContainerFactory |
| 45 | + * or a LogicalConstraintValidator to recognize multiple aliases are possible and take the appropriate steps. |
32 | 46 | *
|
33 | 47 | * @return AliasDefinition[]
|
34 | 48 | */
|
35 | 49 | public function getAliasDefinitions() : array;
|
36 | 50 |
|
37 | 51 | /**
|
| 52 | + * Returns a set of ServicePrepareDefinition that determine which service methods will be automatically invoked |
| 53 | + * after service construction. |
| 54 | + * |
38 | 55 | * @return ServicePrepareDefinition[]
|
39 | 56 | */
|
40 | 57 | public function getServicePrepareDefinitions() : array;
|
41 | 58 |
|
42 | 59 | /**
|
| 60 | + * Returns a set of InjectScalarDefinition that determine what values to use when a service parameter requires a |
| 61 | + * scalar or non-object value injected into it. |
| 62 | + * |
43 | 63 | * @return InjectScalarDefinition[]
|
44 | 64 | */
|
45 | 65 | public function getInjectScalarDefinitions() : array;
|
46 | 66 |
|
47 | 67 | /**
|
| 68 | + * Returns a set of InjectServiceDefinition that determine a specific service to inject into a parameter where |
| 69 | + * normal alias resolution might not be possible. |
| 70 | + * |
48 | 71 | * @return InjectServiceDefinition[]
|
49 | 72 | */
|
50 | 73 | public function getInjectServiceDefinitions() : array;
|
51 | 74 |
|
52 | 75 | /**
|
| 76 | + * Returns a set of ServiceDelegateDefinition that determine which services require factories to be constructed. |
| 77 | + * |
53 | 78 | * @return ServiceDelegateDefinition[]
|
54 | 79 | */
|
55 | 80 | public function getServiceDelegateDefinitions() : array;
|
|
0 commit comments