CachingIterator クラス

(PHP 5, PHP 7, PHP 8)

はじめに

このオブジェクトは、別のイテレータからキャッシュされた反復処理をサポートします。

クラス概要

class CachingIterator extends IteratorIterator implements ArrayAccess, Countable, Stringable {
/* 定数 */
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;
/* メソッド */
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
/* 継承したメソッド */
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
}

定義済み定数

CachingIterator::CALL_TOSTRING

それぞれの要素を文字列に変換します

CachingIterator::CATCH_GET_CHILD

子要素にアクセスする際、例外をスローしません

CachingIterator::TOSTRING_USE_KEY

文字列に変換する際に key を使います。

CachingIterator::TOSTRING_USE_CURRENT

文字列に変換する際に current を使います。

CachingIterator::TOSTRING_USE_INNER

文字列に変換する際に inner を使います。

CachingIterator::FULL_CACHE

読み込んだデータを全てキャッシュします。

変更履歴

バージョン 説明
8.0.0 CachingIterator は、 Stringable を新たに実装しました。

目次