Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\DependencyInjection\Compiler; Chris@0: Chris@0: /** Chris@0: * Represents an edge in your service graph. Chris@0: * Chris@0: * Value is typically a reference. Chris@0: * Chris@0: * @author Johannes M. Schmitt Chris@0: */ Chris@0: class ServiceReferenceGraphEdge Chris@0: { Chris@0: private $sourceNode; Chris@0: private $destNode; Chris@0: private $value; Chris@14: private $lazy; Chris@14: private $weak; Chris@17: private $byConstructor; Chris@0: Chris@0: /** Chris@0: * @param ServiceReferenceGraphNode $sourceNode Chris@0: * @param ServiceReferenceGraphNode $destNode Chris@14: * @param mixed $value Chris@14: * @param bool $lazy Chris@14: * @param bool $weak Chris@17: * @param bool $byConstructor Chris@0: */ Chris@17: public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false, $weak = false, $byConstructor = false) Chris@0: { Chris@0: $this->sourceNode = $sourceNode; Chris@0: $this->destNode = $destNode; Chris@0: $this->value = $value; Chris@14: $this->lazy = $lazy; Chris@14: $this->weak = $weak; Chris@17: $this->byConstructor = $byConstructor; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the value of the edge. Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getValue() Chris@0: { Chris@0: return $this->value; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the source node. Chris@0: * Chris@0: * @return ServiceReferenceGraphNode Chris@0: */ Chris@0: public function getSourceNode() Chris@0: { Chris@0: return $this->sourceNode; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the destination node. Chris@0: * Chris@0: * @return ServiceReferenceGraphNode Chris@0: */ Chris@0: public function getDestNode() Chris@0: { Chris@0: return $this->destNode; Chris@0: } Chris@14: Chris@14: /** Chris@14: * Returns true if the edge is lazy, meaning it's a dependency not requiring direct instantiation. Chris@14: * Chris@14: * @return bool Chris@14: */ Chris@14: public function isLazy() Chris@14: { Chris@14: return $this->lazy; Chris@14: } Chris@14: Chris@14: /** Chris@14: * Returns true if the edge is weak, meaning it shouldn't prevent removing the target service. Chris@14: * Chris@14: * @return bool Chris@14: */ Chris@14: public function isWeak() Chris@14: { Chris@14: return $this->weak; Chris@14: } Chris@17: Chris@17: /** Chris@17: * Returns true if the edge links with a constructor argument. Chris@17: * Chris@17: * @return bool Chris@17: */ Chris@17: public function isReferencedByConstructor() Chris@17: { Chris@17: return $this->byConstructor; Chris@17: } Chris@0: }