src/SellerLabs/Nucleus/Support/Std.php
public static function retry(callable $function, $attempts)
    {
        Arguments::define(Boa::func(), Boa::integer())
            ->check($function, $attempts);

        for ($ii = 0; $ii < $attempts; $ii++) {
            try {
                $result = static::call($function, $ii);

                return $result;
            } catch (Exception $e) {
                continue;
            }
        }

        return null;
    }
public static function retry(callable $function, $attempts)
    {
        Arguments::define(Boa::func(), Boa::integer())
            ->check($function, $attempts);

        for ($ii = 0; $ii < $attempts; $ii++) {
            try {
                $result = static::call($function, $ii);

                return $result;
            } catch (Exception $e) {
                continue;
            }
        }

        return null;
    }
public static function retry ( callable $ function , $ attempts ) { Arguments :: define ( Boa :: func ( ) , Boa :: integer ( ) ) -> check ( $ function , $ attempts ) ; for ( $ ii = 0 ; $ ii < $ attempts ; $ ii ++ ) { try { $ result = static :: call ( $ function , $ ii ) ; return $ result ; } catch ( Exception $ e ) { continue ; } } return null ; }
Attempt call the provided function a number of times until it no longer
throws an exception.

@param callable $function
@param int $attempts

@return mixed|null
@throws InvalidArgumentException
Attempt call the provided function a number of times until it no longer throws an exception .