poirot/core
最新稳定版本:0.2
Composer 安装命令:
composer require poirot/core
包简介
Poirot Standard Libraries and Base Functionality.
README 文档
README
Poirot\Std is a set of components that implements general purpose utility
class for different scopes like:
- array utilities functions;
- TODO
- File issues at https://github.com/phPoirot/std/issues
- Documentation is at TODO
Invokable Responder
class SayHi
{
function __construct($name, $family)
{
$this->name = $name;
$this->family = $family;
}
function __toString()
{
return sprintf('Hello %s %s.', $this->name, $this->family);
}
}
$inv1 = function () {
return ['name' => 'Payam'];
};
$inv2 = function ($name, $family) {
return new SayHi($name, $family);
};
$invokable = new InvokableResponder(function() {
return ['family' => 'Naderi'];
});
$invokable = $invokable
->thenWith($inv1)
->thenWith($inv2)
->thenWith(function (SayHi $message) {
return (string) $message;
})->setIdentifier('hello')
;
$r = $invokable(['family' => 'Payami'])['hello'];
// Hello Payam Payami
统计信息
- 总下载量: 133
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-12-02