ReadOnlyConfiguration.php 802 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of the league/config package.
  5. *
  6. * (c) Colin O'Dell <colinodell@gmail.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace League\Config;
  12. /**
  13. * Provides read-only access to a given Configuration object
  14. */
  15. final class ReadOnlyConfiguration implements ConfigurationInterface
  16. {
  17. private Configuration $config;
  18. public function __construct(Configuration $config)
  19. {
  20. $this->config = $config;
  21. }
  22. /**
  23. * {@inheritDoc}
  24. */
  25. public function get(string $key)
  26. {
  27. return $this->config->get($key);
  28. }
  29. public function exists(string $key): bool
  30. {
  31. return $this->config->exists($key);
  32. }
  33. }