* Constructs a Reference object targeting the $target entry.
17
*
18
* @param string $target
19
*/
20
public function __construct($target)
21
{
22
$this->target = $target;
23
}
24
25
/**
26
* Returns the identifier for the object in the container.
27
*
28
* @return string
29
*/
30
public function getTarget()
31
{
32
return $this->target;
33
}
34
35
/**
36
* Returns an InlineEntryInterface object representing the PHP code necessary to generate
37
* the container entry.
38
*
39
* @param string $containerVariable The name of the variable that allows access to the container instance. For instance: "$container", or "$this->container"
40
* @param array $usedVariables An array of variables that are already used and that should not be used when generating this code.
41
*
42
* @return InlineEntryInterface
43
*/
44
public function toPhpCode($containerVariable, array $usedVariables = array())
45
{
46
return new InlineEntry(sprintf('%s->get(%s)', $containerVariable, var_export($this->getTarget(), true)), null, $usedVariables);