ContainerParametersResource.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\Config;
  11. use Symfony\Component\Config\Resource\ResourceInterface;
  12. /**
  13. * Tracks container parameters.
  14. *
  15. * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
  16. *
  17. * @final
  18. */
  19. class ContainerParametersResource implements ResourceInterface
  20. {
  21. private $parameters;
  22. /**
  23. * @param array $parameters The container parameters to track
  24. */
  25. public function __construct(array $parameters)
  26. {
  27. $this->parameters = $parameters;
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function __toString(): string
  33. {
  34. return 'container_parameters_'.md5(serialize($this->parameters));
  35. }
  36. /**
  37. * @return array Tracked parameters
  38. */
  39. public function getParameters(): array
  40. {
  41. return $this->parameters;
  42. }
  43. }