You are here

public function CacheableNormalization::omitIfEmpty in JSON:API 8.2

Converts the object to a CacheableOmission if the normalization is empty.

Return value

self|\Drupal\jsonapi\Normalizer\Value\CacheableOmission A CacheableOmission if the normalization is considered empty, self otherwise.

File

src/Normalizer/Value/CacheableNormalization.php, line 76

Class

CacheableNormalization
Use to store normalized data and its cacheability.

Namespace

Drupal\jsonapi\Normalizer\Value

Code

public function omitIfEmpty() {
  return empty($this->normalization) ? new CacheableOmission($this) : $this;
}