You are here

public function CacheableNormalization::omitIfEmpty in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php \Drupal\jsonapi\Normalizer\Value\CacheableNormalization::omitIfEmpty()

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

core/modules/jsonapi/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;
}