Download the PHP package mead-steve/spl-fix without Composer
On this page you can find all versions of the php package mead-steve/spl-fix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mead-steve/spl-fix
More information about mead-steve/spl-fix
Files in mead-steve/spl-fix
Package spl-fix
Short Description The spl has some really cool features but some odd naming conventions and some real GOTCHAs. This library is intended to make the spl code easier to use
License MIT
Informations about the package spl-fix
spl-fix
The php spl has some really cool feaures but also some bugs/gotchas. This is a library to wrap and hopefully reduce the pain caused by the spl.
Installation
The easiest way to install this library is using composer. In your project's composer.json
file add:
Then run composer update
.
Fixes
LimitIterator
The limit iterator is very useful if you want to grab a subset of an iterator. Good right? Pass it to count() however and you'll always get a value of 1. This package provides an updated LimitIterator class that correctly implements countable.
EmptyIterator
Fixed so that passing it to count() returns zero. It's empty after all.
FilterIterator
The spl FilterIterator can only be passed an iterator. This is now wrapped so that any traversable can be passed in. This is handled by wrapping the traversable in an IteratorIterator. The following child Iterators have also been wrapped:
- RegexIterator
Additions
RecursingArrayIterator
This is a short hand for wrapping an array in a RecursiveIterator then wrapping that in a RecursiveIteratorIterator.
Helpers/IteratorWalker
The IteratorWalker allows iterators to be used in the same way arrays are used in array_walk. So that the two snippets will behave in the same way: