item($resourceKey, $datum); } return [ 'object' => 'list', 'data' => $response, ]; } /** * Serialize an item. */ public function item(?string $resourceKey, array $data): array { return [ 'object' => $resourceKey, 'attributes' => $data, ]; } /** * Serialize a null resource. */ public function null(): ?array { return [ 'object' => 'null_resource', 'attributes' => null, ]; } /** * Merge the included resources with the parent resource being serialized. */ public function mergeIncludes(array $transformedData, array $includedData): array { foreach ($includedData as $key => $datum) { $transformedData['relationships'][$key] = $datum; } return $transformedData; } }