fyre / iterator
An iterator library.
v4.0.3
2024-06-01 14:26 UTC
Requires (Dev)
- phpunit/phpunit: ^10
README
FyreIterator is a free, open-source iteration library for PHP.
Table Of Contents
Installation
Using Composer
composer require fyre/iterator
In PHP:
use Fyre\Utility\Iterator;
Methods
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);