src/Collection.php
final private function getCachedIterator(): CachingIterator
    {
        // If cache is generated, return it
        if (isset($this->iterator)) {
            return $this->iterator;
        }

        // Create and return new CachedIterator from the data
        return $this->iterator = new CachingIterator(

            // The raw data
            new ArrayIterator($this->data),

            // Always use original data and force all items to be cached on read
            CachingIterator::TOSTRING_USE_CURRENT | CachingIterator::FULL_CACHE
        );
    }
final private function getCachedIterator(): CachingIterator
    {
        // If cache is generated, return it
        if (isset($this->iterator)) {
            return $this->iterator;
        }

        // Create and return new CachedIterator from the data
        return $this->iterator = new CachingIterator(

            // The raw data
            new ArrayIterator($this->data),

            // Always use original data and force all items to be cached on read
            CachingIterator::TOSTRING_USE_CURRENT | CachingIterator::FULL_CACHE
        );
    }
final private function getCachedIterator ( ) : CachingIterator { // If cache is generated, return it if ( isset ( $ this -> iterator ) ) { return $ this -> iterator ; } // Create and return new CachedIterator from the data return $ this -> iterator = new CachingIterator ( // The raw data new ArrayIterator ( $ this -> data ) , // Always use original data and force all items to be cached on read CachingIterator :: TOSTRING_USE_CURRENT | CachingIterator :: FULL_CACHE ) ; }
Get the cache

@return CachingIterator
Get the cache