forged-collections / iterators
A collection of iterators.
v0.1.1
2024-12-17 12:23 UTC
Requires
- php: ^8.2
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.2
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.4
This package is auto-updated.
Last update: 2025-04-18 02:07:37 UTC
README
A collection of useful iterators.
Dependencies
None.
Installation
composer require forged-collections/iterators
Usage
Iterators:
- FlipIterator : Flips an iterator's keys and values.
- CombinedIterator : Combines two iterators, using one for the keys and the second for the values.
- CountableEmptyIterator : Extends EmptyIterator and implements Countable.
- IteratorKeysIterator : Iterate the keys of another iterator with an index as key.
- ReindexIterator : Iterates another iterators values within an index as key
Abstract iterators:
- AbstractIndexIterator : Maintains a zero based index for iterators that provide index for the key.
Testing
Testing is performed by PhpUnit and run in Docker containers, one for each supported version of PHP.
To run all tests for all PHP versions:
docker compose --profile=phpunit up
That command tests all PHP version in parallel, which can make understanding the test output difficult. To work around this run them individually (or see Test Reports):
# Run PHP 8.3 test only
docker compose --profile=phpunit up phpunit83
Test reports
Multiple reports are written for each PHP version.
/build/<php-version>/testdox.txt
: Human friendly plaintext report of passed/failing tests../build/<php-version>/testdox.html
: As above, but formatted with HTML../build/<php-version>/coverage
: Project's test coverage report in HTML./build/<php-version>/compose.lock
: Copy of composer's lock file for local replication and debugging.
You can also see the test runners actual output with the command:
docker compose --profile=phpunit logs <container>
For example to see the output from PHP 8.3
docker compose --profile=phpunit logs phpunit83
Debugging tests
TODO