guglielmopepe/recursivecallbackmapiterator
Composer 安装命令:
composer require guglielmopepe/recursivecallbackmapiterator
包简介
This iterator applies recursively the callback to the elements of the given iterator.
README 文档
README
This iterator applies recursively the callback to the elements of the given iterator.
Table of Contents
Installation
Use Composer
$ composer require guglielmopepe/recursivecallbackmapiterator
Usage
The callback should accept up to three arguments: the current item, the current key and the iterator, respectively.
<?php /** * Callback for RecursiveCallbackMapIterator * * @param $current Current item's value * @param $key Current item's key * @param $iterator Iterator being filtered * @return mixed The item after it has been applied the callback function */ function my_callback($current, $key, $iterator) { // Your code here } ?>
Any callable may be used; such as a string containing a function name, an array for a method, or an anonymous function.
<?php $data = ['foo'=>['foo','bar'],'bar'=>['bar','foo']]; // A callback function my_callback($current, $key, $iterator) { if ($key % 2 == 0) { return $current; } return \strtoupper($current); } // Applies callback $iterator = new \RecursiveCallbackMapIterator\RecursiveCallbackMapIterator(new \RecursiveArrayIterator($data), 'my_callback'); ?>
Support
If you have a request, please create a GitHub issue.
If you discover a security vulnerability, please send an email to Guglielmo Pepe at info@guglielmopepe.com. All security vulnerabilities will be promptly addressed.
Contributing
If you want to say thank you and/or support the active development of RecursiveCallbackMapIterator:
- Add a GitHub Star to the project.
- Share the project on social media.
- Write a review or tutorial on Medium, Dev.to or personal blog.
Contacts
If you need information please send an email to info@guglielmopepe.com.
Roadmap
See the list of open issues:
Change log
Please see Changelog file for more information on what has changed recently.
License
Distributed under the MIT License. Please see License File for more information.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-16