public function getContents(): string
    {
        // If the stream isn't readable
        if (! $this->isReadable()) {
            // Throw a runtime exception
            throw new RuntimeException('Stream is not readable');
        }

        // Get the stream contents
        $result = stream_get_contents($this->stream);

        // If there was a failure in getting the stream contents
        if (false === $result) {
            // Throw a runtime exception
            throw new RuntimeException('Error reading from stream');
        }

        return $result;
    }
public function getContents(): string
    {
        // If the stream isn't readable
        if (! $this->isReadable()) {
            // Throw a runtime exception
            throw new RuntimeException('Stream is not readable');
        }

        // Get the stream contents
        $result = stream_get_contents($this->stream);

        // If there was a failure in getting the stream contents
        if (false === $result) {
            // Throw a runtime exception
            throw new RuntimeException('Error reading from stream');
        }

        return $result;
    }
public function getContents ( ) : string { // If the stream isn't readable if ( ! $ this -> isReadable ( ) ) { // Throw a runtime exception throw new RuntimeException ( 'Stream is not readable' ) ; } // Get the stream contents $ result = stream_get_contents ( $ this -> stream ) ; // If there was a failure in getting the stream contents if ( false === $ result ) { // Throw a runtime exception throw new RuntimeException ( 'Error reading from stream' ) ; } return $ result ; }
Returns the remaining contents in a string.

@throws \RuntimeException
if unable to read or an error occurs while reading.

@return string
Returns the remaining contents in a string .