class ParameterDefinition implements DumpableInterface
9
{
10
/**
11
* The identifier of the instance in the container.
12
*
13
* @var string
14
*/
15
private $identifier;
16
17
/**
18
* The value of the parameter.
19
* It is expected to be a scalar or an array (or more generally anything that can be `var_export`ed).
20
*
21
* @var mixed
22
*/
23
private $value;
24
25
/**
26
* Constructs an instance definition.
27
*
28
* @param string|null $identifier The identifier of the entry in the container. Can be null if the entry is anonymous (declared inline in other instances)
29
* @param string $value The value of the parameter. It is expected to be a scalar or an array (or more generally anything that can be `var_export`ed)
30
*/
31
public function __construct($identifier, $value)
32
{
33
$this->identifier = $identifier;
34
$this->value = $value;
35
}
36
37
/**
38
* Returns the identifier of the instance.
39
*
40
* @return string
41
*/
42
public function getIdentifier()
43
{
44
return $this->identifier;
45
}
46
47
/**
48
* Returns the value of the parameter.
49
*
50
* @return mixed
51
*/
52
public function getValue()
53
{
54
return $this->value;
55
}
56
57
/**
58
* Returns an InlineEntryInterface object representing the PHP code necessary to generate
59
* the container entry.
60
*
61
* @param string $containerVariable The name of the variable that allows access to the container instance. For instance: "$container", or "$this->container"
62
* @param array $usedVariables An array of variables that are already used and that should not be used when generating this code.
63
*
64
* @return InlineEntryInterface
65
*/
66
public function toPhpCode($containerVariable, array $usedVariables = array())