dhii/iterator-interface
最新稳定版本:v0.1-alpha1
Composer 安装命令:
composer require dhii/iterator-interface
包简介
Interfaces for standard iterators
README 文档
README
Details
An iterator standard, which aims to provide more information about each iteration by exposing an immutable iteration
object. This object can be safely passed to other methods, even those which save the reference to it, as a new object
is created for every iteration. That object can provide additional information besides the current key and value.
This makes implementations of this standard easier to work with than other iterator implementations, such as
DirectoryIterator, which expose iteration data through the iterator itself, instead of a separate object, making
it hard to keep iteration data immutable. The fact that its manipulator methods are allowed to throw a specific type
of exception make it possible to create more reliable consumers with meaningful error reporting.
Features
- All standards-compliant iterators are PHP iterators.
- Iteration information provided via immutable and extensible iteration objects.
- Easier to keep track of iteration information: each iteration produces a separate iteration object.
- Specialized iterator types can be created on interface level by promising custom iteration types.
Interfaces
IteratorInterface- Extends the nativeIteratorby exposing a disposable iteration object. Also promises to throw a specific kind of meaningful exception when rewinding or advancing.IterationInterface- Exposes the key and the value of an iteration.IteratorAwareInterface- Exposes an iterator.RecursiveIteratorInterface- An iterator that iterates over other iterators recursively.RecursiveIterationInterface- An iteration of a recursive iterator. Exposes the depth of the iterator hierarchy, and the path to the current iteration in that hierarchy.DepthAwareIterationInterface- An iteration that can tell how deep it is in a hierarchy.PathSegmentsAwareIterationInterface- An iteration that can tell the path to itself in a hierarchy.IteratingExceptionInterface- An exception that can occur during iteration.IterationExceptionInterface- An iterating exception that relates to an iteration.IteratorExceptionInterface- An iteration exception that relates to an iterator.
统计信息
- 总下载量: 8.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-25