1 | <?php |
||
9 | class FactoryCallDefinition implements DumpableInterface |
||
10 | { |
||
11 | /** |
||
12 | * The identifier of the instance in the container. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | private $identifier; |
||
17 | |||
18 | /** |
||
19 | * The fully qualified class name of this instance, or a fully qualified class name. |
||
20 | * |
||
21 | * @var ReferenceInterface |
||
22 | */ |
||
23 | private $factory; |
||
24 | |||
25 | /** |
||
26 | * The name of the method to be called. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | private $methodName; |
||
31 | |||
32 | /** |
||
33 | * A list of arguments passed to the constructor. |
||
34 | * |
||
35 | * @var array Array of scalars or ReferenceInterface, or array mixing scalars, arrays, and ReferenceInterface |
||
36 | */ |
||
37 | private $methodArguments = array(); |
||
38 | |||
39 | /** |
||
40 | * Constructs an factory definition. |
||
41 | * |
||
42 | * @param string|null $identifier The identifier of the instance in the container. Can be null if the instance is anonymous (declared inline of other instances) |
||
43 | * @param ReferenceInterface $factory A pointer to the service that the factory method will be called upon, or a fully qualified class name |
||
44 | * @param string $methodName The name of the factory method |
||
45 | * @param array $methodArguments The parameters of the factory method |
||
46 | */ |
||
47 | public function __construct($identifier, $factory, $methodName, array $methodArguments = []) |
||
54 | |||
55 | /** |
||
56 | * Returns the identifier of the instance. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getIdentifier() |
||
64 | |||
65 | /** |
||
66 | * Returns a pointer to the service that the factory method will be called upon, or a fully qualified class name. |
||
67 | * |
||
68 | * @return ReferenceInterface|string |
||
69 | */ |
||
70 | public function getFactory() |
||
74 | |||
75 | /** |
||
76 | * Returns the name of the factory method. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getMethodName() |
||
84 | |||
85 | /** |
||
86 | * Returns the parameters of the factory method. |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | public function getMethodArguments() |
||
94 | |||
95 | /** |
||
96 | * Adds an argument to the method. |
||
97 | * |
||
98 | * @param mixed $argument |
||
99 | */ |
||
100 | public function addMethodArgument($argument) |
||
104 | |||
105 | /** |
||
106 | * Returns an InlineEntryInterface object representing the PHP code necessary to generate |
||
107 | * the container entry. |
||
108 | * |
||
109 | * @param string $containerVariable The name of the variable that allows access to the container instance. For instance: "$container", or "$this->container" |
||
110 | * @param array $usedVariables An array of variables that are already used and that should not be used when generating this code. |
||
111 | * |
||
112 | * @return InlineEntryInterface |
||
113 | */ |
||
114 | public function toPhpCode($containerVariable, array $usedVariables = array()) |
||
126 | } |
||
127 |