mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-20 13:23:47 -07:00
v2: Updates
* Simplifies & beautifies everything * Introduces a new Class system. * Errors are defaulted to AWS's handler. * New function names & more efficient handling. * Should fix a majority of the errors. Please read the README for more!
This commit is contained in:
parent
ad0726e41e
commit
e6d7753dc8
1095 changed files with 45088 additions and 2911 deletions
61
aws/Aws/Retry/Configuration.php
Normal file
61
aws/Aws/Retry/Configuration.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
namespace Aws\Retry;
|
||||
|
||||
use 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(),
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue