public function __construct($data, IncludedData
$includes, LinkCollection
$links, array
$meta =
[]) { assert($data instanceof TopLevelDataInterface ||
$data instanceof ErrorCollection
);
assert(!
$data instanceof ErrorCollection ||
$includes instanceof NullIncludedData
);
$this->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.
*/