unrealmanu/abstract-walker
Composer 安装命令:
composer require unrealmanu/abstract-walker
包简介
walker recursive abstract helper
关键字:
README 文档
README
Manuel Trebbi unrealmanumaster@gmail.com
Walk on the deepest level of object or array with filter by instance and control of deep level
CMD LIST
Launch TEST:
composer test tests
Fix LINT
composer fix tests
composer fix src
Install GIT-HOOK
./scripts/install-hook.bash
USAGE
Extends unrealmanu\Walker\AbstractWalker
example:
- ./tests/Walk.php
Necessary Method
abstract function loadChildren(array $parent): array; /** * @param $parent * @return array */ public function walk($parent): array; /** * @param $parent * @return Generator */ public function walkGen($parent): Generator;
METHOD
Define action to get object/array childrens and return this
LoadChidren($parent)
Return array of walked elements
walk($parent) [low performance - easy to use and check]
Return the "raw" generator used for walking in the deepest of elements...
walkGen($parent) [best perfomance]
OPTIONS
unrealmanu\Walker\DTO\WalkOptions (predefined)
unrealmanu\Walker\DTO\WalkOptionsInterface (for future implementation)
true = recursive, false = stop in first depth level
public function setRecursiveProcessStatus(bool $status = true): bool;
Set Class instance for filter the children in walking process
public function setFilterInstance(array $class): array;
Set the limit of deepest recursion level
public function setRecursiveDepthLimit(int $recursiveDepthLimit): void;
Make your custom logic filter for item in recursive processes
public function itemFilter($item): bool
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-22