private function getChunkedString($string)
    {
        $firstLine = '';
        if ($this->tell() !== 0) {
            $next = $this->lineLength - ($this->position % ($this->lineLength + $this->lineEndingLength));
            if (strlen($string) > $next) {
                $firstLine = substr($string, 0, $next) . $this->lineEnding;
                $string = substr($string, $next);
            }
        }
        // chunk_split always ends with the passed line ending
        $chunked = $firstLine . chunk_split($string, $this->lineLength, $this->lineEnding);
        return substr($chunked, 0, strlen($chunked) - $this->lineEndingLength);
    }
private function getChunkedString($string)
    {
        $firstLine = '';
        if ($this->tell() !== 0) {
            $next = $this->lineLength - ($this->position % ($this->lineLength + $this->lineEndingLength));
            if (strlen($string) > $next) {
                $firstLine = substr($string, 0, $next) . $this->lineEnding;
                $string = substr($string, $next);
            }
        }
        // chunk_split always ends with the passed line ending
        $chunked = $firstLine . chunk_split($string, $this->lineLength, $this->lineEnding);
        return substr($chunked, 0, strlen($chunked) - $this->lineEndingLength);
    }
private function getChunkedString ( $ string ) { $ firstLine = '' ; if ( $ this -> tell ( ) !== 0 ) { $ next = $ this -> lineLength - ( $ this -> position % ( $ this -> lineLength + $ this -> lineEndingLength ) ) ; if ( strlen ( $ string ) > $ next ) { $ firstLine = substr ( $ string , 0 , $ next ) . $ this -> lineEnding ; $ string = substr ( $ string , $ next ) ; } } // chunk_split always ends with the passed line ending $ chunked = $ firstLine . chunk_split ( $ string , $ this -> lineLength , $ this -> lineEnding ) ; return substr ( $ chunked , 0 , strlen ( $ chunked ) - $ this -> lineEndingLength ) ; }
Inserts the line ending character after each line length characters in
the passed string, making sure previously written bytes are taken into
account.

@param string $string
@return string
Inserts the line ending character after each line length characters in the passed string making sure previously written bytes are taken into account .