chekote / noun-store
存储并处理名词
v5.1.0
2024-09-17 17:39 UTC
Requires
- php: >=8.1
- illuminate/support: ^5.0
Requires (Dev)
- phake/phake: ^4.0
- phpunit/phpunit: ^10.0
README
noun-store
存储并处理名词。
用法
- 将其添加到需求中
composer require chekote/noun-store
创建存储库
$store = new \Chekote\NounStore\Store();
存储某些内容
$john = new Person(); $john->firstName = 'John'; $john->lastName = 'Smith'; $store->set('best friend', $john);
检查我们是否有某些内容
$store->keyExists('best friend');
断言我们是否有某些内容
$assert = new \Chekote\NounStore\Assert($store); $assert->keyExists('best friend');
检索某些内容
$store->get('best friend');
使用相同键存储其他内容
$chris = new Person(); $chris->firstName = 'Chris'; $chris->lastName = 'Pratt'; $store->set('best friend', $chris);
检索新内容
$store->get('best friend'); or $store->get('2nd best friend');
检索旧内容
$store->get('1st best friend');
清空存储库
$store->reset();
开发
安装开发前置条件
安装 Docker。
您还需要确保 ./bin
在您的 $PATH
中,并且具有最高优先级。您可以通过将以下内容添加到您的shell配置文件中来实现
export PATH=./bin:$PATH
为开发安装项目
克隆仓库
git clone git@github.com:Chekote/noun-store.git
cd noun-store
执行测试
测试是用 phpunit 编写的。您可以通过命令行执行它们
phpunit