diff options
Diffstat (limited to 'vendor/aws/aws-sdk-php/src/EndpointDiscovery/Configuration.php')
-rw-r--r-- | vendor/aws/aws-sdk-php/src/EndpointDiscovery/Configuration.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/aws/aws-sdk-php/src/EndpointDiscovery/Configuration.php b/vendor/aws/aws-sdk-php/src/EndpointDiscovery/Configuration.php new file mode 100644 index 0000000..dd7d8fb --- /dev/null +++ b/vendor/aws/aws-sdk-php/src/EndpointDiscovery/Configuration.php @@ -0,0 +1,48 @@ +<?php +namespace Aws\EndpointDiscovery; + +class Configuration implements ConfigurationInterface +{ + private $cacheLimit; + private $enabled; + + public function __construct($enabled, $cacheLimit = 1000) + { + $this->cacheLimit = filter_var($cacheLimit, FILTER_VALIDATE_INT); + if ($this->cacheLimit == false || $this->cacheLimit < 1) { + throw new \InvalidArgumentException( + "'cache_limit' value must be a positive integer." + ); + } + + // Unparsable $enabled flag errs on the side of disabling endpoint discovery + $this->enabled = filter_var($enabled, FILTER_VALIDATE_BOOLEAN); + } + + /** + * {@inheritdoc} + */ + public function isEnabled() + { + return $this->enabled; + } + + /** + * {@inheritdoc} + */ + public function getCacheLimit() + { + return $this->cacheLimit; + } + + /** + * {@inheritdoc} + */ + public function toArray() + { + return [ + 'enabled' => $this->isEnabled(), + 'cache_limit' => $this->getCacheLimit() + ]; + } +} |