protected function convertDocument($data) { $this->validator->validateContent($data); $document = new Document(); if (isset($data->errors)) { $document->errors = $data->errors; // Todo: convert errors to objects if needed. } else { $resources = $data->data; if (is_array($resources)) { $document->singleResource = false; $resources = $this->convertResources($resources); } else { $document->singleResource = true; $resources = $this->convertResource($resources); } $document->resources = $resources; } return $document; }
public function validateRequest(Request $request) { return $this->validator->validateRequest($request); }