poirot/core 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

poirot/core

最新稳定版本:0.2

Composer 安装命令:

composer require poirot/core

包简介

Poirot Standard Libraries and Base Functionality.

README 文档

README

Build Status

Poirot\Std is a set of components that implements general purpose utility class for different scopes like:

  • array utilities functions;
  • 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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-12-02