2017 © Pedro Peláez
 

library retry

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

image

mcprohosting/retry

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

  • Friday, May 30, 2014
  • by connor4312
  • Repository
  • 18 Watchers
  • 0 Stars
  • 61 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 7 % Grown

The README.md

retry

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., (*1)

RETRY, (*2)

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); }

The Versions

30/05 2014

dev-master

9999999-dev

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

  Sources   Download

MIT

The Development Requires

by Connor Peet

30/05 2014

0.0.1

0.0.1.0

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

  Sources   Download

MIT

The Development Requires

by Connor Peet

30/05 2014

1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Development Requires

by Connor Peet