Instead of the hasNext() / next() syntax, readers now implements the PHP iterator pattern. It allows readers to be used with a foreach() loop. All readers now share the same structure (CSV is treated as having exactly one sheet): - one concrete Reader - one SheetIterator, exposed by the Reader - one or more Sheets, returned at every iteration - one RowIterator, exposed by the Sheet Introducing the concept of sheets for CSV may be kind of confusing but it makes Spout way more consistent. Also, this confusion may be resolved by creating a wrapper around the readers if needed. -- This commit does not delete the old files, not change the folder structure for Writers. This will be done in another commit.
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Box\Spout\Reader\XLSX\Helper\SharedStringsCaching;
|
|
|
|
/**
|
|
* Interface CachingStrategyInterface
|
|
*
|
|
* @package Box\Spout\Reader\XLSX\Helper\SharedStringsCaching
|
|
*/
|
|
interface CachingStrategyInterface
|
|
{
|
|
/**
|
|
* Adds the given string to the cache.
|
|
*
|
|
* @param string $sharedString The string to be added to the cache
|
|
* @param int $sharedStringIndex Index of the shared string in the sharedStrings.xml file
|
|
* @return void
|
|
*/
|
|
public function addStringForIndex($sharedString, $sharedStringIndex);
|
|
|
|
/**
|
|
* Closes the cache after the last shared string was added.
|
|
* This prevents any additional string from being added to the cache.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function closeCache();
|
|
|
|
/**
|
|
* Returns the string located at the given index from the cache.
|
|
*
|
|
* @param int $sharedStringIndex Index of the shared string in the sharedStrings.xml file
|
|
* @return string The shared string at the given index
|
|
* @throws \Box\Spout\Reader\Exception\SharedStringNotFoundException If no shared string found for the given index
|
|
*/
|
|
public function getStringAtIndex($sharedStringIndex);
|
|
|
|
/**
|
|
* Destroys the cache, freeing memory and removing any created artifacts
|
|
*
|
|
* @return void
|
|
*/
|
|
public function clearCache();
|
|
}
|