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

void
append(mixed $value)

Append a value to the ArrayObject.

bool
asort(int $flags = SORT_REGULAR)

Sort the ArrayObject.

int
count()

Count the ArrayObject.

array
exchangeArray(array|object $array)

Exchange the current array with another array or object.

array
getArrayCopy()

Exports the \ArrayObject to an array.

int
getFlags()

Gets the behavior flags of the \ArrayObject.

getIterator()

Create a new iterator from an ArrayObject instance.

string
getIteratorClass()

Gets the class name of the array iterator that is used by \ArrayObject::getIterator().

bool
ksort(int $flags = SORT_REGULAR)

Sort the entries by key.

bool
natcasesort()

Sort an array using a case insensitive "natural order" algorithm.

bool
natsort()

Sort entries using a "natural order" algorithm.

bool
offsetExists(mixed $key)

Returns whether the requested index exists.

mixed
offsetGet(mixed $key)

Returns the value at the specified index.

void
offsetSet(mixed $key, mixed $value)

Sets the value at the specified index to new value.

void
offsetUnset(mixed $key)

Unsets the value at the specified index.

void
setFlags(int $flags)

Sets the behavior flags for the \ArrayObject.

void
setIteratorClass(string $iteratorClass)

Sets the iterator classname for the \ArrayObject.

bool
uasort(callable $callback)

Sort the entries with a user-defined comparison function.

bool
uksort(callable $callback)

Sort the entries by keys using a user-defined comparison function.

$this
setCacheability(CacheableDependencyInterface $cacheability)

Sets cacheability; useful for value object constructors.

getCacheTags()

{@inheritdoc}

__construct(CacheableDependencyInterface $cacheability)

CacheableOmission constructor.

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.

omitIfEmpty()

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

withCacheableDependency(CacheableDependencyInterface $dependency)

Gets a new CacheableNormalization with an additional dependency.

aggregate(array $cacheable_normalizations)

Collects an array of CacheableNormalizations into a single instance.

static bool
hasNoNestedInstances(array|Traversable $array)

Ensures that no nested values are instances of this class.

Details

void append(mixed $value)

Append a value to the ArrayObject.

Parameters

mixed $value

The value to append to the ArrayObject.

Return Value

void

Exceptions

Exception

bool asort(int $flags = SORT_REGULAR)

Sort the ArrayObject.

Parameters

int $flags

The flags to sort the ArrayObject by.

Return Value

bool

This method always returns TRUE.

Exceptions

Exception

int count()

Count the ArrayObject.

Return Value

int

The number of public properties in the \ArrayObject.

Exceptions

Exception

array exchangeArray(array|object $array)

Exchange the current array with another array or object.

Parameters

array|object $array

The array to replace for the current array.

Return Value

array

The new array or object to exchange with the current array.

Exceptions

Exception

array getArrayCopy()

Exports the \ArrayObject to an array.

Return Value

array

Returns a copy of the array.

Exceptions

Exception

int getFlags()

Gets the behavior flags of the \ArrayObject.

Return Value

int

Returns the behavior flags of the \ArrayObject.

Exceptions

Exception

Iterator getIterator()

Create a new iterator from an ArrayObject instance.

Return Value

Iterator

An iterator from the ArrayObject.

Exceptions

Exception

string getIteratorClass()

Gets the class name of the array iterator that is used by \ArrayObject::getIterator().

Return Value

string

Returns the iterator class name that is used to iterate over this object.

Exceptions

Exception

bool ksort(int $flags = SORT_REGULAR)

Sort the entries by key.

Parameters

int $flags

The flags to sort the ArrayObject by.

Return Value

bool

This method always returns TRUE.

Exceptions

Exception

bool natcasesort()

Sort an array using a case insensitive "natural order" algorithm.

Return Value

bool

This method always returns TRUE.

Exceptions

Exception

bool natsort()

Sort entries using a "natural order" algorithm.

Return Value

bool

This method always returns TRUE.

Exceptions

Exception

bool offsetExists(mixed $key)

Returns whether the requested index exists.

Parameters

mixed $key

The index being checked.

Return Value

bool

Return TRUE if the requested index exists, otherwise FALSE.

Exceptions

Exception

mixed offsetGet(mixed $key)

Returns the value at the specified index.

Parameters

mixed $key

The index with the value.

Return Value

mixed

The value at the specified index or null.

Exceptions

Exception

void offsetSet(mixed $key, mixed $value)

Sets the value at the specified index to new value.

Parameters

mixed $key

The index being set.

mixed $value

The new value for the key.

Return Value

void

Exceptions

Exception

void offsetUnset(mixed $key)

Unsets the value at the specified index.

Parameters

mixed $key

The index being unset.

Return Value

void

Exceptions

Exception

void setFlags(int $flags)

Sets the behavior flags for the \ArrayObject.

Parameters

int $flags

Set the flags that change the behavior of the \ArrayObject.

Return Value

void

Exceptions

Exception

void setIteratorClass(string $iteratorClass)

Sets the iterator classname for the \ArrayObject.

Parameters

string $iteratorClass

The classname of the array iterator to use when iterating over this object.

Return Value

void

Exceptions

Exception

bool uasort(callable $callback)

Sort the entries with a user-defined comparison function.

Parameters

callable $callback

The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Return Value

bool

This method always returns TRUE.

Exceptions

Exception

bool uksort(callable $callback)

Sort the entries by keys using a user-defined comparison function.

Parameters

callable $callback

The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Return Value

bool

This method always returns TRUE.

Exceptions

Exception

protected $this setCacheability(CacheableDependencyInterface $cacheability)

Sets cacheability; useful for value object constructors.

Parameters

CacheableDependencyInterface $cacheability

The cacheability to set.

Return Value

$this

getCacheTags()

{@inheritdoc}

getCacheContexts()

{@inheritdoc}

getCacheMaxAge()

{@inheritdoc}

__construct(CacheableDependencyInterface $cacheability)

CacheableOmission constructor.

Parameters

CacheableDependencyInterface $cacheability

The cacheability metadata for the normalized data.

static CacheableNormalization permanent($no_op = NULL)

Creates a CacheableNormalization instance without any special cacheability.

Parameters

$no_op

Return Value

CacheableNormalization

The CacheableNormalization.

array|string|int|float|bool|null getNormalization()

A CacheableOmission should never have its normalization retrieved.

Return Value

array|string|int|float|bool|null

The normalization.

CacheableNormalization|CacheableOmission omitIfEmpty()

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

Return Value

CacheableNormalization|CacheableOmission

A CacheableOmission if the normalization is considered empty, self otherwise.

CacheableNormalization withCacheableDependency(CacheableDependencyInterface $dependency)

Gets a new CacheableNormalization with an additional dependency.

Parameters

CacheableDependencyInterface $dependency

The new cacheable dependency.

Return Value

CacheableNormalization

A new object based on the current value with an additional cacheable dependency.

static CacheableNormalization aggregate(array $cacheable_normalizations)

Collects an array of CacheableNormalizations into a single instance.

Parameters

array $cacheable_normalizations

An array of CacheableNormalizations.

Return Value

CacheableNormalization

A new CacheableNormalization. Each input value's cacheability will be merged into the return value's cacheability. The return value's normalization will be an array of the input's normalizations. This method does not behave like array_merge() or NestedArray::mergeDeep().

static protected bool hasNoNestedInstances(array|Traversable $array)

Ensures that no nested values are instances of this class.

Parameters

array|Traversable $array

The traversable object which may contain instance of this object.

Return Value

bool

Whether the given object or its children have CacheableNormalizations in them.