public function setInput($input)
    {
        // Resetting the parser
        $this->lineIndex = 0;
        $this->startLine = 0;

        if (is_string($input)) {
            // Convering to a stream.
            $stream = fopen('php://temp', 'r+');
            fwrite($stream, $input);
            rewind($stream);
            $this->input = $stream;
        } elseif (is_resource($input)) {
            $this->input = $input;
        } else {
            throw new \InvalidArgumentException('This parser can only read from strings or streams.');
        }
    }
public function setInput($input)
    {
        // Resetting the parser
        $this->lineIndex = 0;
        $this->startLine = 0;

        if (is_string($input)) {
            // Convering to a stream.
            $stream = fopen('php://temp', 'r+');
            fwrite($stream, $input);
            rewind($stream);
            $this->input = $stream;
        } elseif (is_resource($input)) {
            $this->input = $input;
        } else {
            throw new \InvalidArgumentException('This parser can only read from strings or streams.');
        }
    }
public function setInput ( $ input ) { // Resetting the parser $ this -> lineIndex = 0 ; $ this -> startLine = 0 ; if ( is_string ( $ input ) ) { // Convering to a stream. $ stream = fopen ( 'php://temp' , 'r+' ) ; fwrite ( $ stream , $ input ) ; rewind ( $ stream ) ; $ this -> input = $ stream ; } elseif ( is_resource ( $ input ) ) { $ this -> input = $ input ; } else { throw new \ InvalidArgumentException ( 'This parser can only read from strings or streams.' ) ; } }
Sets the input buffer. Must be a string or stream.

@param resource|string $input
Sets the input buffer . Must be a string or stream .