new files

This commit is contained in:
panchengyong
2026-03-07 22:29:07 +08:00
parent cd7e80b502
commit 7acbf45ff7
12516 changed files with 1808447 additions and 194 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace STS\Backoff\Strategies;
/**
* Class PolynomialStrategy
* @package STS\Backoff\Strategies
*/
class PolynomialStrategy extends AbstractStrategy
{
/**
* @var int
*/
protected $degree = 2;
/**
* PolynomialStrategy constructor.
*
* @param int $degree
* @param int $base
*/
public function __construct($base = null, $degree = null)
{
if(!is_null($degree)) {
$this->degree = $degree;
}
parent::__construct($base);
}
/**
* @param int $attempt
*
* @return int
*/
public function getWaitTime($attempt)
{
return (int) pow($attempt, $this->degree) * $this->base;
}
/**
* @return int|null
*/
public function getDegree()
{
return $this->degree;
}
}