AbstractArgument.php 925 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /**
  12. * Represents an abstract service argument, which have to be set by a compiler pass or a DI extension.
  13. */
  14. final class AbstractArgument
  15. {
  16. private $text;
  17. private $context;
  18. public function __construct(string $text = '')
  19. {
  20. $this->text = trim($text, '. ');
  21. }
  22. public function setContext(string $context): void
  23. {
  24. $this->context = $context.' is abstract'.('' === $this->text ? '' : ': ');
  25. }
  26. public function getText(): string
  27. {
  28. return $this->text;
  29. }
  30. public function getTextWithContext(): string
  31. {
  32. return $this->context.$this->text.'.';
  33. }
  34. }