2011-01-09 09:53:46 +00:00
|
|
|
<?php
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Symfony package.
|
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2011-01-15 13:29:43 +00:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2011-01-09 09:53:46 +00:00
|
|
|
namespace Symfony\Component\DependencyInjection\Compiler;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents an edge in your service graph.
|
|
|
|
*
|
|
|
|
* Value is typically a reference.
|
|
|
|
*
|
|
|
|
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
|
|
|
|
*/
|
|
|
|
class ServiceReferenceGraphEdge
|
|
|
|
{
|
2011-03-11 13:50:46 +00:00
|
|
|
private $sourceNode;
|
|
|
|
private $destNode;
|
|
|
|
private $value;
|
2016-12-13 17:37:51 +00:00
|
|
|
private $lazy;
|
2011-01-09 09:53:46 +00:00
|
|
|
|
2011-02-13 18:06:41 +00:00
|
|
|
/**
|
2011-04-15 20:12:02 +01:00
|
|
|
* @param ServiceReferenceGraphNode $sourceNode
|
|
|
|
* @param ServiceReferenceGraphNode $destNode
|
2012-05-18 18:41:48 +01:00
|
|
|
* @param string $value
|
2016-12-13 17:37:51 +00:00
|
|
|
* @param bool $lazy
|
2011-02-13 18:06:41 +00:00
|
|
|
*/
|
2016-12-13 17:37:51 +00:00
|
|
|
public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false)
|
2011-01-09 09:53:46 +00:00
|
|
|
{
|
|
|
|
$this->sourceNode = $sourceNode;
|
|
|
|
$this->destNode = $destNode;
|
|
|
|
$this->value = $value;
|
2016-12-13 17:37:51 +00:00
|
|
|
$this->lazy = $lazy;
|
2011-01-09 09:53:46 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 18:06:41 +00:00
|
|
|
/**
|
2014-12-21 17:00:50 +00:00
|
|
|
* Returns the value of the edge.
|
2011-02-13 18:06:41 +00:00
|
|
|
*
|
2016-09-02 19:13:13 +01:00
|
|
|
* @return string
|
2011-02-13 18:06:41 +00:00
|
|
|
*/
|
2011-01-09 09:53:46 +00:00
|
|
|
public function getValue()
|
|
|
|
{
|
|
|
|
return $this->value;
|
|
|
|
}
|
|
|
|
|
2011-02-13 18:06:41 +00:00
|
|
|
/**
|
2014-12-21 17:00:50 +00:00
|
|
|
* Returns the source node.
|
2011-02-13 18:06:41 +00:00
|
|
|
*
|
|
|
|
* @return ServiceReferenceGraphNode
|
|
|
|
*/
|
2011-01-09 09:53:46 +00:00
|
|
|
public function getSourceNode()
|
|
|
|
{
|
|
|
|
return $this->sourceNode;
|
|
|
|
}
|
|
|
|
|
2011-02-13 18:06:41 +00:00
|
|
|
/**
|
2014-12-21 17:00:50 +00:00
|
|
|
* Returns the destination node.
|
2011-02-13 18:06:41 +00:00
|
|
|
*
|
|
|
|
* @return ServiceReferenceGraphNode
|
|
|
|
*/
|
2011-01-09 09:53:46 +00:00
|
|
|
public function getDestNode()
|
|
|
|
{
|
|
|
|
return $this->destNode;
|
|
|
|
}
|
2016-12-13 17:37:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the edge is lazy, meaning it's a dependency not requiring direct instantiation.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isLazy()
|
|
|
|
{
|
|
|
|
return $this->lazy;
|
|
|
|
}
|
2011-06-08 11:16:48 +01:00
|
|
|
}
|