forked from stechstudio/backoff
-
Notifications
You must be signed in to change notification settings - Fork 2
/
aliases.php
45 lines (38 loc) · 1.32 KB
/
aliases.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* JBZoo Toolbox - Retry.
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @see https://github.com/JBZoo/Retry
*/
declare(strict_types=1);
// phpcs:ignoreFile
use JBZoo\Retry\Retry;
use JBZoo\Retry\Strategies\ConstantStrategy;
use JBZoo\Retry\Strategies\ExponentialStrategy;
use JBZoo\Retry\Strategies\LinearStrategy;
use JBZoo\Retry\Strategies\PolynomialStrategy;
use function JBZoo\Retry\retry;
if (!\function_exists('backoff')) {
/**
* @phan-suppress PhanParamTooFewUnpack
* @return mixed
*/
function backoff()
{
return retry(...\func_get_args());
}
}
// @phan-suppress-next-line PhanUndeclaredClassReference
if (!\class_exists(STS\Backoff\Backoff::class)) {
\class_alias(Retry::class, 'STS\Backoff\Backoff');
\class_alias(ConstantStrategy::class, 'STS\Backoff\Strategies\ConstantStrategy');
\class_alias(ExponentialStrategy::class, 'STS\Backoff\Strategies\ExponentialStrategy');
\class_alias(LinearStrategy::class, 'STS\Backoff\Strategies\LinearStrategy');
\class_alias(PolynomialStrategy::class, 'STS\Backoff\Backoff\PolynomialStrategy');
}