Skip to content

[9.x] Add ability to push additional pipes onto a pipeline via chain($pipes)#41256

Merged
taylorotwell merged 5 commits into
laravel:9.xfrom
stevebauman:feature-pipeline-chain
Feb 28, 2022
Merged

[9.x] Add ability to push additional pipes onto a pipeline via chain($pipes)#41256
taylorotwell merged 5 commits into
laravel:9.xfrom
stevebauman:feature-pipeline-chain

Conversation

@stevebauman

@stevebauman stevebauman commented Feb 25, 2022

Copy link
Copy Markdown
Contributor

Description

This PR adds the ability to push additional pipes onto a pipeline via a chain() method.

This allows us to create a pipeline instance and pass it around the application, appending pipes onto the chain, rather than having to define all of the pipes in a single place:

$pipeline = new Pipeline();

$pipeline->chain(fn ($object, $next) => $next($object));
$pipeline->chain(fn ($object, $next) => $next($object));

$pipeline->send($object)->thenReturn();

Let me know if you would like anything adjusted. Thanks for your time! ❤️

@taylorotwell

Copy link
Copy Markdown
Member

Any thoughts on naming this method pipe instead of chain?

@stevebauman

Copy link
Copy Markdown
Contributor Author

Yea, I'm cool with that name 👍

@taylorotwell taylorotwell merged commit 219e0ea into laravel:9.x Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants