From d393150b77a82e78afc13f169bd40e5eb71af4e1 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Thu, 26 Nov 2015 23:30:19 +0100 Subject: [PATCH 1/3] Move MethodCallInterface and PropertyAssignmentInterface in a sub-namespace --- src/{ => InstanceDefinition}/MethodCallInterface.php | 2 +- src/{ => InstanceDefinition}/PropertyAssignmentInterface.php | 4 +++- src/InstanceDefinitionInterface.php | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) rename src/{ => InstanceDefinition}/MethodCallInterface.php (87%) rename src/{ => InstanceDefinition}/PropertyAssignmentInterface.php (77%) diff --git a/src/MethodCallInterface.php b/src/InstanceDefinition/MethodCallInterface.php similarity index 87% rename from src/MethodCallInterface.php rename to src/InstanceDefinition/MethodCallInterface.php index 4b8b1fc..dc26255 100644 --- a/src/MethodCallInterface.php +++ b/src/InstanceDefinition/MethodCallInterface.php @@ -1,6 +1,6 @@ Date: Fri, 27 Nov 2015 18:00:06 +0100 Subject: [PATCH 2/3] Rename InstanceDefinition to ObjectDefinition and the subnamespace to Initializer See the discussion in #8 --- ...onInterface.php => ObjectDefinitionInterface.php} | 12 +++++++----- .../MethodCallInterface.php | 2 +- .../PropertyAssignmentInterface.php | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) rename src/{InstanceDefinitionInterface.php => ObjectDefinitionInterface.php} (69%) rename src/{InstanceDefinition => ObjectInitializer}/MethodCallInterface.php (87%) rename src/{InstanceDefinition => ObjectInitializer}/PropertyAssignmentInterface.php (70%) diff --git a/src/InstanceDefinitionInterface.php b/src/ObjectDefinitionInterface.php similarity index 69% rename from src/InstanceDefinitionInterface.php rename to src/ObjectDefinitionInterface.php index 3442bd8..af3f417 100644 --- a/src/InstanceDefinitionInterface.php +++ b/src/ObjectDefinitionInterface.php @@ -2,14 +2,16 @@ namespace Interop\Container\Definition; -use Interop\Container\Definition\InstanceDefinition\MethodCallInterface; -use Interop\Container\Definition\InstanceDefinition\PropertyAssignmentInterface; +use Interop\Container\Definition\ObjectInitializer\MethodCallInterface; +use Interop\Container\Definition\ObjectInitializer\PropertyAssignmentInterface; /** - * Represents an instance declared using the "new" keyword followed by an optional list of - * method calls and properties assignations. + * Represents a class instance. + * + * To create the object, arguments can be passed to its constructor, methods can be called + * and properties can be set. */ -interface InstanceDefinitionInterface extends DefinitionInterface +interface ObjectDefinitionInterface extends DefinitionInterface { /** * Returns the name of the class to instantiate. diff --git a/src/InstanceDefinition/MethodCallInterface.php b/src/ObjectInitializer/MethodCallInterface.php similarity index 87% rename from src/InstanceDefinition/MethodCallInterface.php rename to src/ObjectInitializer/MethodCallInterface.php index dc26255..bd00433 100644 --- a/src/InstanceDefinition/MethodCallInterface.php +++ b/src/ObjectInitializer/MethodCallInterface.php @@ -1,6 +1,6 @@ Date: Fri, 27 Nov 2015 18:04:45 +0100 Subject: [PATCH 3/3] Rename FactoryDefinition to FactoryCallDefinition See #8 for the discussion --- ...erface.php => FactoryCallDefinitionInterface.php} | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) rename src/{FactoryDefinitionInterface.php => FactoryCallDefinitionInterface.php} (72%) diff --git a/src/FactoryDefinitionInterface.php b/src/FactoryCallDefinitionInterface.php similarity index 72% rename from src/FactoryDefinitionInterface.php rename to src/FactoryCallDefinitionInterface.php index 8d932a7..8fed458 100644 --- a/src/FactoryDefinitionInterface.php +++ b/src/FactoryCallDefinitionInterface.php @@ -3,9 +3,14 @@ namespace Interop\Container\Definition; /** - * Represents a factory that provides a container entry. + * Represents a call to a factory. The call returns the container entry. * - * The factory instance is resolved from the container. That allows to + * The call can either be made: + * + * - on an object method, in which case the factory object is resolved from the container + * - on a static method of a class + * + * When the factory is resolved from the container (non static call), that allows to * inject dependencies in the factory. * * The method to call should accept only one parameter (which can @@ -13,10 +18,11 @@ * being resolved. That allows to reuse a factory to create different * container entries. */ -interface FactoryDefinitionInterface extends DefinitionInterface +interface FactoryCallDefinitionInterface extends DefinitionInterface { /** * Returns a reference to the container entry that will act as a factory or a fully qualified class name. + * * If a fully qualified class name is passed, the method is called statically on the class, otherwise, * the method is called on the target instance of the reference. *