We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! I suggest to add variadic variable to __invoke() method.
Example usages (DTO - Data Transfer Object):
$pipeline = (new Pipeline) ->pipe(function ($payload, DTO $dto) { $dto['ten'] = 10; return $payload * 2; }) ->pipe(function ($payload, DTO $dto) { return $payload + $dto['key']; }); $pipeline->process(5, new DTO); //returns 20
process method has ...$params
//https://github.com/thephpleague/pipeline/blob/master/src/Pipeline.php /** * Process the payload. * @param $payload * @return mixed */ public function process($payload, ...$params) { foreach ($this->stages as $stage) { $payload = $stage($payload, ...$params); } return $payload; }
My example (old code, before update): https://github.com/Roquie/pipeline/commits/master
Note: PHP 5.6 required. What do you think about it?
The text was updated successfully, but these errors were encountered:
Maybe $params = array_slice(func_get_args(), 1); solve the problem with older versions
$params = array_slice(func_get_args(), 1);
Sorry, something went wrong.
I actually like this idea a lot. Would you be willing to make a fresh PR?
Ok. It will take me a little time.
@shadowhand check it please #45
No branches or pull requests
Hi!
I suggest to add variadic variable to __invoke() method.
Example usages (DTO - Data Transfer Object):
process method has ...$params
My example (old code, before update): https://github.com/Roquie/pipeline/commits/master
Note: PHP 5.6 required.
What do you think about it?
The text was updated successfully, but these errors were encountered: