# media-cloud-sync/1.2.5/includes/sdk/s3/Aws/Retry/Configuration.php

Media Cloud Sync, version 1.2.5. 45 lines.

- Page: https://pluginprobe.com/plugins/media-cloud-sync/1.2.5/code/includes/sdk/s3/Aws/Retry/Configuration.php
- Raw: https://pluginprobe.com/plugins/media-cloud-sync/1.2.5/raw/includes/sdk/s3/Aws/Retry/Configuration.php
- Modified: 2024-10-27T10:40:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/media-cloud-sync/1.2.5/code/includes/sdk/s3/Aws/Retry/Configuration.php#L10-L20`.

```php
<?php

namespace Dudlewebs\WPMCS\s3\Aws\Retry;

use Dudlewebs\WPMCS\s3\Aws\Retry\Exception\ConfigurationException;
class Configuration implements ConfigurationInterface
{
    private $mode;
    private $maxAttempts;
    private $validModes = ['legacy', 'standard', 'adaptive'];
    public function __construct($mode = 'legacy', $maxAttempts = 3)
    {
        $mode = \strtolower($mode);
        if (!\in_array($mode, $this->validModes)) {
            throw new ConfigurationException("'{$mode}' is not a valid mode." . " The mode has to be 'legacy', 'standard', or 'adaptive'.");
        }
        if (!\is_numeric($maxAttempts) || \intval($maxAttempts) != $maxAttempts || $maxAttempts < 1) {
            throw new ConfigurationException("The 'maxAttempts' parameter has" . " to be an integer >= 1.");
        }
        $this->mode = $mode;
        $this->maxAttempts = \intval($maxAttempts);
    }
    /**
     * {@inheritdoc}
     */
    public function getMode()
    {
        return $this->mode;
    }
    /**
     * {@inheritdoc}
     */
    public function getMaxAttempts()
    {
        return $this->maxAttempts;
    }
    /**
     * {@inheritdoc}
     */
    public function toArray()
    {
        return ['mode' => $this->getMode(), 'max_attempts' => $this->getMaxAttempts()];
    }
}

```
