2017 © Pedro Peláez
 

library repeat

Repeater utility. Work with repeated actions in a simple way.

image

jamsouf/repeat

Repeater utility. Work with repeated actions in a simple way.

  • Sunday, April 5, 2015
  • by jamsouf
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Repeat

Latest Stable Version Build Status, (*1)

Repeat is a repeater utility for PHP / Composer.
It makes it easy to repeat calling a function or similar operations., (*2)

Installation

Via composer

Install the latest version with composer require jamsouf/repeat, (*3)

``` php require 'vendor/autoload.php';, (*4)


Examples ----- ##### Call a anonymous function 100 times ``` php $results = Repeat::_function(100, function () { // your function code });
Call a named function and access in each call the current result

``` php $calculate = function ($result) { // your function code };, (*5)

$results = Repeat::_function(20, $calculate);, (*6)


##### Call a named function until a specific condition ``` php $calculate = function ($result) { // your function code }; $until = function ($result) { // return true or false }; $results = Repeat::_function(50, $calculate, $until);
Repeat a string with index reference and delimiter until a specific condition

``` php $result = Repeat::_string(10, 'v1.{j}.{i}', function ($result) { return strpos($result, '.4.') !== false ? true : false; }, ', ');, (*7)

// => v1.1.0, v1.2.1, v1.3.2, v1.4.3 ```, (*8)

API Documentation

Repeat::_function($count, $func, $until = _null_)

Repeat calling a function * integer $count: How often the function should be called * callable $func: Function to call repeated * callable $until (optional): Repeat calling until this function returns true * => return array: Results from each function call, (*9)

Repeat::_string($count, $string, $until = _null_, $delimiter = _null_)

Repeat a string * integer $count: How often the string should be repeated * string $string: String to repeat * callable $until (optional): Repeat the string until this function returns true * string $delimiter (optional): Signs to separate the strings * => return string: Repeated string, (*10)

The Versions

05/04 2015

dev-master

9999999-dev

Repeater utility. Work with repeated actions in a simple way.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

call iterate repeat times

08/03 2015

v1.0.0

1.0.0.0

Repeater utility. Work with repeated actions in a simple way.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

call iterate repeat times