]> _ Git - cubist_util.git/commitdiff
try #6202
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 22 Aug 2023 07:26:40 +0000 (09:26 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 22 Aug 2023 07:26:40 +0000 (09:26 +0200)
src/PHP.php

index 73d65096409027df8e5a6c255ed69d3317ff4702..b6e51c6baf604a9ffbe617400d9707fa8629bf50 100644 (file)
@@ -81,17 +81,17 @@ class PHP
     /**
      * @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);
             }