https://github.com/elusivecodes/fyreiterator
FyreIterator is a free, open-source iteration library for PHP.
https://github.com/elusivecodes/fyreiterator
iterator php utility
Last synced: 7 months ago
JSON representation
FyreIterator is a free, open-source iteration library for PHP.
- Host: GitHub
- URL: https://github.com/elusivecodes/fyreiterator
- Owner: elusivecodes
- License: mit
- Created: 2021-06-09T09:12:15.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-17T13:36:22.000Z (8 months ago)
- Last Synced: 2024-10-19T19:18:04.576Z (8 months ago)
- Topics: iterator, php, utility
- Language: PHP
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FyreIterator
**FyreIterator** is a free, open-source iteration library for *PHP*.
## Table Of Contents
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)## Installation
**Using Composer**
```
composer require fyre/iterator
```In PHP:
```php
use Fyre\Utility\Iterator;
```## Basic Usage
```php
$iterator = new Iterator();
```## Methods
**Add**
Add a test
- `$name` is a string representing the test name.
- `$callback` is the callback to execute.```php
$iterator->add($name, $callback);
```**All**
Get all tests.
```php
$tests = $iterator->all();
```**Clear**
Clear all tests.
```php
$iterator->clear();
```**Count**
Get the number of tests.
```php
$count = $iterator->count();
```**Get**
Get a specific test callback.
- `$name` is a string representing the test name.
```php
$test = $iterator->get($name);
```**Has**
Determine whether a test exists.
- `$name` is a string representing the test name.
```php
$hasTest = $iterator->has($name);
```**Remove**
Remove a test.
- `$name` is a string representing the test name.
```php
$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*.
```php
$results = $iterator->run($iterations);
```