From 8a389a3aa4d41388669d203192cd7fa4ad36b186 Mon Sep 17 00:00:00 2001 From: Jordan Dalton Date: Tue, 21 Feb 2023 05:02:30 -0600 Subject: [PATCH 1/4] Added Pipeline Helper Function --- src/Illuminate/Support/helpers.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index 7e02604dd12e..27c494913c16 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -427,3 +427,20 @@ function with($value, callable $callback = null) return is_null($callback) ? $value : $callback($value); } } + +if( ! function_exists('pipe')) { + /** + * Pass a payload through a series of pipelines. + * + * @param $payload + * @param array $pipelines + * @return mixed + */ + function pipe($payload, $pipelines = []) + { + return app(\Illuminate\Pipeline\Pipeline::class) + ->send($payload) + ->through($pipelines) + ->thenReturn(); + } +} From dd9b220848eccd25408d65727946ce740caf1f15 Mon Sep 17 00:00:00 2001 From: Jordan Dalton Date: Tue, 21 Feb 2023 05:10:57 -0600 Subject: [PATCH 2/4] Updated Styling for PR --- src/Illuminate/Support/helpers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index 27c494913c16..6285251ccdbb 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -428,12 +428,12 @@ function with($value, callable $callback = null) } } -if( ! function_exists('pipe')) { +if (! function_exists('pipe')) { /** * Pass a payload through a series of pipelines. * * @param $payload - * @param array $pipelines + * @param array $pipelines * @return mixed */ function pipe($payload, $pipelines = []) From dfe5fe60902eee31556d3768100f348928fa357c Mon Sep 17 00:00:00 2001 From: Jordan Dalton Date: Fri, 24 Feb 2023 16:36:18 -0600 Subject: [PATCH 3/4] Converted to return Pipeline so user can choose if they want to use then() or thenReturn() --- src/Illuminate/Support/helpers.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index 6285251ccdbb..068c1e09bdeb 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -432,15 +432,14 @@ function with($value, callable $callback = null) /** * Pass a payload through a series of pipelines. * - * @param $payload - * @param array $pipelines - * @return mixed + * @param $payload + * @param array $pipelines + * @return \Illuminate\Pipeline\Pipeline */ - function pipe($payload, $pipelines = []) + function pipe($payload, $pipelines = []) : Illuminate\Pipeline\Pipeline { return app(\Illuminate\Pipeline\Pipeline::class) ->send($payload) - ->through($pipelines) - ->thenReturn(); + ->through($pipelines); } } From 5b1fa8c697aa79b437d009b83dc79fff536b078d Mon Sep 17 00:00:00 2001 From: Jordan Dalton Date: Fri, 24 Feb 2023 16:39:27 -0600 Subject: [PATCH 4/4] Adjusted for styleci --- src/Illuminate/Support/helpers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index 068c1e09bdeb..7504bf2a05f1 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -433,10 +433,10 @@ function with($value, callable $callback = null) * Pass a payload through a series of pipelines. * * @param $payload - * @param array $pipelines + * @param array $pipelines * @return \Illuminate\Pipeline\Pipeline */ - function pipe($payload, $pipelines = []) : Illuminate\Pipeline\Pipeline + function pipe($payload, $pipelines = []): Illuminate\Pipeline\Pipeline { return app(\Illuminate\Pipeline\Pipeline::class) ->send($payload)