77[ ![ Code style] [ Style image ]] [ Style ]
88
99Retry provides a function to retry failing operations. An operation is deemed to have failed if it throws an exception.
10+ This library is a rewrite of [ Igor Wiedler's retry] ( https://github.com/igorw/retry ) but aims to remain faithful to the
11+ spirit of the original.
1012
1113Requirements
1214------------
@@ -17,18 +19,19 @@ Requirements
1719Usage
1820-----
1921
20- The ` retry ` function has the following signature.
22+ The ` retry ` function retries an operation up to the specified number of times with an optional error handler and has
23+ the following signature.
2124
2225```
2326retry(int $times, callable $operation, callable $onError = null);
2427```
25- * ` $times ` specifies how many times the operation may be called .
26- * ` $operation ` is a callback to be run up to the specified number of times.
27- * ` $onError ` is called immediately before retrying the operation.
28+ * ` $times ` & mdash ; Maximum number of times the operation may run .
29+ * ` $operation ` & mdash ; Operation to run up to the specified number of times.
30+ * ` $onError ` & mdash ; Optional. Error handler called immediately before retrying the operation.
2831
29- Note that in the [ original library] ( https://github.com/igorw/retry ) , ` $times ` specified the number of * retries* and
30- therefore the operation could run up to ` n + 1` times. In this version, ` $times ` specifies exactly the number of
31- times the operation may run such that if zero (` 0 ` ) is specified it will never run.
32+ Note in the original library, ` $times ` specifies the number of * retries* and therefore the operation could run up to
33+ ` $times + 1` times. In this version, ` $times ` specifies exactly the number of times the operation may run such that if
34+ zero (` 0 ` ) is specified it will not run.
3235
3336### Example
3437
0 commit comments