ServiceLocatorArgument.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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\Argument;
  11. use Symfony\Component\DependencyInjection\Reference;
  12. /**
  13. * Represents a closure acting as a service locator.
  14. *
  15. * @author Nicolas Grekas <p@tchwork.com>
  16. */
  17. class ServiceLocatorArgument implements ArgumentInterface
  18. {
  19. use ReferenceSetArgumentTrait;
  20. private $taggedIteratorArgument;
  21. /**
  22. * @param Reference[]|TaggedIteratorArgument $values
  23. */
  24. public function __construct($values = [])
  25. {
  26. if ($values instanceof TaggedIteratorArgument) {
  27. $this->taggedIteratorArgument = $values;
  28. $this->values = [];
  29. } else {
  30. $this->setValues($values);
  31. }
  32. }
  33. public function getTaggedIteratorArgument(): ?TaggedIteratorArgument
  34. {
  35. return $this->taggedIteratorArgument;
  36. }
  37. }