2017 © Pedro Peláez
 

library spl-fix

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

image

mead-steve/spl-fix

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

  • Thursday, February 5, 2015
  • by MeadSteve
  • Repository
  • 2 Watchers
  • 5 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

spl-fix

Build Status Latest Stable Version License, (*1)

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., (*2)

Installation

The easiest way to install this library is using composer. In your project's composer.json file add:, (*3)

    {
        "require": {
            "mead-steve/spl-fix": "dev-master"
        }
    }

Then run composer update., (*4)

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., (*5)

EmptyIterator

Fixed so that passing it to count() returns zero. It's empty after all., (*6)

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, (*7)

Additions

RecursingArrayIterator

This is a short hand for wrapping an array in a RecursiveIterator then wrapping that in a RecursiveIteratorIterator., (*8)

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:, (*9)

    array_walk($array, function($value, $key) {
        echo $key . "=>" . $value;
    });
    $walker = new IteratorWalker($iterator);
    $walker->walk(function($value, $key) {
        echo $key . "=>" . $value;
    });

The Versions

05/02 2015

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Steve B

25/02 2014

v0.2.0

0.2.0.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

25/02 2014

v0.1.0

0.1.0.0

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

  Sources   Download

MIT

The Requires

  • php >=5.3.0