From eb3dfc78cc813604c689071df77480b428b4fcdf Mon Sep 17 00:00:00 2001 From: Mohammad Alavi Date: Mon, 3 Jun 2024 11:18:41 +0330 Subject: [PATCH] feat!: remove unused serializer --- src/Serializers/DataArraySerializer.php | 53 ------------------------- 1 file changed, 53 deletions(-) delete mode 100644 src/Serializers/DataArraySerializer.php diff --git a/src/Serializers/DataArraySerializer.php b/src/Serializers/DataArraySerializer.php deleted file mode 100644 index 18ab398b6..000000000 --- a/src/Serializers/DataArraySerializer.php +++ /dev/null @@ -1,53 +0,0 @@ -filterResponse($data); - } - - private function filterResponse(array $data): array - { - if ($requestFilters = Request::get('filter')) { - return ['data' => $this->filterResponseRecursively($data, explode(';', $requestFilters))]; - } - - return compact('data'); - } - - private function filterResponseRecursively(array $responseArray, array $filters): array - { - foreach ($responseArray as $key => $value) { - if (in_array($key, $filters, true)) { - // we have found our element - so continue with the next one - continue; - } - - if (is_array($value)) { - // it is an array - so go one step deeper - $value = $this->filterResponseRecursively($value, $filters); - $responseArray[$key] = $value; - } elseif (!in_array($key, $filters, true)) { - unset($responseArray[$key]); - } - } - - return $responseArray; - } - - public function item(string|null $resourceKey, array $data): array - { - return $this->filterResponse($data); - } - - public function null(): array|null - { - return ['data' => []]; - } -}