CacheableOmission
final class CacheableOmission extends CacheableNormalization (View source)
| internal | JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it. |
Represents the cacheability associated with the omission of a value.
Traits
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.
Properties
| protected string[] | $cacheContexts | Cache contexts. |
from CacheableDependencyTrait |
| protected string[] | $cacheTags | Cache tags. |
from CacheableDependencyTrait |
| protected int | $cacheMaxAge | Cache max-age. |
from CacheableDependencyTrait |
| protected mixed | $normalization | A normalized value. |
from CacheableNormalization |
Methods
Sets cacheability; useful for value object constructors.
Creates a CacheableNormalization instance without any special cacheability.
A CacheableOmission should never have its normalization retrieved.
Converts the object to a CacheableOmission if the normalization is empty.
Gets a new CacheableNormalization with an additional dependency.
Collects an array of CacheableNormalizations into a single instance.
Ensures that no nested values are instances of this class.
Details
protected $this
setCacheability(CacheableDependencyInterface $cacheability)
Sets cacheability; useful for value object constructors.
getCacheTags()
{@inheritdoc}
getCacheContexts()
{@inheritdoc}
getCacheMaxAge()
{@inheritdoc}
__construct(CacheableDependencyInterface $cacheability)
CacheableOmission constructor.
static CacheableNormalization
permanent($no_op = NULL)
Creates a CacheableNormalization instance without any special cacheability.
array|string|int|float|bool|null
getNormalization()
A CacheableOmission should never have its normalization retrieved.
CacheableNormalization|CacheableOmission
omitIfEmpty()
Converts the object to a CacheableOmission if the normalization is empty.
CacheableNormalization
withCacheableDependency(CacheableDependencyInterface $dependency)
Gets a new CacheableNormalization with an additional dependency.
static CacheableNormalization
aggregate(array $cacheable_normalizations)
Collects an array of CacheableNormalizations into a single instance.
static protected bool
hasNoNestedInstances(array|Traversable $array)
Ensures that no nested values are instances of this class.