navarr/iterable-to-array
最新稳定版本:v1.0.1
Composer 安装命令:
composer require navarr/iterable-to-array
包简介
A method for converting an iterable to an array, no matter what type of iterable
README 文档
README
A simple utility class that handles the boilerplate of converting an iterable into an array.
The goal of this utility is to be an in-place replacement for iterator_to_array whenever one must handle an iterable.
Installation
composer require navarr/iterable-to-array
Usage
<?php use Navarr\Utils\IterableToArray // ... $array = IterableToArray::convert($iterable); // This replaces: $array = is_array($iterable) ? $iterable : iterator_to_array($iterable);
This also has (what should be unnecessary) forward compatibility for a scenario where an object passes the iterable type check but is neither an array nor a \Traversable.
统计信息
- 总下载量: 10.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-11-04