La clase CachingIterator

(PHP 5, PHP 7, PHP 8)

Introducción

Este objeto soporta las iteraciones en caché sobre otro iterador.

Sinopsis de la Clase

class CachingIterator extends IteratorIterator implements ArrayAccess, Countable, Stringable {
/* Constantes */
public const int CALL_TOSTRING;
public const int CATCH_GET_CHILD;
public const int TOSTRING_USE_KEY;
public const int TOSTRING_USE_INNER;
public const int FULL_CACHE;
/* Métodos */
public function __construct(Iterator $iterator, int $flags = CachingIterator::CALL_TOSTRING)
public function count(): int
public function current(): mixed
public function getCache(): array
public function getFlags(): int
public function hasNext(): bool
public function key(): scalar
public function next(): void
public function offsetExists(string $key): bool
public function offsetGet(string $key): mixed
public function offsetSet(string $key, mixed $value): void
public function offsetUnset(string $key): void
public function rewind(): void
public function setFlags(int $flags): void
public function __toString(): string
public function valid(): bool
/* Métodos heredados */
public function IteratorIterator::current(): mixed
public function IteratorIterator::key(): mixed
public function IteratorIterator::next(): void
public function IteratorIterator::rewind(): void
public function IteratorIterator::valid(): bool
}

Constantes predefinidas

CachingIterator::CALL_TOSTRING

Convierte todos los elementos en strings.

CachingIterator::CATCH_GET_CHILD

No lanza ninguna excepción al intentar acceder a un hijo.

CachingIterator::TOSTRING_USE_KEY

Utiliza key durante la conversión en string.

CachingIterator::TOSTRING_USE_CURRENT

Utiliza current durante la conversión en string.

CachingIterator::TOSTRING_USE_INNER

Utiliza inner durante la conversión en string.

CachingIterator::FULL_CACHE

Almacena en caché todos los datos leídos.

Historial de cambios

Versión Descripción
8.0.0 La clase CachingIterator implementa ahora Stringable.

Tabla de contenidos