mamazu / partial-functions
This package is abandoned and no longer maintained.
No replacement package was suggested.
There is no license information available for the latest version (1.0.0) of this package.
Applying partial functions
1.0.0
2020-09-29 16:29 UTC
Requires
- php: ^7.3
Requires (Dev)
- mamazu/documentation-validator: ^1.2
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-12-20 23:17:46 UTC
README
This library provides a partial function interface for php.
Usage
The simpletest way to use it with the FunctionInvoker:
function f(string $greeting = 'Hello', string $name = 'you') { return $greeting.', '.$name; } echo \Mamazu\PartialFunctions\FunctionInvoker::invoke('f', ['name' => 'Anonymous']); // Will echo "Hello, Anonymous"
Object oriented
$factory = new \Mamazu\PartialFunctions\PartialFunctionFactory(); $searchInString = $factory->createForCallable('strpos'); $searchInString->apply(['haystack' => 'Hello in PHP']); $hellopos = $searchInString->call(['needle' => 'hello']); $phppos = $searchInString->call(['needle' => 'php']);