/**
* @param callable $callback
* @param int $attempts
- * @param float $pauseBetweenAttemps in seconds
+ * @param float $pauseBetweenAttempts in seconds
* @return mixed
*/
- public static function retryOnError(callable $callback, $attempts = 3, $pauseBetweenAttemps = 0)
+ public static function retryOnError(callable $callback, $attempts = 3, $pauseBetweenAttempts = 0)
{
try {
return call_user_func($callback);
} catch (\Exception $e) {
- if ($attemps > 0) {
+ if ($attempts > 0) {
if ($pauseBetweenAttemps > 0) {
- usleep($pauseBetweenAttemps / 1000000);
+ usleep($pauseBetweenAttempts / 1000000);
}
return self::retryOnError($callback, $attempts - 1);
}