data = $data instanceof TopLevelDataInterface ? $data->getData() : $data; $this->includes = $includes->getData(); $this->links = $data instanceof TopLevelDataInterface ? $data->getMergedLinks($links->withContext($this)) : $links->withContext($this); $this->meta = $data instanceof TopLevelDataInterface ? $data->getMergedMeta($meta) : $meta; $this->omissions = $data instanceof TopLevelDataInterface ? OmittedData::merge($data->getOmissions(), $includes->getOmissions()) : $includes->getOmissions(); } /** * Gets the data. * * @return \Drupal\jsonapi\JsonApiResource\Data|\Drupal\jsonapi\JsonApiResource\ErrorCollection * The data. */ public function getData() { return $this->data; } /** * Gets the links. * * @return \Drupal\jsonapi\JsonApiResource\LinkCollection * The top-level links. */ public function getLinks() { return $this->links; } /** * Gets the metadata. * * @return array * The metadata. */ public function getMeta() { return $this->meta; } /** * Gets a JSON:API Data object of resources to be included in the response. * * @return \Drupal\jsonapi\JsonApiResource\IncludedData * The includes. */ public function getIncludes() { return $this->includes; } /** * Gets an OmittedData instance containing resources to be omitted. * * @return \Drupal\jsonapi\JsonApiResource\OmittedData * The omissions. */ public function getOmissions() { return $this->omissions; } }