public function getStringAtIndex($sharedStringIndex)
    {
        $tempFilePath = $this->getSharedStringTempFilePath($sharedStringIndex);
        $indexInFile = $sharedStringIndex % $this->maxNumStringsPerTempFile;

        if (!$this->globalFunctionsHelper->file_exists($tempFilePath)) {
            throw new SharedStringNotFoundException("Shared string temp file not found: $tempFilePath ; for index: $sharedStringIndex");
        }

        if ($this->inMemoryTempFilePath !== $tempFilePath) {
            // free memory
            unset($this->inMemoryTempFileContents);

            $this->inMemoryTempFileContents = explode(PHP_EOL, $this->globalFunctionsHelper->file_get_contents($tempFilePath));
            $this->inMemoryTempFilePath = $tempFilePath;
        }

        $sharedString = null;

        // Using isset here because it is way faster than array_key_exists...
        if (isset($this->inMemoryTempFileContents[$indexInFile])) {
            $escapedSharedString = $this->inMemoryTempFileContents[$indexInFile];
            $sharedString = $this->unescapeLineFeed($escapedSharedString);
        }

        if ($sharedString === null) {
            throw new SharedStringNotFoundException("Shared string not found for index: $sharedStringIndex");
        }

        return rtrim($sharedString, PHP_EOL);
    }
public function getStringAtIndex($sharedStringIndex)
    {
        $tempFilePath = $this->getSharedStringTempFilePath($sharedStringIndex);
        $indexInFile = $sharedStringIndex % $this->maxNumStringsPerTempFile;

        if (!$this->globalFunctionsHelper->file_exists($tempFilePath)) {
            throw new SharedStringNotFoundException("Shared string temp file not found: $tempFilePath ; for index: $sharedStringIndex");
        }

        if ($this->inMemoryTempFilePath !== $tempFilePath) {
            // free memory
            unset($this->inMemoryTempFileContents);

            $this->inMemoryTempFileContents = explode(PHP_EOL, $this->globalFunctionsHelper->file_get_contents($tempFilePath));
            $this->inMemoryTempFilePath = $tempFilePath;
        }

        $sharedString = null;

        // Using isset here because it is way faster than array_key_exists...
        if (isset($this->inMemoryTempFileContents[$indexInFile])) {
            $escapedSharedString = $this->inMemoryTempFileContents[$indexInFile];
            $sharedString = $this->unescapeLineFeed($escapedSharedString);
        }

        if ($sharedString === null) {
            throw new SharedStringNotFoundException("Shared string not found for index: $sharedStringIndex");
        }

        return rtrim($sharedString, PHP_EOL);
    }
public function getStringAtIndex ( $ sharedStringIndex ) { $ tempFilePath = $ this -> getSharedStringTempFilePath ( $ sharedStringIndex ) ; $ indexInFile = $ sharedStringIndex % $ this -> maxNumStringsPerTempFile ; if ( ! $ this -> globalFunctionsHelper -> file_exists ( $ tempFilePath ) ) { throw new SharedStringNotFoundException ( "Shared string temp file not found: $tempFilePath ; for index: $sharedStringIndex" ) ; } if ( $ this -> inMemoryTempFilePath !== $ tempFilePath ) { // free memory unset ( $ this -> inMemoryTempFileContents ) ; $ this -> inMemoryTempFileContents = explode ( PHP_EOL , $ this -> globalFunctionsHelper -> file_get_contents ( $ tempFilePath ) ) ; $ this -> inMemoryTempFilePath = $ tempFilePath ; } $ sharedString = null ; // Using isset here because it is way faster than array_key_exists... if ( isset ( $ this -> inMemoryTempFileContents [ $ indexInFile ] ) ) { $ escapedSharedString = $ this -> inMemoryTempFileContents [ $ indexInFile ] ; $ sharedString = $ this -> unescapeLineFeed ( $ escapedSharedString ) ; } if ( $ sharedString === null ) { throw new SharedStringNotFoundException ( "Shared string not found for index: $sharedStringIndex" ) ; } return rtrim ( $ sharedString , PHP_EOL ) ; }
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
Returns the string located at the given index from the cache .