ServiceReferenceGraphEdge.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Compiler;
  11. /**
  12. * Represents an edge in your service graph.
  13. *
  14. * Value is typically a reference.
  15. *
  16. * @autor ThurData <info@thurdata.ch>
  17. */
  18. class ServiceReferenceGraphEdge
  19. {
  20. private $sourceNode;
  21. private $destNode;
  22. private $value;
  23. private $lazy;
  24. /**
  25. * @param ServiceReferenceGraphNode $sourceNode
  26. * @param ServiceReferenceGraphNode $destNode
  27. * @param mixed $value
  28. * @param bool $lazy
  29. */
  30. public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false)
  31. {
  32. $this->sourceNode = $sourceNode;
  33. $this->destNode = $destNode;
  34. $this->value = $value;
  35. $this->lazy = $lazy;
  36. }
  37. /**
  38. * Returns the value of the edge.
  39. *
  40. * @return string
  41. */
  42. public function getValue()
  43. {
  44. return $this->value;
  45. }
  46. /**
  47. * Returns the source node.
  48. *
  49. * @return ServiceReferenceGraphNode
  50. */
  51. public function getSourceNode()
  52. {
  53. return $this->sourceNode;
  54. }
  55. /**
  56. * Returns the destination node.
  57. *
  58. * @return ServiceReferenceGraphNode
  59. */
  60. public function getDestNode()
  61. {
  62. return $this->destNode;
  63. }
  64. /**
  65. * Returns true if the edge is lazy, meaning it's a dependency not requiring direct instantiation.
  66. *
  67. * @return bool
  68. */
  69. public function isLazy()
  70. {
  71. return $this->lazy;
  72. }
  73. }