poirot / core
This package is abandoned and no longer maintained.
The author suggests using the poirot/std package instead.
There is no license information available for the latest version (0.2) of this package.
Poirot Standard Libraries and Base Functionality.
0.2
2016-02-29 11:30 UTC
This package is not auto-updated.
Last update: 2019-02-20 18:19:47 UTC
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