Configuration.php 933 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Aws\S3\RegionalEndpoint;
  3. class Configuration implements ConfigurationInterface
  4. {
  5. private $endpointsType;
  6. private $isFallback;
  7. public function __construct($endpointsType, $isFallback = false)
  8. {
  9. $this->endpointsType = strtolower($endpointsType);
  10. $this->isFallback = $isFallback;
  11. if (!in_array($this->endpointsType, ['legacy', 'regional'])) {
  12. throw new \InvalidArgumentException(
  13. "Configuration parameter must either be 'legacy' or 'regional'."
  14. );
  15. }
  16. }
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public function getEndpointsType()
  21. {
  22. return $this->endpointsType;
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function toArray()
  28. {
  29. return [
  30. 'endpoints_type' => $this->getEndpointsType()
  31. ];
  32. }
  33. public function isFallback()
  34. {
  35. return $this->isFallback;
  36. }
  37. }