mcprohosting/retry 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mcprohosting/retry

Composer 安装命令:

composer require mcprohosting/retry

包简介

while (!$success) { tryAgain(); }

README 文档

README

Retry is a useful class to allow you to retry tasks until they work, optionally setting a delay between iterations, including flexible conditioning and readable syntax.

RETRY

Usage

// This retries running the given function until "working" is returned. It retries
// up to ten times, pausing for 1000 ms (one second) in between attempts.

Retry::running(function () {
    if (doSomething()) {
        return 'working';
    } else {
        return 'broken';
    }
})->whileIsnt('working')
  ->delay(1000)
  ->go(10);

// Passing a callable in "soLongAs" allows you to transform the output before
// testing its value. Retry will also return the last value gotten from
// running(), if it did ever succeed, or the boolean false if it did not.

$arrayThing = Retry::running(function () {
    return complicatedArrayThing();
})->soLongAs(function ($arrayThing) {
    return !! $arrayThing;
})->is(false)->go(5);

if ($arrayThing === false) {
    echo "We're out of ArrayThings today!";
} else {
    echo "Here's your ArrayThing!";
    var_dump($arrayThing);
}

统计信息

  • 总下载量: 71
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 17
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固