eastoriented/php-container

一个用于在容器中遍历值的PHP库

dev-master 2019-10-30 09:48 UTC

This package is auto-updated.

Last update: 2024-08-29 05:00:25 UTC


README

eastoriented/php-container 是一个东向的PHP库,用于遍历一些值。所有类中的所有公共方法都返回 void

如何使用它?

文件 src/container.php 定义了接口 eastoriented\php\container
文件 src/container/adt.php 定义了接口 eastoriented\php\container\adt(抽象数据类型)。
文件 src/iterator.php 定义了接口 eastoriented\php\container\iterator
文件 src/iterator/block.php 定义了接口 eastoriented\php\container\iterator\block
要遍历容器,你需要一个迭代器和一块,或者你可以使用抽象数据类型。

use eastoriented\php\{
	container,
	container\iterator,
	container\iterator\block
};

(new container\fromArray(1, null, false, true, new \stdclass, uniqid(), rand(PHP_INT_MIN, PHP_INT_MAX), M-PI))
	->blockForContainerIteratorIs(
		new iterator\fifo,
		new block\functor(
			function($value) { var_dump($value); }
		)
	)
;

(new container\adt\fifo(1, null, false, true, new \stdclass, uniqid(), rand(PHP_INT_MIN, PHP_INT_MAX), M-PI))
	->blockForEachValueIs(
		new block\functor(
			function($value) { var_dump($value); }
		)
	)
;

贡献

关于工作流程

我们使用pull request来引入新功能和错误修复。
请,尽量在提交消息中明确

  1. 解释为什么做出更改;
  2. 解释技术实现(你可以提供任何相关票据、文章或其他资源的链接)。

你可以使用以下模板

# If applied, this commit will...

# Explain why this change is being made

# Provide links to any relevant tickets, articles or other resources

要使用它,只需将其放入(例如)您的家目录中的文本文件中,并将其定义为模板

# git config --global commit.template ~/.git_commit_template.txt

关于测试

要运行单元测试,只需执行 make unit-tests

语言和工具