Returns the remaining contents in a string

@return string

@throws \RuntimeException if unable to read or an error occurs while
reading.
@throws \TypeError
492543
public function getContents()
    {
        if (!\is_resource($this->stream)) {
            throw new \TypeError();
        }
        if (!$this->isReadable() || ($contents = \stream_get_contents($this->stream)) === false) {
            throw new \RuntimeException('Could not get contents of stream');
        }
        if (!isset($contents)) {
            $contents = '';
        }

        return (string) $contents;
    }
1248577
public function parse()
    {
        if (!is_string($this->data)) {
            throw new \RuntimeException('The given data is no valid string');
        }
        libxml_use_internal_errors(true);
        $xml = simplexml_load_string($this->data);
        if ($xml === false) {
            throw new \RuntimeException('Error during the loading of the XML file');
        }
        if (!isset($xml->executables, $xml->excludes)) {
            throw new \RuntimeException('Missing configuration elements');
        }

        foreach ($xml->excludes->children()->file as $file) {
            $this->config->addExcludedFile((string) $file);
        }

        foreach ($xml->excludes->children()->dir as $dir) {
            $this->config->addExcludedDir((string) $dir);
        }

        foreach ($xml->executables->children() as $file) {
            $this->config->addExecutableFile((string) $file);
        }

        return $this->config;
    }
771065
private function read()
    {
        $out = fgetcsv($this->handle, null, $this->delimiter, $this->enclosure);

        if (!is_array($out)) {
            return $out;
        }

        if ($this->encodingFrom !== null && $this->encodingTo !== null) {
            foreach ($out as $k => $v) {
                $out[$k] = iconv($this->encodingFrom, $this->encodingTo, $v);
            }
        }

        return $out;
    }
560778
protected function getText()
    {
        if ($this->value === null) {
            $text = $this->text;
        } elseif (is_array($this->value)) {
            $text = vsprintf($this->text, $this->value);
        } else {
            $text = sprintf($this->text, $this->value);
        }

        return $text;
    }
398877
public function getStubBannerFromFile()
    {
        if (null !== ($path = $this->getStubBannerPath())) {
            $path = $this->getBasePath() . DIRECTORY_SEPARATOR . $path;

            if (false === ($contents = @file_get_contents($path))) {
                $errors = error_get_last();
                if ($errors === null) {
                    $errors = array('message' => 'failed to get contents of \''.$path.'\'');
                }

                throw new RuntimeException($errors['message']);
            }

            return $contents;
        }

        return null;
    }
495754
public function toString()
    {
        $url = $this->scheme.':';
        if (trim($this->host) != '') {
            $url .= '//';
            if (trim($this->user) != '') {
                $url .= $this->user.((trim($this->pass) != '')?':'.$this->pass:'').'@';
            }
            $url .= $this->host;

            if (trim($this->port) != '') {
                $url .= ':'.$this->port;
            }
        }

        $url .= (trim($this->path) != '')?$this->path:'';
        $url .= (trim($this->query) != '')?'?'.$this->query:'';
        $url .= (trim($this->fragment) != '')?'#'.$this->fragment:'';

        if (!self::isValid($url)) {
            throw new RuntimeException('Built URL is not a valid one: '.$url);
        }

        return $url;
    }
363715
public function readString()
    {
        if (!is_resource($this->fp)) {
            return $this->raiseError('not connected');
        }

        $string = '';
        while (($char = @fread($this->fp, 1)) !== "\x00") {
            $string .= $char;
        }

        return $string;
    }
462445
protected function readString() {
        $startPosition = $this->currentPosition;
        ++$this->currentPosition;

        while ($this->currentPosition < $this->codeLength) {
            $currentChar = $this->code{$this->currentPosition};
            if ($currentChar === '\\') {
                $this->currentPosition += 2;
            } elseif ($currentChar === '"') {
                break;
            } else {
                ++$this->currentPosition;
            }
        }

        ++$this->currentPosition;
        $this->compressedCode .= substr($this->code, $startPosition, $this->currentPosition - $startPosition);
    }
1317165
public function parse()
    {
        $bytes = (int) $this->data;
        if ($bytes < 0) {
            return null;
        }

        $bytes += 2; // CRLF
        $string = '';

        do {
            $buffer = $this->read($bytes);
            $string .= $buffer;
            $bytes -= strlen($buffer);
        } while ($bytes > 0);

        return substr($string, 0, -2); // Remove last CRLF
    }
299559
public function getContents()
    {
        if (self::SCHEME_RESOURCE === $this->getScheme()) {
            $contents = '';
            while ($data = fread($this->stream, 2048)) {
                $contents .= $data;
            }
        } else {
            $contents = file_get_contents($this->uri);
        }
        return $contents;
    }
320836
public function getContents()
    {
        try {
            $fileObj = new SplFileObject($this->getName(true) , 'r');
        } catch ( RuntimeException $ex ) {
            throw new FileExistException('The provided file is not readable' , $ex);
        }

        return file_get_contents($fileObj->getPathname());
    }
993296
public function json()
    {
        $json = json_decode($this->getBody(), true);
        if ($json === null) {
            throw new RuntimeException(sprintf(
                "Can't decode response as JSON: %s",
                function_exists('json_last_error_msg')?
                    json_last_error_msg():
                    'Error code '.json_last_error()
            ));
        }
        return $json;
    }
1223505
public function getContent()
    {
        if (empty($this->_content) && $this->_headers->has('Content-Length') && $this->_headers->get('Content-Length') > 0)
        {
            $data = '';

            $input = fopen('php://input', 'r');
            while ($chunk = fread($input, 1024)) {
                $data .= $chunk;
            }

            fclose($input);

            $this->_content = $data;
        }

        return $this->_content;
    }
824992
public function readChar()
    {
        if ($this->buffer === null) {
            // Buffer is empty, fill it ...
            $read = $this->in->read($this->bufferSize);
            if ($read === -1) {
                $ch = -1;
            } else {
                $this->buffer = $read;

                return $this->readChar(); // recurse
            }
        } else {
            // Get next buffered char ...
            // handle case where buffer is read-in, but is empty.  The next readChar() will return -1 EOF,
            // so we just return empty string (char) at this point.  (Probably could also return -1 ...?)
            $ch = ($this->buffer !== "") ? $this->buffer{$this->bufferPos} : '';
            $this->bufferPos++;
            if ($this->bufferPos >= strlen($this->buffer)) {
                $this->buffer = null;
                $this->bufferPos = 0;
            }
        }

        return $ch;
    }
316662
public function getAbstract()
    {
        return strlen($this->content) > 400 ? StringUtils::resumeHtml($this->content, 400) : $this->content;
    }
389617
protected function getStdIn()
    {
        if ($this->stdIn && !feof($this->stdIn)) {
            return $this->stdIn;
        }

        try {
            $this->setStdIn();
        } catch (\Error $e) {
            throw new RuntimeException('Unable to read from STDIN', 0, $e);
        }

        return $this->stdIn;
    }
717713
public function read($length)
    {
        if ($length < 1) {
            return '';
        }

        $buffer = fread($this->stream, $length);

        if ($buffer === false) {
            throw new RuntimeException('Failed to read ' . $length . ' bytes');
        }

        return $buffer;
    }