承接 doekenorg/iterator-functions 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

doekenorg/iterator-functions

最新稳定版本:v1.0.1

Composer 安装命令:

composer require doekenorg/iterator-functions

包简介

A package that provides array_* like functions for iterators.

README 文档

README

Latest Version on Packagist Tests

The doekenorg/iterator-functions package provides a curated set of array_* like functions for iterators in PHP. This package is built to encourage developers to make more use of Iterators by simplifying common tasks.

Available functions

All available functions are modeled after their array_* equivalent. But instead of returning an array it will return an Iterator instance. This means that you can use them in the same way, but get the added memory preserving benefits.

  • iterator_column(\Traversable $iterator, $column_key, $index_key = null): ColumnIterator
  • iterator_filter(Iterator $iterator, ?callable $callback = null): \CallbackFilterIterator
  • iterator_flip(Iterator $iterator): FlipIterator
  • iterator_keys(\Iterator $iterator): KeysIterator
  • iterator_map(callable $callback, iterable ...$iterators): MapIterator
  • iterator_reduce(\Iterator $iterator, callable $callback, $initial = null)
  • iterator_values(\Iterator $iterator): ValuesIterator
  • iterator_walk(\Iterator $iterator, callable $callback, ...$arguments): void

Note: There are no _diff or _intersect functions available, because these are not possible without forgoing on the memory benefits of iterators.

Available iterators

Where possible the functions make use of native iterators. Any missing iterators were added to this package.

  • ColumnIterator - Iterator that returns a single column for the iteration array / object.
  • FlipIterator - Iterator that flips the key and the value of the current iteration.
  • KeysIterator - Iterator that returns only the keys of the provided iterator.
  • MapIterator - Iterator that applies a callback to the elements of the given iterators.
  • ValuesIterator - Iterator that returns only the values of the provided iterator.

Install

You can install the package via composer:

composer require doekenorg/iterator-functions

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

./vendor/bin/pest

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 5.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 67
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 67
  • Watchers: 5
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固