protected function prepareChunk(StreamInterface $stream)
    {
        if ($this->hasSearchedUntilPos > -1 && $this->hasSearchedUntilPos < (strlen($this->workingBlob) - 1)) {
            // More work to do
            return true;
        }

        $chunk = $stream->getChunk();

        if ($chunk === false) {
            // EOF
            if ($this->hasSearchedUntilPos === -1 && strlen($this->workingBlob) > 0) {
                // EOF, but we haven't even started searching, special case that probably means we're dealing with a file of less size than the stream buffer
                // Therefore, keep looping
                return true;
            }
            return false;
        } else {
            // New chunk fetched
            if (!$this->firstNodeFound && !$this->options["extractContainer"]) {
                // Prevent a memory leak if we never find our first node, throw away our old stuff
                // but keep some letters to not cut off a first node
                $this->workingBlob = substr($this->workingBlob, -1 * strlen("<" . $this->options["uniqueNode"] . ">")) . $chunk;
            } else {
                $this->workingBlob .= $chunk;
            }
            
            return true;
        }
    }
protected function prepareChunk(StreamInterface $stream)
    {
        if ($this->hasSearchedUntilPos > -1 && $this->hasSearchedUntilPos < (strlen($this->workingBlob) - 1)) {
            // More work to do
            return true;
        }

        $chunk = $stream->getChunk();

        if ($chunk === false) {
            // EOF
            if ($this->hasSearchedUntilPos === -1 && strlen($this->workingBlob) > 0) {
                // EOF, but we haven't even started searching, special case that probably means we're dealing with a file of less size than the stream buffer
                // Therefore, keep looping
                return true;
            }
            return false;
        } else {
            // New chunk fetched
            if (!$this->firstNodeFound && !$this->options["extractContainer"]) {
                // Prevent a memory leak if we never find our first node, throw away our old stuff
                // but keep some letters to not cut off a first node
                $this->workingBlob = substr($this->workingBlob, -1 * strlen("<" . $this->options["uniqueNode"] . ">")) . $chunk;
            } else {
                $this->workingBlob .= $chunk;
            }
            
            return true;
        }
    }
protected function prepareChunk ( StreamInterface $ stream ) { if ( $ this -> hasSearchedUntilPos > - 1 && $ this -> hasSearchedUntilPos < ( strlen ( $ this -> workingBlob ) - 1 ) ) { // More work to do return true ; } $ chunk = $ stream -> getChunk ( ) ; if ( $ chunk === false ) { // EOF if ( $ this -> hasSearchedUntilPos === - 1 && strlen ( $ this -> workingBlob ) > 0 ) { // EOF, but we haven't even started searching, special case that probably means we're dealing with a file of less size than the stream buffer // Therefore, keep looping return true ; } return false ; } else { // New chunk fetched if ( ! $ this -> firstNodeFound && ! $ this -> options [ "extractContainer" ] ) { // Prevent a memory leak if we never find our first node, throw away our old stuff // but keep some letters to not cut off a first node $ this -> workingBlob = substr ( $ this -> workingBlob , - 1 * strlen ( "<" . $ this -> options [ "uniqueNode" ] . ">" ) ) . $ chunk ; } else { $ this -> workingBlob .= $ chunk ; } return true ; } }
Decides whether we're to fetch more chunks from the stream or keep working with what we have.
@param  StreamInterface $stream The stream provider
@return bool                    Keep working?
Decides whether we re to fetch more chunks from the stream or keep working with what we have .