From 739d6b68a93e4a46d94edae681b2fea13d93f39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Lundb=C3=B8l?= Date: Wed, 18 Apr 2018 14:14:22 +0200 Subject: [PATCH] Add None transformer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Lundbøl --- src/Transformers/NoneTransformer.php | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Transformers/NoneTransformer.php diff --git a/src/Transformers/NoneTransformer.php b/src/Transformers/NoneTransformer.php new file mode 100644 index 0000000..98482d3 --- /dev/null +++ b/src/Transformers/NoneTransformer.php @@ -0,0 +1,35 @@ +toArray(); + } + + return Arr::wrap($data); + } + + /** + * @param array|Arrayable $data + * @return array + */ + public function transformOutput($data): array + { + if ($data instanceof Arrayable) { + return $data->toArray(); + } + + return Arr::wrap($data); + } +}