FyreIterator is a free, open-source iteration library for PHP.
Using Composer
composer require fyre/iterator
In PHP:
use Fyre\Utility\Iterator;
Add
Add a test
$name
is a string representing the test name.$callback
is the callback to execute.
Iterator::add($name, $callback);
All
Get all tests.
$tests = Iterator::all();
Clear
Clear all tests.
Iterator::clear();
Count
Get the number of tests.
$testCount = Iterator::count();
Get
Get a specific test callback.
$name
is a string representing the test name.
$test = Iterator::get($name);
Has
Determine whether a test exists.
$name
is a string representing the test name.
$hasTest = Iterator::has($name);
Remove
Remove a test.
$name
is a string representing the test name.
$removed = Iterator::remove($name);
Run
Run the tests and return the results.
$iterations
is a number representing the number of iterations to run, and will default to 1000.
$results = Iterator::run($iterations);