public function read($length)
    {
        if (!$this->isReadable()) {
            throw new \RuntimeException('Could not read the stream because it is not readable');
        }

        $string = fread($this->stream, (int)$length);
        if ($string === false) {
            throw new \RuntimeException('Could not read the stream because of an error on fread()');
        }

        return $string;
    }
public function read($length)
    {
        if (!$this->isReadable()) {
            throw new \RuntimeException('Could not read the stream because it is not readable');
        }

        $string = fread($this->stream, (int)$length);
        if ($string === false) {
            throw new \RuntimeException('Could not read the stream because of an error on fread()');
        }

        return $string;
    }
public function read ( $ length ) { if ( ! $ this -> isReadable ( ) ) { throw new \ RuntimeException ( 'Could not read the stream because it is not readable' ) ; } $ string = fread ( $ this -> stream , ( int ) $ length ) ; if ( $ string === false ) { throw new \ RuntimeException ( 'Could not read the stream because of an error on fread()' ) ; } return $ string ; }
Read data from the stream.

@param int $length Read up to $length bytes from the object and return
them. Fewer than $length bytes may be returned if underlying stream
call returns fewer bytes.
@return string Returns the data read from the stream, or an empty string
if no bytes are available.
@throws \RuntimeException if an error occurs.
Read data from the stream .